Just had a curious thought I could not find the answer from poking around...
Is Slang able to make use of the FFI interface? I see things like file primitives with C-code scaffolding around system calls, and wonder if this C-code could be reduced by Slang calling directly to system functions through FFI, with scaffolding written in Slang?
Does that make any sense? cheers -ben
Just had a curious thought I could not find the answer from poking around...
Is Slang able to make use of the FFI interface? I see things like file primitives with C-code scaffolding around system calls, and wonder if this C-code could be reduced by Slang calling directly to system functions through FFI, with scaffolding written in Slang?
Does that make any sense? cheers -ben
IMO, that is probably not a productive approach. The advantage of plugins (slang) is that they are reliable and stable, and they let the C compiler worry about low level things such as data structures and word alignment. FFI interfaces are free of the requirement to compile one's own VM plugins, but they are relatively fragile and dependent on low level platform and compiler differences.
If you combine the two, you get the worst of both worlds - a relatively fragile and platform-dependent interface that still requires you to compile your own plugins.
Dave
Hi Ben,
On Mon, Aug 24, 2015 at 6:20 AM, Ben Coman btc@openinworld.com wrote:
Just had a curious thought I could not find the answer from poking around...
Is Slang able to make use of the FFI interface? I see things like file primitives with C-code scaffolding around system calls, and wonder if this C-code could be reduced by Slang calling directly to system functions through FFI, with scaffolding written in Slang?
Does that make any sense?
Yes it makes sense but it isn't a benefit. You're saying that the FFI can provide the marshalling that is written manually in plugins. But given that the plugins are already written it doesn't really get us anything. You'd have to introduce a specification language between the plugin's primitive interface and given C calls that Slang would translate into suitable marshalling code to cut out the human author. Seems to me that's a lot of effort to auto-generate a small amount of code. I think more interesting is writing direct to the FFI.
But people have discussed taking a functional interface written w.r.t. the FFI and autogenerating a plugin for it, to provide the security and encapsulation benefits. Thing is, would it be part of Slang or part of the FFI? Perhaps it could use elements of both. But I'm not sure there's enough use cases to justify the effort.
_,,,^..^,,,_ best, Eliot
vm-dev@lists.squeakfoundation.org