MethodWrappers

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

MethodWrappers

vam
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: MethodWrappers

Udo Schneider
fattigra remove_this mail.ru wrote:
> Hi!
>
> Are anybody does working with method wrappers?
>
> Old methodWrappers package for D5 (from unavailable now
> http://st-www.cs.uiuc.edu/~brant/Applications/MethodWrappers.html) not
> work with D6.
>
Did you try the MethodWrappers package available here:
http://www.smalltalking.net/goodies/Dolphin/

CU,

Udo


Reply | Threaded
Open this post in threaded view
|

Re: MethodWrappers

John Brant
In reply to this post by vam
fattigra remove_this mail.ru wrote:

> Are anybody does working with method wrappers?
>
> Old methodWrappers package for D5 (from unavailable now
> http://st-www.cs.uiuc.edu/~brant/Applications/MethodWrappers.html) not
> work with D6.

Since I no longer have an account on that machine, the ~brant doesn't
work, but replacing "~" with "users/" will get the file:
  http://st-www.cs.uiuc.edu/users/brant/Applications/MethodWrappers.html

The files have also been moved to another machine where I do have an
account:
  http://www.refactory.com/Software/MethodWrappers/

However, both of these only have downloads for VisualWorks and have
never had downloads for any version of Dolphin.


John Brant


vam
Reply | Threaded
Open this post in threaded view
|

Re: MethodWrappers

vam
In reply to this post by Udo Schneider
CONTENTS DELETED
The author has deleted this message.
vam
Reply | Threaded
Open this post in threaded view
|

Re: MethodWrappers

vam
In reply to this post by John Brant
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: MethodWrappers

John Brant
fattigra remove_this mail.ru wrote:

> Yes, on VW ot work fine :)
> Method wrapper was ported to Dolphin 5 by Andres Otaduy
> (http://www.smalltalking.net/goodies/Dolphin/ ).
>
> But... I not make ReplaceMethodWrapper and CallMethodWrapper. :-(
> Adding instance variable to subclass of MethodWrapper crash method
> wrapper behavior.

If those wrappers are based on my method wrappers, then they can
probably be modified to work with instance variables. The base problem
is that the VM is assuming that the method's literals start at some
offset from the object. When you add instance variables to a subclass
you are invalidating this assumption. Here are two different solutions
that work for VA and VSE, and could likely be adapted to work with Dolphin.

*) You get the compiler to insert an unused literal for each instance
variable at the beginning of the method's literals. You then create your
method wrapper object based on the compiler's CompiledMethod object, but
don't copy the unused literals at the beginning of the method. Your code
will see something like:
    MyMethodWrapper
        header=...
        methodClass=...
        selector=...
        sourceDescriptor=...
        byteCodes=...
        myInstVar=???
        1=...
        2=...

However, the VM will see it as:
    CompiledMethod
        header=...
        methodClass=...
        selector=...
        sourceDescriptor=...
        byteCodes=...
        1=???
        2=...
        3=...

*) The other approach is to create a MethodWrapper object separate from
the CompiledMethod object. Since your method wrappers are separate from
the compiled methods, the VM will not have problems with you adding
variables to the method wrappers -- they will just be some other object.
Now instead of inserting the method wrapper in the method dictionary,
you'll insert another CompiledMethod that just calls your method wrapper.


John Brant


vam
Reply | Threaded
Open this post in threaded view
|

Re: MethodWrappers

vam
CONTENTS DELETED
The author has deleted this message.