[squeak-dev] Re: breakpoint at primitiveAdd

Eliot Miranda eliot.miranda at gmail.com
Fri Sep 25 17:52:50 UTC 2009


On Fri, Sep 25, 2009 at 8:15 AM, Ang Beepeng <beepeng86 at yahoo.com> wrote:

>
> I'm running Squeak in debugging mode. I put a breakpoint at "primitiveAdd".
> I
> open a workspace and type "3+4", then I print it.
> Message '+' should have cause execution of "primitiveAdd", which lead to
> Squeak stops at the breakpoint.
> Instead, the result return as 7, as if code execution do not reach
> "primitiveAdd" at all.
> I try again, typing in "3+4". This time, I choose to debug "3+4". I step
> into "+4", the program stops at breakpoint "primitiveAdd".
> Therefore, I'm wondering what are the differences between the two. And why,
> breakpoint at primitiveAdd not triggered?
>

As Bert said, there are special bytecodes for sends of +, -, etc.  See
Smalltalk specialSelectors.  Some of these bytecodes have code to perform
the operations on typical types (SmallInteger, Float, 32-bit
LargePositiveInteger) inlined into the bytecode implementations.  This is a
technique known as static receiver type prediction.

You need to put a breakpoint in bytecodePrimAdd


> Thanks.
>
> Ang Beepeng
> --
> View this message in context:
> http://www.nabble.com/breakpoint-at-primitiveAdd-tp25612297p25613917.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20090925/43f6ca00/attachment.htm


More information about the Squeak-dev mailing list