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.



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 -