[Vm-dev] Cog: A question about: setInterruptCheckChain()

Andreas Raab andreas.raab at gmx.de
Wed Sep 29 19:22:29 UTC 2010

On 9/29/2010 11:53 AM, Nicolas Cellier wrote:
> Another aspect of the trade-off is releasing creativity.
> To change the VM you need advanced skills in both:
> - Smalltalk VM internals
> - and external libraries you want to use.
> That resticts dramatically the list of creators.
> Plus, the difficulties for sharing your creation, you shall distribute:
> - either a binary version, but this means users cannot have a mixture
> of different features if those require a core modification,
> - or VMMaker patches but your audience will shrink again.

That's why we have plugins. Keeping the core of the VM as small as 
possible is most definitely a Very Good Thing and not what's being 
discussed here. What's being discussed here is if (from that point on) 
one should provide layers of abstractions via plugins or if one should 
just expose the image directly to all of the idiosyncrasies of the 
platform, handing it pointers and let it make FFI calls.

It really is a matter of where you want to deal with certain aspects of 
the system. I prefer to deal with that level of stuff in a plugin via C 
+ it provides a way to do ensure memory safety
+ it provides a way to provide abstractions
+ the code is faster to write and debug in C
+ access to facilities (threads, interrupts, atomicity) not available 

On the downside, there is:
- it's harder to modify for people who don't know C and are not set up 
to build a plugin
- it's often aimed at the smallest common denominator (though not 

   - Andreas

> On the other hand, a VM providing a larger de facto immutable API:
> - somehow is more secure (a guaranty we can run very old images in
> very new OSes).
> - can maintain the illusion that despite the efforts of OS and
> hardware designers to make it ever more complex, a single person can
> still understand (almost) the whole system.
> - avoid the necessity to embed knowledge of dozens of different
> variants of different OSes in your image.
> Of course, the complexity still exists under the carpet... When I
> contemplate all the unecessary complex knowledge from those beautiful
> configure/cmake scripts and macros, I'm not convinced all this cruft
> will be easier to modify in Smalltalk than it is in C world.
> I perfectly understand too the desire of a VM maintainer to lighten
> the burden ;) though.
> Nicolas
> 2010/9/29 Eliot Miranda<eliot.miranda at gmail.com>:
>> On Wed, Sep 29, 2010 at 10:22 AM, Andreas Raab<andreas.raab at gmx.de>  wrote:
>>> On 9/29/2010 9:36 AM, Eliot Miranda wrote:
>>>>     See the recordMouseEvent() and its friends (sqNextEventPut,
>>>>     eventBuffer[1024] ...) in sqWin32Window, for better understanding my
>>>>     point :)
>>>> Which makes my point well.  These are simply maintaining a queue.  If
>>>> one has callbacks then the bulk of the Windows event handling system can
>>>> be lifted up into the image.  This is what Vassili Bykov did in Newspeak
>>>> above my Alien callbacks.  In Newspeak the Windows MainWndProc is a
>>>> callback:
>>> Thus losing any level of platform abstraction. A bad trade-off, IMO.
>> The platform abstraction merely moves from the VM to classes in the image.  But it does mean that one can properly implement Windows event semantics (things like query quit events) that the queue prevents.  And it means that the VM gets simpler and complexity is handled by better facilities (in Smalltalk with its many advantages for creating and maintaining abstractions with concrete variant implementations).
>> But you and I have had this discussion a number of times and I take your point about the VM maintaining a black-box abstraction boundary whereas the in-image implementation is in theory porous.  As I've said before this doesn't strike me as that important when Smalltalk has had boundary violators such as instVarAt:[put:] for ever and they are rarely abused.  If one were to implement a native GUI event interface in Smalltalk using callbacks one would have to police the abstraction boundary.  But that's easily done, and there are other benefits
>> - the VM, being simpler, gets more longevity since changing the event interface doesn't imply a VM change
>> - the system, having native interfaces, can support each platform's facilities in full instead of providing the lowest common denominator
>> So IMO it is a good trade-off.
>> best
>> Eliot
>>> Cheers,
>>>   - Andreas

More information about the Vm-dev mailing list