Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ftype-scheme-object-pointer and related foreign-pointer extensions #897

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix typos
  • Loading branch information
mflatt committed Dec 25, 2024
commit ddf61e7addbc3abe9cda0d3f6f9829247213515d
16 changes: 8 additions & 8 deletions csug/foreign.stex
Original file line number Diff line number Diff line change
Expand Up @@ -651,10 +651,10 @@ to a Scheme object, such as one created with
C side is like the one produced by \scheme{object->reference-address}
for a non-\scheme{#f} value; using the result of
\scheme{object->reference-address} with \scheme{make-ftype-pointer}
woudl produce the result, but only with locked objects that
would produce the result, but only with locked objects that
cannot move, while \scheme{make-ftype-scheme-object-pointer} defers
conversion to an address to a point before the call but after a
garbage collection cna take place (assuming that
garbage collection can take place (assuming that
\scheme{__collect_safe} is not used). Note that
\scheme{ftype-scheme-object-pointer} differs from \scheme{scheme-object}
by delivering specifically a reference address to the foreign
Expand Down Expand Up @@ -976,7 +976,7 @@ generic ftype pointer encapsulating the address is returned.
\foreigntype{\scheme{ftype-scheme-object-pointer}}
\index{ftype-scheme-object-pointer}The result is interpreted as the reference
address of a Scheme object, and it is returned as encapsulated within
mflatt marked this conversation as resolved.
Show resolved Hide resolved
foreign object pointer as created with
a foreign object pointer as created with
\scheme{make-ftype-scheme-object-pointer}. Note that
\scheme{ftype-scheme-object-pointer} differs from
\scheme{scheme-object} in that it receives a reference address from the
Expand Down Expand Up @@ -1753,7 +1753,7 @@ Each \var{ftype-name} in an \var{ftype} must either
\scheme{foreign-ref} and \scheme{foreign-set!}, or
(d) \scheme{ftype-pointer} or \scheme{ftype-scheme-object-pointer},
which indicate a generic ftype pointer or an ftype pointer for a Scheme
object, respectivly.
object, respectively.
In case (b), any reference within one \var{ftype} to the
\var{ftype-name} of one of the earlier bindings is permissible,
but a reference to the \var{ftype-name} of the current or a
Expand Down Expand Up @@ -2080,18 +2080,18 @@ via one of the methods described in Section ~\ref{SECTFOREIGNACCESS}.
\listlibraries
\endentryheader

Returns a ftype pointer object that can be used in the same places as
Returns an ftype pointer object that can be used in the same places as
a generic ftype pointer, and where the address encapsulated by the
pointer a reference address in the sense of
pointer is a reference address in the sense of
\scheme{object->reference-address}. The reference address is for the
result of \var{expr}, without special treatment of \scheme{#f}. If
an \var{offset} expression is present, then it must produce a
\scheme{iptr}-compatible integer, and the address encapsulated by the
pointer is shifted by that amount.

The resulting ftype pointer is rcognized by
The resulting ftype pointer is recognized by
\scheme{ftype-scheme-object-pointer?} as well as
\scheme{ftype-pointer?} without a \var{ftype-name}.
\scheme{ftype-pointer?} without an \var{ftype-name}.

%----------------------------------------------------------------------------
\entryheader
Expand Down
2 changes: 1 addition & 1 deletion s/cpprim.ss
Original file line number Diff line number Diff line change
Expand Up @@ -7711,7 +7711,7 @@
,(%seq
(set! ,(%mref ,t-vec ,(constant stencil-vector-type-disp))
,(build-stencil-vector-type e-mask type))
;; Content not filled! This function is meant to be cal<led by
;; Content not filled! This function is meant to be called by
;; `[$]$stencil-vector-do-update`, which has GC disabled between
;; allocation and filling in the data
,t-vec)))))))
Expand Down
2 changes: 1 addition & 1 deletion s/mkgc.ss
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@
(set! mask >>= 1)
(set! pp += 1))]))]
[(== num #t)
;; special protocol for an object created by `make-object-ftype-pointer`
;; special protocol for an object created by `make-ftype-scheme-object-pointer`
(define offset : uptr (cast uptr (* (+ pp 1))))
(define obj : ptr (TO_PTR (- (cast uptr (* pp)) offset)))
(trace (just obj))
Expand Down