Re: Byte code or branching method handle?

2012-05-28 Thread Attila Szegedi
My rule of thumb is: if you know that one concrete code shape will
always fit the execution, I'd just emit the bytecode. Invokedynamic is
great for cases where the executed code needs to change from time to
time. You can also combine it - the invocation of actual property
getters getA(), getB() etc. are invokeDynamic linked, and the
branching is in bytecode; i.e. if you know that the sequence at that
point in the code will always be a.b.c.d.

Attila.

On Sun, May 27, 2012 at 11:12 AM, Dain Sundstrom d...@iq80.com wrote:
 Hi all,

 I have a general strategy question about using invoke dynamic.  Say I have a 
 dynamic language that has null safe property chaining where a.b.c.d results 
 in null if a null is encountered anywhere in the chain.  I could implement 
 this two ways, 1) generate byte code that checks for nulls or 2) use a 
 guarded method handle at each step that takes care of the nulls.  Either 
 option is ok with me, but I'd rather not write both versions to and then try 
 to figure out which one will make the JVM angry.

 As a broader question, there are lots of places where I can make this type of 
 decision (e.g., pass by value parameters, copy on assignment value classes), 
 is there a rule of thumb for going with traditional byte code over branching 
 method handles?

 Thanks,

 -dain
 ___
 mlvm-dev mailing list
 mlvm-dev@openjdk.java.net
 http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
___
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev


Re: Byte code or branching method handle?

2012-05-28 Thread Mark Roos
Hi Dain

This sounds similar to a non local return in smalltalk where some method 
in a chain returns to the
starting method.  I did this with a throw and a catch based on the invoker 
of the chain.  Seems to
work for me but I will leave it to the experts to tell you the best way 
for your specific need.

regards
mark___
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev