cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Gianni <s.gia...@thebug.it>
Subject Re: cocoon-javaflow in cocoon 2.2
Date Fri, 11 Aug 2006 11:16:10 GMT
Torsten Curdt wrote:

>> IIUC the core of the instrumentation is done into the rewrite method,
>> that parses the bytecode operations and decides what to do; adding a
>> block that identifies the invoke operation and adds a method call
>> would work; we tried unluckily to implement it, maybe someone could
>> help us to understand how to do it.
>
>
> I would ...but I didn't understand the above paragraph :)

What Maurizio is saying is that normally in javaflow what happens is
something like this (if we understand correctly) :

int i = 10;
i++;
form.show(pipe);
if (i == 11) {
...

Becomes, more or less :

int i = 10;
i++;
StackRecorder.get().pushInt(i);
StackRecorder.get().pushObject(this);
form.show(pipe);
this = StackRecorder.get().popObject(); // Very intresting :)
i = StackRecorder.get().popInt();
if (i ==  11) {
 ....

The rewrite method of the BCEL enhancer checks all the bytecode, and
when it find an INVOKE (or INVOKEVIRTUAL, still studying bytecode) to an
enhanced class (and there are other conditions) it writes the push and
pop instructions, so that if that class suspends the continuation, the
system will be able to restore the proper flow by popping all it needs
from the stack.

Unfortunately it seems like the following instruction :

AbstractContinuable enhancedFlowClass = new MyFlow();
method.invoke(enhancedFlowClass);

which is semantically equivalent, does not get surrounded by pushes and
pops, while if we simply rewrite it without introspection :

enhancedFlowClass.method();

It gets surrounded by stack instructions and then works perfectly.

So, the rewrite method, should do something like :

Is it an INVOKEVIRTUAL? Is it the method "invoke" of the object
"java.lang.Method"? is the first argument a BCEL enhanced class? then i
write pushes and pops as if it is a normal call.

>
> PS: Guys, really feel free to contact me ...not worth having you guys
> spend time on what I might be able to answer via a quick ping over IM
> or email.

I think this is the best way to get in touch more deeply with a
technology we've been using extensively (in 2.1) in the last year and a
half :) Anyway we're sending you our IM contacts.

>
> Great you are looking into that!

It's a great part of cocoon!

>
> cheers
> -- 
> Torsten

Thanks for the answer,
Simone

-- 
Simone Gianni

Mime
View raw message