VM (callback+variables) changes

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

VM (callback+variables) changes

Andreas.Raab
Hi Folks -

Attached my proposed changes for both, the variable tracking as well as
the callback support. I'll respond in the individual threads about more
specific issues; let's leave this one to discuss the more "mechanical"
issues if there are any. Included files:

- ExtraGCRoots.cs: The change set for tracking variables in plugins
- Callbacks.cs: The change set for VM callback support
- ExampleCallbacks.cs: An example plugin making use of both of the above
features
- sqVirtualMachine[.h|.c]: The (updated) VM proxy

If you install all of the above and build a complete VM you should be
able to execute the ExampleCallbackPlugin's exampleCallback and
successfully compute 3+4 using a callback.

Let me know if you have any problems.

Cheers,
   - Andreas

ExtraGCRoots.cs.gz (5K) Download Attachment
Callbacks.cs.gz (10K) Download Attachment
ExampleCallbacks.cs.gz (2K) Download Attachment
sqVirtualMachine.c (11K) Download Attachment
sqVirtualMachine.h (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: VM (callback+variables) changes

Rob Gayvert
Andreas,

This looks great. I tried this out with a fresh 3.9-7033 image and
latest Win32 VM source, and your example worked as advertised. It also
works fine as a replacement for my wxSqueak setjmp/longjmp calls, and
removes the need for an extra semaphore on the calling process. Thanks!

.. Rob


Andreas Raab wrote:

> Hi Folks -
>
> Attached my proposed changes for both, the variable tracking as well as
> the callback support. I'll respond in the individual threads about more
> specific issues; let's leave this one to discuss the more "mechanical"
> issues if there are any. Included files:
>
> - ExtraGCRoots.cs: The change set for tracking variables in plugins
> - Callbacks.cs: The change set for VM callback support
> - ExampleCallbacks.cs: An example plugin making use of both of the above
> features
> - sqVirtualMachine[.h|.c]: The (updated) VM proxy
>
> If you install all of the above and build a complete VM you should be
> able to execute the ExampleCallbackPlugin's exampleCallback and
> successfully compute 3+4 using a callback.
>
> Let me know if you have any problems.
>
> Cheers,
>   - Andreas
>
>


Reply | Threaded
Open this post in threaded view
|

Re: VM (callback+variables) changes

Andreas.Raab
Hi Rob -

Good to hear it works. There are two things that bothers me slightly and
I'd like to get some feedback from someone who's been in that area
before: First, the callback identifier. While it seems a good safeguard
at first it gets into ones way pretty quickly (like in the example
plugin where the absence of callback-id management makes it impossible
to have more than one callback). So... do you think it's worthwhile to
keep it and force people to go through the hoops of maintaining it?

Second, I'm somewhat unhappy about the management of the suspended
processs. I am wondering if we shouldn't use a semaphore in the
splObjects for this purpose and link/unlink properly. This has the
disadvantage that some image-side changes are required but it might be
worth it for better house-keeping.

Comments welcome!
   - Andreas

Rob Gayvert wrote:

> Andreas,
>
> This looks great. I tried this out with a fresh 3.9-7033 image and
> latest Win32 VM source, and your example worked as advertised. It also
> works fine as a replacement for my wxSqueak setjmp/longjmp calls, and
> removes the need for an extra semaphore on the calling process. Thanks!
>
> .. Rob
>
>
> Andreas Raab wrote:
>> Hi Folks -
>>
>> Attached my proposed changes for both, the variable tracking as well
>> as the callback support. I'll respond in the individual threads about
>> more specific issues; let's leave this one to discuss the more
>> "mechanical" issues if there are any. Included files:
>>
>> - ExtraGCRoots.cs: The change set for tracking variables in plugins
>> - Callbacks.cs: The change set for VM callback support
>> - ExampleCallbacks.cs: An example plugin making use of both of the
>> above features
>> - sqVirtualMachine[.h|.c]: The (updated) VM proxy
>>
>> If you install all of the above and build a complete VM you should be
>> able to execute the ExampleCallbackPlugin's exampleCallback and
>> successfully compute 3+4 using a callback.
>>
>> Let me know if you have any problems.
>>
>> Cheers,
>>   - Andreas
>>
>>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: VM (callback+variables) changes

Rob Gayvert
My callback usage is intense but of limited variety, so the callback ids
are not much of a burden. Without an id, there would be no way to check
whether the callbacks were being exited in the proper order. For some
cases that might not be important, but it might also result in some
nasty bugs. How about making it optional by passing a null value?

On the process management question, I'm afraid I don't understand this
area well enough. Is your concern as aesthetic one, or are there
performance or correctness issues with your current implementation?

.. Rob


Andreas Raab wrote:

> Hi Rob -
>
> Good to hear it works. There are two things that bothers me slightly and
> I'd like to get some feedback from someone who's been in that area
> before: First, the callback identifier. While it seems a good safeguard
> at first it gets into ones way pretty quickly (like in the example
> plugin where the absence of callback-id management makes it impossible
> to have more than one callback). So... do you think it's worthwhile to
> keep it and force people to go through the hoops of maintaining it?
>
> Second, I'm somewhat unhappy about the management of the suspended
> processs. I am wondering if we shouldn't use a semaphore in the
> splObjects for this purpose and link/unlink properly. This has the
> disadvantage that some image-side changes are required but it might be
> worth it for better house-keeping.
>
> Comments welcome!
>   - Andreas
>
> Rob Gayvert wrote:
>
>> Andreas,
>>
>> This looks great. I tried this out with a fresh 3.9-7033 image and
>> latest Win32 VM source, and your example worked as advertised. It also
>> works fine as a replacement for my wxSqueak setjmp/longjmp calls, and
>> removes the need for an extra semaphore on the calling process. Thanks!
>>
>> .. Rob
>>
>>
>> Andreas Raab wrote:
>>
>>> Hi Folks -
>>>
>>> Attached my proposed changes for both, the variable tracking as well
>>> as the callback support. I'll respond in the individual threads about
>>> more specific issues; let's leave this one to discuss the more
>>> "mechanical" issues if there are any. Included files:
>>>
>>> - ExtraGCRoots.cs: The change set for tracking variables in plugins
>>> - Callbacks.cs: The change set for VM callback support
>>> - ExampleCallbacks.cs: An example plugin making use of both of the
>>> above features
>>> - sqVirtualMachine[.h|.c]: The (updated) VM proxy
>>>
>>> If you install all of the above and build a complete VM you should be
>>> able to execute the ExampleCallbackPlugin's exampleCallback and
>>> successfully compute 3+4 using a callback.
>>>
>>> Let me know if you have any problems.
>>>
>>> Cheers,
>>>   - Andreas
>>>
>>>
>>
>>
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: VM (callback+variables) changes

Andreas.Raab
Hi Rob -

Rob Gayvert wrote:
> My callback usage is intense but of limited variety, so the callback ids
> are not much of a burden. Without an id, there would be no way to check
> whether the callbacks were being exited in the proper order. For some
> cases that might not be important, but it might also result in some
> nasty bugs. How about making it optional by passing a null value?

Well, in this case let's just leave it the way it is. There is nothing
worse than somebody else (who is not using the interface) screwing up
your callback return ;-)

> On the process management question, I'm afraid I don't understand this
> area well enough. Is your concern as aesthetic one, or are there
> performance or correctness issues with your current implementation?

Well, I just kinda dislike the idea of an array holding onto a bunch of
processes without a way about reflecting about them. At some point this
is going to get us into trouble when somebody wonders why the heck this
process doesn't get garbage collected. It would be better if there were
an explicit reference to it somewhere. So I guess it ain't critical (and
requires some image-side support too).

Cheers,
   - Andreas