[Vm-dev] CompiledMethod display interpretation

gettimothy gettimothy at zoho.com
Sat Dec 14 23:06:19 UTC 2013

Thanks, but its worse than that--call it initial flailing as I learn the system level stuff.

My misconception 2 was not the misconception I thought it was. It is the difference between a BlockContext created in a MethodContext vs that created in a DoIt.

Object subclass: #MethodWithFactorialBlockContext >>factorialExampleFromMethod
    | factorial |
    factorial := [:n | n = 1 ifTrue: [1] ifFalse:[(factorial value: n-1) * n]].
    (1 to: 10) collect: factorial.

If I explore the block to the right of factorial, I get an explorer titled: "[ ]  in MethodWithFacorialBlockCo..etc..." which, I assumed was the BlockContext "associated" with that method. Its not. It is the same thing you get when you put the block in a Workspace and explore that.

However, if you execute that method 

| m  |
m := MethodWithFactorialBlockContext new.
m factorialExampleFromMethod.

it throws an error; then, exploring the BlockContext from the debugger does show the CompiledMethod and lo-and-behold it is  the same CompiledMethod as that in the class methodDict. Just like it says in the BlueBook.

So, the lesson learned is, "when evaluating contexts, be sure of the context you are evaluating otherwise, you may spend a day looking at the wrong stuff and posting dumb posts to squeak-vm-dev".



---- On Sat, 14 Dec 2013 14:38:15 -0800 Bob Arning<arning315 at comcast.net> wrote ---- 

  Just so you are not heading astray, CM210 has *fewer* bytecodes than CM3931 and *many* of CM210's bytecodes are also in CM3931, but the former is not a subset of the latter, either by happenstance or some sort of magic sharing of bytecodes. They are just similar because they are compiled from similar source code.
  On 12/14/13 4:29 PM, gettimothy wrote:
 031519307.-4168358830043045902 at zoho.com" type="cite">2. Misconception 1 happened because I wrongly thought the 'CompiledMethod I had highlighted was the SAME compiled method for the method, just displayed differentyl. .They are not--its obvious now that I know where to look. CompiledMethod(210)  in the BlockContext vs CompiledMethod(3931) in the methodDict of the test class I was using. CompiledMethod(210) contains a subset of the bytecodes in CompiledMethod(3931), but its header and number of literals are different. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20131214/625b4fac/attachment.htm

More information about the Vm-dev mailing list