This is the mail archive of the
guile@sources.redhat.com
mailing list for the Guile project.
Representation of VM programs---applicable smobs?
Keisuke Nishida <kxn30@po.cwru.edu> writes:
> Guile doesn't understand my VM...
I think we should find a new representation of your programs.
I think they should look like a primitive procedure to the Scheme
user.
If you didn't need special treatment of marking, I would have
suggested a compiled closure.
One representation which probably would work is as a struct entity (a
applicable struct). You would then have to compute a struct layout to
select which words should be GC protected, instead of computing this
at GC time as you do now.
I wish we instead already had the new struct representation...
A third possibility is to add applicable smobs to Guile---quite an
interesting idea actually. It seems that this has a niche of its own,
just like smobs have their niche (simple, extensible, low-level
representation).
Actually, several of the current uses of compiled closures would fit
much better as applicable smobs (lower overhead). This holds, for
example, for standard-eval-closures.
What are people's opinion about adding applicable smobs to Guile?
(This implies adding a new entry for scm_tc7_smob in the application
switches in SCM_CEVAL and SCM_DAPPLY.)
Before we have applicable smobs, a compromise is that you pack VM
program smobs inside a compiled closure (made using scm_makcclo).
You would store a VM apply as element 0 and the VM program smob as
element 1 in the closure vector.