help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] About sp and thisContext->spOffset


From: Mathieu Suen
Subject: [Help-smalltalk] About sp and thisContext->spOffset
Date: Thu, 26 Aug 2010 15:45:11 +0000 (GMT)

Hi,

AFAIK sp in a context take in account the temporaries.
This mean the if you have 1 temp sp is equal to 1 at the beginning of the 
function (minus the fact the is lazily sync but that is not my point)
From that there is something I don't understand:
In smalltalk I got the following example:

    | method |
    method := (STInST.RBParser parseMethod: 'foo ^12') jitMethodIn: A.
    A methodDictionary at: #foo put: method.
    A new foo printNl


From the VM I got the following code
Note the below printf occure just before the #foo message send and after the 
#new:

void
_gst_send_message_internal (OOP sendSelector, 
                int sendArgs, 
                OOP receiver,
                OOP method_class)
{
..snip..

      switch (header.headerFlag)
    {

..snip..

    case MTH_UNUSED:
      {
..snip..
        newContext = activate_new_context (header.stack_depth, sendArgs);
        ...call to unwind_context ...
        oldContext = (gst_method_context)OOP_TO_OBJ(_gst_this_context_oop);
        printf("SpOffset after: %d\n", oldContext->spOffset);



     }

..snip..
}

I got the following result:

SpOffset before: 3 TO_INT -> 1

I would expected to be FROM_INT(2) aka 5 since you have (A new) push on the 
stack.
What did I miss-understood?

Thanks

Mathieu







reply via email to

[Prev in Thread] Current Thread [Next in Thread]