TestInterpreterPlugin help
Joshua 'Schwa' Gargus
schwa at cc.gatech.edu
Thu Jan 10 02:52:52 UTC 2002
Hi Stephan,
Thanks for replying from your hotel,
On Wed, Jan 09, 2002 at 11:47:59PM +0100, Stephan Rudlof wrote:
> Somewhat late, since I'm sitting in a hotel (working outside and had big
> problems to connect...), but here are a few hints:
>
> Joshua 'Schwa' Gargus wrote:
> >
> > Hello,
> >
> > I'm having trouble passing around a pointer between interpreted Squeak
> > code and compiled plugin code. I have a primitive method that returns
> > a pointer like this:
> >
> > ^ aPtr asOop: Unsigned
> >
> > This seems to work fine; depending on the value, I get either a
> > SmallInteger or a LargePositiveInteger. The problem arises when I try
> > to pass this into another primitive method that looks like this:
> >
>
> > primNeedPointer: aPtr
> >
> > self
> > primitive: 'primNeedPointer'
> > parameters: #(Unsigned)
> > "more stuff..."
> >
> > The generated C code causing the failure is:
> >
> > interpreterProxy->success(interpreterProxy->isKindOf(interpreterProxy->stackValue(0), "Unsigned"));
> >
> > Looking at the code for isKindOf(), it is clear why it fails: the
> > object (a SmallInteger or LargePositiveInteger) is not an instance
> > of Unsigned or one of its subclasses.
>
> You could use "Integer" here.
>
> But there is another problem: if you have a LargeInteger as 'ptr' its oop
> may have changed between the calls of the two prims.
I suppose that this is because of a possible garbage collection. However, I'm
failing to see why this is a problem, since the value of the LargeInteger would
be the same even if its oop changed. Could you clarify exactly what the problem
is?
Thanks again,
Joshua
>
> Greetings,
>
> Stephan
>
> >
> > I followed the directions on:
> > http://minnow.cc.gatech.edu/squeak/850
> > as closely as possible. What am I doing wrong?
> >
> > Thanks,
> > Joshua
>
> --
> Stephan Rudlof (sr at evolgo.de)
> "Genius doesn't work on an assembly line basis.
> You can't simply say, 'Today I will be brilliant.'"
> -- Kirk, "The Ultimate Computer", stardate 4731.3
>
More information about the Squeak-dev
mailing list
|