sqInt setCompilerInitialized(sqInt newFlag)

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

sqInt setCompilerInitialized(sqInt newFlag)

Stéphane Ducasse
Does anybody have an idea what is the purpose of this function in the vm?

Stef

sqInt setCompilerInitialized(sqInt newFlag) {
register struct foo * foo = &fum;
    sqInt oldFlag;

        oldFlag = foo->compilerInitialized;
        foo->compilerInitialized = newFlag;
        return oldFlag;
}

Reply | Threaded
Open this post in threaded view
|

Re: sqInt setCompilerInitialized(sqInt newFlag)

Eliot Miranda-2
Hi Stéf,

    it is an initializer for the old jitter VM.  It is not used and simply set to zero in the Cog VMs.  It is still included in sqVirtualMachine.c because that's the way that interface works (that VirtualMachine is a struct of function pointers).

On Fri, Feb 18, 2011 at 12:21 PM, Stéphane Ducasse <[hidden email]> wrote:
Does anybody have an idea what is the purpose of this function in the vm?

Stef

sqInt setCompilerInitialized(sqInt newFlag) {
register struct foo * foo = &fum;
   sqInt oldFlag;

       oldFlag = foo->compilerInitialized;
       foo->compilerInitialized = newFlag;
       return oldFlag;
}


Reply | Threaded
Open this post in threaded view
|

Re: sqInt setCompilerInitialized(sqInt newFlag)

Stéphane Ducasse
Tx

> Hi Stéf,
>
>     it is an initializer for the old jitter VM.

which one?
The one that marcus worked on with Ian in 2001?

>  It is not used and simply set to zero in the Cog VMs.  It is still included in sqVirtualMachine.c because that's the way that interface works (that VirtualMachine is a struct of function pointers).

I did not get it.

>
> On Fri, Feb 18, 2011 at 12:21 PM, Stéphane Ducasse <[hidden email]> wrote:
> Does anybody have an idea what is the purpose of this function in the vm?
>
> Stef
>
> sqInt setCompilerInitialized(sqInt newFlag) {
> register struct foo * foo = &fum;
>    sqInt oldFlag;
>
>        oldFlag = foo->compilerInitialized;
>        foo->compilerInitialized = newFlag;
>        return oldFlag;
> }
>
>


Reply | Threaded
Open this post in threaded view
|

Re: sqInt setCompilerInitialized(sqInt newFlag)

Igor Stasenko
On 20 February 2011 08:59, Stéphane Ducasse <[hidden email]> wrote:

> Tx
>
>> Hi Stéf,
>>
>>     it is an initializer for the old jitter VM.
>
> which one?
> The one that marcus worked on with Ian in 2001?
>
>>  It is not used and simply set to zero in the Cog VMs.  It is still included in sqVirtualMachine.c because that's the way that interface works (that VirtualMachine is a struct of function pointers).
>
> I did not get it.
>
the virtual machine public interface is a list of function pointers in
specific order.
You can't remove something from list, otherwise it will become
non-compatible with older versions.
Therefore you can only add new function pointers to the end of list.

The problem is that plugin assuming that if VM has greater version
than it was compiled once, its API is backwards compatible.
I think we should move away from this binding, and use name lookup
mechanism, which i implemented in Hydra.
Plugin just asks VM for providing a function with given name. If there
is no such function, plugin will fail to initialize and refuse to
work.
So, this means that pluign don't needs to be bound to VM version anymore.


--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: sqInt setCompilerInitialized(sqInt newFlag)

Schwab,Wilhelm K
Sig,

You mean it doesn't work that way already?? :)  It sounds good.  Does the name lookup proceed by dlsym()/GetProcAddress()/etc.?  The alternative would be to have a map inside the vm that would require maintenance :(  The other question is how often does the lookup occur?  It's probably not a concern, but it deserves at least a quick thought.

Bill


________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Igor Stasenko [[hidden email]]
Sent: Sunday, February 20, 2011 11:42 AM
To: [hidden email]
Subject: Re: [Pharo-project] sqInt setCompilerInitialized(sqInt newFlag)

On 20 February 2011 08:59, Stéphane Ducasse <[hidden email]> wrote:

> Tx
>
>> Hi Stéf,
>>
>>     it is an initializer for the old jitter VM.
>
> which one?
> The one that marcus worked on with Ian in 2001?
>
>>  It is not used and simply set to zero in the Cog VMs.  It is still included in sqVirtualMachine.c because that's the way that interface works (that VirtualMachine is a struct of function pointers).
>
> I did not get it.
>
the virtual machine public interface is a list of function pointers in
specific order.
You can't remove something from list, otherwise it will become
non-compatible with older versions.
Therefore you can only add new function pointers to the end of list.

The problem is that plugin assuming that if VM has greater version
than it was compiled once, its API is backwards compatible.
I think we should move away from this binding, and use name lookup
mechanism, which i implemented in Hydra.
Plugin just asks VM for providing a function with given name. If there
is no such function, plugin will fail to initialize and refuse to
work.
So, this means that pluign don't needs to be bound to VM version anymore.


--
Best regards,
Igor Stasenko AKA sig.