SmartSyntaxPlugins simulation whitewash

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

SmartSyntaxPlugins simulation whitewash

Eliot Miranda-2
 
Hi All,

    I just read Anthony Hallinan's most informative comment to SmartSyntaxPlugin class>>simulatorClass which says that
        "By default SmartSyntaxInterpreterPlugin answers nil because methods in these plugins
         are intended to be embedded in code that pushes and pops from the stack and therefore
         cannot be run independently.  This wrapper code is generated when translated to C.  But,
         unfortunately, this code is missing during simulation.  There was an attempt to simulate this,
         but only the prologue code (getting arg from the stack) is simulated (see simulatePrologInContext:).
        The epologue code (popping args and pushing result) is not.  So I am making this nil until this can be fixed.
Also, beware that primitive methods that take no args exactly match their primitive name (faking out
        InterpreterSimulator>>callExternalPrimitive:).  They should only be called from within wrapper code that
        simulates the prologue and epilogue.  Primitive method that take args don't have this accidental matching
        problem since their names contain colons while their primitive names do not. - ajh 8/21/2002"

Strikes me that what needs to be done is to throw away the tricky implementation of Object>>#primitive:parameters:receiver:, replacing it by a simple direct implementation, and putting a wrapper around each SmartSyntaxPlugin primitive as its installed whose job it is to check for success and if so, cut back the stack and convert the result.  Anyone interested who's not also hugely busy?

If so, focus on making LargeIntegersPlugin work using 22 factorial printString as a test case.

best
Eliot
Reply | Threaded
Open this post in threaded view
|

Re: SmartSyntaxPlugins simulation whitewash

Bert Freudenberg
 

On 30.09.2010, at 19:30, Eliot Miranda wrote:

Hi All,

    I just read Anthony Hallinan's most informative comment to SmartSyntaxPlugin class>>simulatorClass which says that
        "By default SmartSyntaxInterpreterPlugin answers nil because methods in these plugins
         are intended to be embedded in code that pushes and pops from the stack and therefore
         cannot be run independently.  This wrapper code is generated when translated to C.  But,
         unfortunately, this code is missing during simulation.  There was an attempt to simulate this,
         but only the prologue code (getting arg from the stack) is simulated (see simulatePrologInContext:).
        The epologue code (popping args and pushing result) is not.  So I am making this nil until this can be fixed.
Also, beware that primitive methods that take no args exactly match their primitive name (faking out
        InterpreterSimulator>>callExternalPrimitive:).  They should only be called from within wrapper code that
        simulates the prologue and epilogue.  Primitive method that take args don't have this accidental matching
        problem since their names contain colons while their primitive names do not. - ajh 8/21/2002"

Strikes me that what needs to be done is to throw away the tricky implementation of Object>>#primitive:parameters:receiver:, replacing it by a simple direct implementation, and putting a wrapper around each SmartSyntaxPlugin primitive as its installed whose job it is to check for success and if so, cut back the stack and convert the result.  Anyone interested who's not also hugely busy?

If so, focus on making LargeIntegersPlugin work using 22 factorial printString as a test case.

best
Eliot

+1

I've gone back to not using SmartSyntaxInterpreterPlugin for pure Slang plugins so I can debug them in Squeak. For library wrappers I still use it since those can't be meaningfully debugged anyway.

- Bert -


Reply | Threaded
Open this post in threaded view
|

re: SmartSyntaxPlugins simulation whitewash

ccrraaiigg
In reply to this post by Eliot Miranda-2
 

Hi Eliot--

> I just read Anthony Hallinan's...

     Nit: it's Anthony Hannan.


-C

--
Craig Latta
www.netjam.org/resume
+ 31 020 894 6247
+  1 415 287 3547