Criteria For Plugin Compatibility

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Criteria For Plugin Compatibility

Chris Cunnington-4

I had the idea that a plugin from one VM could be dragged into another VM's directory and that it could be used just by starting up the image. I've done a little experimenting and it seems more of an idea of a reality. The functionality is there, but VM developers over the years have not seen this as a priority. Typically plugins and their VMs are compiled together. Or a person adds one by recompiling a VM compilation rig they already have.

As I had a rig for the Interpreter VM I decided to compile a plugin and see if I could drag it around to other VM directories for use. Most times it didn't work.

I compiled a TheUniversalAnswer plugin which returns 42. I moved it from a 4.14.1-3430 VM to a 4.14.1-3414 VM. I could get it to work if I did not use the squeak.sh start script. That is, I dragged so.vm-sound-null, so.TheUniversalAnswer and so.vm-display-X11 into the same directory as the VM binary. That worked.

The only way to see the external plugins is with #listLoadedModules. But, irritatingly, modules are loaded as needed, so once you have proof of using the primitive from the plugin, yea, it will appear as a result of that Smalltalk listLoadedModules message. So, it's not that useful.

I dragged so.TheUniversalAnswer around to other VMs such as 4.0.3-2202 and 4.13.10-3268 without success. And the unload selectors #forgetModule: and unloadModule:, which both use primitive 571 don't appear to work on my Ubuntu 15.04.

So, I don't know if a community of plugins passed around is in the offing. What I have learned is that many of the answers are in sqUnixExternalPrims.c. The issues are really where does the VM look for primitives and what does it do when it finds one. It appears to me, after reading both the non-Cog and Cog versions of that file, that this an interesting area poorly documented that VM developers alter in haste to get on to something else.

It's pretty important stuff, though. Do you start the VM with the binary on the path? Do you use squeak.sh? Where is the VM looking for stuff. Where will FFI look for stuff. And so on.

Chris



Reply | Threaded
Open this post in threaded view
|

Re: Criteria For Plugin Compatibility

Eliot Miranda-2
Hi Chris,

On Fri, Sep 11, 2015 at 9:01 AM, Chris Cunnington <[hidden email]> wrote:

I had the idea that a plugin from one VM could be dragged into another VM's directory and that it could be used just by starting up the image. I've done a little experimenting and it seems more of an idea of a reality. The functionality is there, but VM developers over the years have not seen this as a priority. Typically plugins and their VMs are compiled together. Or a person adds one by recompiling a VM compilation rig they already have.


The problems I see with this are

a) a plugin compiled for Spur may not work with V3 or vice verse.  The issue is the header size of an object.  Some plugins, but not all, use this define, and the header sizes between Spur and V3 are incompatible.

b) 32-bit plugins won't work with 64-bit VMs, and 64-bit plugins won't work with 32-bit VMs. Period.

Now there are platform-level packaging technologies, such as fat binaries on Mac OS X, that allow one to construct plugins that contain more than one binary.  But this is a lot of work to build and maintain.

So personally I wouldn't put much effort into this level of drag-and-drop compatibility.  Instead I'd put energy into good error messages so that when plugins don't work the user can find out why, and that when the wrong kind of plugin is used the VM doesn't just stumble along, maybe producing incorrect results, but instead puts the plugin out with a comprehensible complaint.

Does this make sense?  I know its a downer, but what you propose is, IMO, not affordable given our resources.


And I must say, *this is a VM-DEV discussion, not a general purpose Squeak discussion*, yes?

As I had a rig for the Interpreter VM I decided to compile a plugin and see if I could drag it around to other VM directories for use. Most times it didn't work.

I compiled a TheUniversalAnswer plugin which returns 42. I moved it from a 4.14.1-3430 VM to a 4.14.1-3414 VM. I could get it to work if I did not use the squeak.sh start script. That is, I dragged so.vm-sound-null, so.TheUniversalAnswer and so.vm-display-X11 into the same directory as the VM binary. That worked.

The only way to see the external plugins is with #listLoadedModules. But, irritatingly, modules are loaded as needed, so once you have proof of using the primitive from the plugin, yea, it will appear as a result of that Smalltalk listLoadedModules message. So, it's not that useful.

I dragged so.TheUniversalAnswer around to other VMs such as 4.0.3-2202 and 4.13.10-3268 without success. And the unload selectors #forgetModule: and unloadModule:, which both use primitive 571 don't appear to work on my Ubuntu 15.04.

So, I don't know if a community of plugins passed around is in the offing. What I have learned is that many of the answers are in sqUnixExternalPrims.c. The issues are really where does the VM look for primitives and what does it do when it finds one. It appears to me, after reading both the non-Cog and Cog versions of that file, that this an interesting area poorly documented that VM developers alter in haste to get on to something else.

It's pretty important stuff, though. Do you start the VM with the binary on the path? Do you use squeak.sh? Where is the VM looking for stuff. Where will FFI look for stuff. And so on.

Chris







--
_,,,^..^,,,_
best, Eliot


Reply | Threaded
Open this post in threaded view
|

Re: [Vm-dev] Re: [squeak-dev] Criteria For Plugin Compatibility

David T. Lewis
Eliot,

I agree. Indeed, even with an interpreter VM it has long been the case
that a plugin compiled as 64 bit will not work on a VM compiled for 64 bit
and vice versa. With the number of variations of 32/64, Spur/V3, and so
forth, I don't think that this is a problem worth worrying about. Better
to just be a aware that plugins are not readily interchangeable in those
cases.

Dave

>  Hi Chris,
>
> On Fri, Sep 11, 2015 at 9:01 AM, Chris Cunnington <[hidden email]>
> wrote:
>
>> I had the idea that a plugin from one VM could be dragged into another
>> VM's directory and that it could be used just by starting up the image.
>> I've done a little experimenting and it seems more of an idea of a
>> reality.
>> The functionality is there, but VM developers over the years have not
>> seen
>> this as a priority. Typically plugins and their VMs are compiled
>> together.
>> Or a person adds one by recompiling a VM compilation rig they already
>> have.
>>
>
> The problems I see with this are
>
> a) a plugin compiled for Spur may not work with V3 or vice verse.  The
> issue is the header size of an object.  Some plugins, but not all, use
> this
> define, and the header sizes between Spur and V3 are incompatible.
>
> b) 32-bit plugins won't work with 64-bit VMs, and 64-bit plugins won't
> work
> with 32-bit VMs. Period.
>
> Now there are platform-level packaging technologies, such as fat binaries
> on Mac OS X, that allow one to construct plugins that contain more than
> one
> binary.  But this is a lot of work to build and maintain.
>
> So personally I wouldn't put much effort into this level of drag-and-drop
> compatibility.  Instead I'd put energy into good error messages so that
> when plugins don't work the user can find out why, and that when the wrong
> kind of plugin is used the VM doesn't just stumble along, maybe producing
> incorrect results, but instead puts the plugin out with a comprehensible
> complaint.
>
> Does this make sense?  I know its a downer, but what you propose is, IMO,
> not affordable given our resources.
>
>
> And I must say, *this is a VM-DEV discussion, not a general purpose Squeak
> discussion*, yes?
>
> As I had a rig for the Interpreter VM I decided to compile a plugin and
> see
>> if I could drag it around to other VM directories for use. Most times it
>> didn't work.
>>
>> I compiled a TheUniversalAnswer plugin which returns 42. I moved it from
>> a
>> 4.14.1-3430 VM to a 4.14.1-3414 VM. I could get it to work if I did not
>> use
>> the squeak.sh start script. That is, I dragged so.vm-sound-null,
>> so.TheUniversalAnswer and so.vm-display-X11 into the same directory as
>> the
>> VM binary. That worked.
>>
>> The only way to see the external plugins is with #listLoadedModules.
>> But,
>> irritatingly, modules are loaded as needed, so once you have proof of
>> using
>> the primitive from the plugin, yea, it will appear as a result of that
>> Smalltalk listLoadedModules message. So, it's not that useful.
>>
>> I dragged so.TheUniversalAnswer around to other VMs such as 4.0.3-2202
>> and
>> 4.13.10-3268 without success. And the unload selectors #forgetModule:
>> and
>> unloadModule:, which both use primitive 571 don't appear to work on my
>> Ubuntu 15.04.
>>
>> So, I don't know if a community of plugins passed around is in the
>> offing.
>> What I have learned is that many of the answers are in
>> sqUnixExternalPrims.c. The issues are really where does the VM look for
>> primitives and what does it do when it finds one. It appears to me,
>> after
>> reading both the non-Cog and Cog versions of that file, that this an
>> interesting area poorly documented that VM developers alter in haste to
>> get
>> on to something else.
>>
>> It's pretty important stuff, though. Do you start the VM with the binary
>> on the path? Do you use squeak.sh? Where is the VM looking for stuff.
>> Where
>> will FFI look for stuff. And so on.
>>
>> Chris
>>
>>
>>
>>
>
>
> --
> _,,,^..^,,,_
> best, Eliot
>



Reply | Threaded
Open this post in threaded view
|

Re: Criteria For Plugin Compatibility

timrowledge
In reply to this post by Eliot Miranda-2

On 11-09-2015, at 12:00 PM, Eliot Miranda <[hidden email]> wrote:
> a) a plugin compiled for Spur may not work with V3 or vice verse.  The issue is the header size of an object.  Some plugins, but not all, use this define, and the header sizes between Spur and V3 are incompatible.
>
> b) 32-bit plugins won't work with 64-bit VMs, and 64-bit plugins won't work with 32-bit VMs. Period.

At the very least we should make sure the version checking that was designed specifically to help handle this is actually getting used properly.
That ought to prevent crashes and help with providing some decent error messages.

>
> Now there are platform-level packaging technologies, such as fat binaries on Mac OS X, that allow one to construct plugins that contain more than one binary.  But this is a lot of work to build and maintain.

I suspect we could avoid that by using the versioning stuff to indicate which plugin file(s) the user/system fetches?


As I (re)discovered this week, the unix vm  plugin/library loading is amazingly convoluted and looks in more directories than I think my Pi actually has. And it uses the name you give it prepended with ‘lib’ and appended with ‘.so’ and ‘dylib’, so searching for a plugin/lib involves an awful lot of checking and file testing. Looking in the platforms/unix/vm/sqUnixExternalPrims.c you can see what is being done. Note that ther eare two completely different approaches in that code and the Cog VM is using  (so far as I can tell) the NOT USE_SIMPLIFIED_PLUGIN_LOGIC branch.  The (somewhat old) copy of the plain interpreter VM equivalent I have around DOES use the simplified logic. We should probably clean that up...

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Fractured Idiom:- AMICUS PURIAE - Platonic friend