[Vm-dev] Weird problem when adding a method to StackInterpreter

Mariano Martinez Peck marianopeck at gmail.com
Wed Dec 21 22:04:05 UTC 2011


Hi guys. I am migrating some old stuff I have about tracing object usage to
the latest version of Cog. I have in StackInterpreter a method which looks
like this:

traceObjectUsage: anOop
    ((self isIntegerObject: anOop) not and: [hasToTrace])
        ifTrue: [
            objectMemory setExperimentalBitOf: anOop to: true.
            ]

So I have also added #setExperimentalBitOf:to:  to ObjectMemory, and I have
added the instVar 'hasToTrace' to the StackInterpreter. So now from some
methods of StackInterpreter, I add sends to this method to trace OOPs. This
is working fine, but there is one particular method where I cannot do it.
The method is #lookupInMethodCacheSel:class:  and I am trying to do
something like:

lookupInMethodCacheSel: selector class: class
    "This method  ....."

    | hash probe rcvr |
    <inline: true>
    <asmLabel: false>
    self traceObjectUsage: class.
    rcvr := self internalStackValue: argumentCount.
    self traceObjectUsage: rcvr.
    hash := selector bitXor: class.  "shift drops two low-order zeros from
addresses"
 .......

In this particular method, the problem is with the two lines:
    rcvr := self internalStackValue: argumentCount.
    self traceObjectUsage: rcvr.

If I DO NOT put those two lines, then it compiles perfect. If I put those
lines, I have a compilation error:

Undefined symbols:
  "_lookupInMethodCacheSelclass", referenced from:
      _lookupreceiver in gcc3x-cointerpmt.c.o
      _handleMNUInMachineCodeToclassForMessage in gcc3x-cointerpmt.c.o
      _ceSendsupertonumArgs in gcc3x-cointerpmt.c.o
      _ceSendFromInLineCacheMiss in gcc3x-cointerpmt.c.o
      _ceSendAborttonumArgs in gcc3x-cointerpmt.c.o
      _interpret in gcc3x-cointerpmt.c.o
      _interpret in gcc3x-cointerpmt.c.o
      _sendInvokeCallbackStackRegistersJmpbuf in gcc3x-cointerpmt.c.o
      _sendInvokeCallbackContext in gcc3x-cointerpmt.c.o
  "_findNewMethodInClass", referenced from:
      _primitivePerform in gcc3x-cointerpmt.c.o
      _primitiveObjectperformwithArgumentslookedUpIn in gcc3x-cointerpmt.c.o
      _primitiveInvokeObjectAsMethod in gcc3x-cointerpmt.c.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: ***
[/Users/mariano/Pharo/VM/git/cogVMBlessedSSH/blessed/results/CogMTVM.app/Contents/MacOS/CogMTVM]
Error 1
make[1]: *** [CMakeFiles/CogMTVM.dir/all] Error 2
make: *** [all] Error 2


Moreover, when I ADD those lines, apart from the make error, when
translating from SLANG to C, if I open a Transcript I see these
"suspicious" lines:

Removed findNewMethodInClass: because it refers to the local variable
localSP of interpret.
But it is either used outside of interpret or exported!!
Removed lookupInMethodCacheSel:class: because it refers to the local
variable localSP of interpret.
But it is either used outside of interpret or exported!!

BUT, none of those methods access localSP.

Any idea of what can be wrong?

Thanks in advance,


-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20111221/66eac95e/attachment.htm


More information about the Vm-dev mailing list