InterpreterProxy->getStackPointer is null

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

InterpreterProxy->getStackPointer is null

Igor Stasenko
 
I just found that a pointer to this function is null.
Means that if you will use
interpreterProxy->getStackPointer()
in plugin, you will crash VM.

Could it be that it declared twice in sqVirtualMachine.c ?

...
sqInt getStackPointer(void);  /* Newsqueak FFI */
void *startOfAlienData(sqInt);
usqInt sizeOfAlienData(sqInt);
sqInt signalNoResume(sqInt);

#if VM_PROXY_MINOR > 8
sqInt getStackPointer(void);  /* Alien FFI */
...

(at least this code looks suspicious)

and why at assignment point it does conversions?
VM->getStackPointer     = (sqInt *(*)(void))getStackPointer;

while rest of functions don't require them?

In header it declared as:
 sqInt *(*getStackPointer)(void);



NBInterpreterProxy majorVersion 1
NBInterpreterProxy minorVersion 12

(means that it should be there :)

--
Best regards,
Igor Stasenko AKA sig.
Reply | Threaded
Open this post in threaded view
|

Re: InterpreterProxy->getStackPointer is null

Eliot Miranda-2
 
Igor,

   this was fixed in r2440 of http://www.squeakvm.org/svn/squeak/branches/Cog/platforms/Cross/vm/sqVirtualMachine.c, along with marshalling in the Alien plugin for stack-grows-down Stack and Cog VMs.

On Wed, Aug 3, 2011 at 9:17 AM, Igor Stasenko <[hidden email]> wrote:

I just found that a pointer to this function is null.
Means that if you will use
interpreterProxy->getStackPointer()
in plugin, you will crash VM.

Could it be that it declared twice in sqVirtualMachine.c ?

...
sqInt getStackPointer(void);  /* Newsqueak FFI */
void *startOfAlienData(sqInt);
usqInt sizeOfAlienData(sqInt);
sqInt signalNoResume(sqInt);

#if VM_PROXY_MINOR > 8
sqInt getStackPointer(void);  /* Alien FFI */
...

(at least this code looks suspicious)

and why at assignment point it does conversions?
VM->getStackPointer     = (sqInt *(*)(void))getStackPointer;

while rest of functions don't require them?

In header it declared as:
 sqInt *(*getStackPointer)(void);



NBInterpreterProxy majorVersion 1
NBInterpreterProxy minorVersion 12

(means that it should be there :)

--
Best regards,
Igor Stasenko AKA sig.



--
best,
Eliot

Reply | Threaded
Open this post in threaded view
|

Re: InterpreterProxy->getStackPointer is null

Igor Stasenko

On 3 August 2011 19:28, Eliot Miranda <[hidden email]> wrote:
>
> Igor,
>    this was fixed in r2440 of http://www.squeakvm.org/svn/squeak/branches/Cog/platforms/Cross/vm/sqVirtualMachine.c, along with marshalling in the Alien plugin for stack-grows-down Stack and Cog VMs.
>

Ok. Good to know.
I am using maybe 4 months old VM for NativeBoost. Will check if it
fixed in fresh.

> On Wed, Aug 3, 2011 at 9:17 AM, Igor Stasenko <[hidden email]> wrote:
>>
>> I just found that a pointer to this function is null.
>> Means that if you will use
>> interpreterProxy->getStackPointer()
>> in plugin, you will crash VM.
>>
>> Could it be that it declared twice in sqVirtualMachine.c ?
>>
>> ...
>> sqInt getStackPointer(void);  /* Newsqueak FFI */
>> void *startOfAlienData(sqInt);
>> usqInt sizeOfAlienData(sqInt);
>> sqInt signalNoResume(sqInt);
>>
>> #if VM_PROXY_MINOR > 8
>> sqInt getStackPointer(void);  /* Alien FFI */
>> ...
>>
>> (at least this code looks suspicious)
>>
>> and why at assignment point it does conversions?
>> VM->getStackPointer     = (sqInt *(*)(void))getStackPointer;
>>
>> while rest of functions don't require them?
>>
>> In header it declared as:
>>  sqInt *(*getStackPointer)(void);
>>
>>
>>
>> NBInterpreterProxy majorVersion 1
>> NBInterpreterProxy minorVersion 12
>>
>> (means that it should be there :)
>>
>> --
>> Best regards,
>> Igor Stasenko AKA sig.
>
>
>
> --
> best,
> Eliot
>
>



--
Best regards,
Igor Stasenko AKA sig.
Reply | Threaded
Open this post in threaded view
|

Re: InterpreterProxy->getStackPointer is null

Igor Stasenko

Yes, indeed it works. NB now can use this functions.
And once it started using it, it open a little can with one worm inside:

Squeak VM's #stackValue: accessing stack arguments using
SP + arg index

while StackInterpreter
SP - arg index

and i got biten by this, until i figured it out :)

i need to write more tests to cover such nuances...

On 3 August 2011 20:02, Igor Stasenko <[hidden email]> wrote:

> On 3 August 2011 19:28, Eliot Miranda <[hidden email]> wrote:
>>
>> Igor,
>>    this was fixed in r2440 of http://www.squeakvm.org/svn/squeak/branches/Cog/platforms/Cross/vm/sqVirtualMachine.c, along with marshalling in the Alien plugin for stack-grows-down Stack and Cog VMs.
>>
>
> Ok. Good to know.
> I am using maybe 4 months old VM for NativeBoost. Will check if it
> fixed in fresh.
>
>> On Wed, Aug 3, 2011 at 9:17 AM, Igor Stasenko <[hidden email]> wrote:
>>>
>>> I just found that a pointer to this function is null.
>>> Means that if you will use
>>> interpreterProxy->getStackPointer()
>>> in plugin, you will crash VM.
>>>
>>> Could it be that it declared twice in sqVirtualMachine.c ?
>>>
>>> ...
>>> sqInt getStackPointer(void);  /* Newsqueak FFI */
>>> void *startOfAlienData(sqInt);
>>> usqInt sizeOfAlienData(sqInt);
>>> sqInt signalNoResume(sqInt);
>>>
>>> #if VM_PROXY_MINOR > 8
>>> sqInt getStackPointer(void);  /* Alien FFI */
>>> ...
>>>
>>> (at least this code looks suspicious)
>>>
>>> and why at assignment point it does conversions?
>>> VM->getStackPointer     = (sqInt *(*)(void))getStackPointer;
>>>
>>> while rest of functions don't require them?
>>>
>>> In header it declared as:
>>>  sqInt *(*getStackPointer)(void);
>>>
>>>
>>>
>>> NBInterpreterProxy majorVersion 1
>>> NBInterpreterProxy minorVersion 12
>>>
>>> (means that it should be there :)
>>>
>>> --
>>> Best regards,
>>> Igor Stasenko AKA sig.
>>
>>
>>
>> --
>> best,
>> Eliot
>>
>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>



--
Best regards,
Igor Stasenko AKA sig.