[Vm-dev] Translation weirdness
Eliot Miranda
eliot.miranda at gmail.com
Thu Mar 14 19:56:07 UTC 2013
On Thu, Mar 14, 2013 at 11:27 AM, Bert Freudenberg <bert at freudenbergs.de>wrote:
>
> Slang: foo isIntegerOop
> C: interpreterProxy->isIntegerObject(foo)
>
> Slang: interpreterProxy isIntegerObject: foo
> C: (foo & 1)
>
> SmartSyntaxInterpreterPlugin: y u no smart?
>
IMO the second one is a bug. Notionally plugins can't assume the
representation of SmallInteger so they should always
use interpreterProxy->isIntegerObject(foo). Inside, the interpreter knows
the representation and hence uses (foo & 1).
And note that the slow form just got faster for internal primitives. The
Cog slang now generates
#if !defined(SQUEAK_BUILTIN_PLUGIN)
...
static sqInt (*isIntegerObject)(sqInt objectPointer);
...
#else /* !defined(SQUEAK_BUILTIN_PLUGIN) */
...
extern sqInt isIntegerObject(sqInt objectPointer);
...
So no indirection through interpreterProxy for internal plugins. So one
thing to do is to generate
#if !defined(SQUEAK_BUILTIN_PLUGIN)
...
static sqInt (*isIntegerObject)(sqInt objectPointer);
...
#else /* !defined(SQUEAK_BUILTIN_PLUGIN) */
...
# define isIntegerObject(objectPointer) ((sqInt)(objectPointer) & 1)
...
BTW, no senders of isIntegerOop in my Cog dev image.
--
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20130314/2a0fe2da/attachment-0001.htm
More information about the Vm-dev
mailing list