[Vm-dev] DNU in BalloonEnginePlugin

Eliot Miranda eliot.miranda at gmail.com
Wed May 16 16:21:48 UTC 2018


Hi Fabio,

On Wed, May 16, 2018 at 3:51 AM, Fabio Niephaus <lists at fniephaus.com> wrote:

>
> Hi all,
>
> In BalloonEnginePlugin>>#primitiveSetBitBltPlugin, #stringOf: is sent to
> the interpreterProxy which does not understand the message.
> Could someone please have a look at this?
>

To be accurate, BalloonEngineSimulation sends stringOf: to
interpreterProxy.   BalloonEngineBase>>#primitiveSetBitBltPlugin (inherited
by BalloonEnginePlugin) inlines the code:

length := interpreterProxy byteSizeOf: pluginName.
length >= 256
ifTrue:[^interpreterProxy primitiveFail].
ptr := interpreterProxy firstIndexableField: pluginName.
needReload := false.
0 to: length-1 do:[:i|
"Compare and store the plugin to be used"
(bbPluginName at: i) = (ptr at: i) ifFalse:[
bbPluginName at: i put: (ptr at: i).
needReload := true]].
(bbPluginName at: length) = 0 ifFalse:[
bbPluginName at: length put: 0.
needReload := true].

So it looks like stringOf: has never been implemented by InterpreterProxy
because in the simulation work that Dan would have done to develop the
plugin interpreterProxy would have been bound to an interpreter.

Something like this should work:

primitiveSetBitBltPlugin
"Primitive. Set the BitBlt plugin to use."
| pluginName |
pluginName := interpreterProxy stackValue: 0.
"Must be string to work"
(interpreterProxy isBytes: pluginName)
ifFalse:[^interpreterProxy primitiveFail].
(interpreterProxy cStringOrNilFor: pluginName) = bbPluginName
ifTrue: [interpreterProxy pop: 1. "Return receiver"]
ifFalse: [^interpreterProxy primitiveFail]

Please test it both in your VM and in the simulator on a simulated image.

But this primitive is funny/strange/dubious.  It doesn't actually allow one
to change the name.  It fails if the name isn't what it was already, and it
gets initialized to "BitBltPlugin" in BalloonEngineBase
class>>#declareCVarsIn: and by BalloonEngineSimulation>>initialize.  So
what it really does is force initialiseModule to be called.  It might be
better if it was replaced by e.g. primitiveReinitialiseModule.

_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180516/0f860c8c/attachment.html>


More information about the Vm-dev mailing list