Re: Using ASM for invokedynamic bytecode generation

2011-09-09 Thread Dr Andrew John Hughes
On 08:38 Thu 08 Sep , Pekka Enberg wrote:
 Hi all,
 
 I started hacking on invokedynamic again:
 
 https://github.com/penberg/classpath/commit/21c457f4928678bb5709dfc5a992b80f0d02c4b8
 
 https://github.com/penberg/jato/commits/indy
 
 I'm planning to use ASM for generating bytecode for method handle
 chains. Does that sound like a reasonable thing to do? We already
 carry the ASM code under tools/external/asm/. Can I just move that
 under external/ and rename the package so that it doesn't clash with
 the upstream project?
 
 Pekka
 

I'd rather we just depended on it.   The current version is outdated as
it is.

As to the code, a number of comments:

* Can we keep fields near the top of the class?  I don't know about others,
but personally I find it hard to track things if fields are hiding at the 
bottom of a class.
* The unimplemented ones should declare and throw 
gnu.classpath.NotImplementedException
so JAPI picks it up, not UnsupportedOperationException which has different 
semantics.
* Why are you redefining toString() as a stub?  The default from Object would 
do.
* Indenting is out in VMMethodHandles.java and you need some line breaks on 
those
long definitions.
-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and IcedTea
http://www.gnu.org/software/classpath
http://icedtea.classpath.org
PGP Key: F5862A37 (https://keys.indymedia.org/)
Fingerprint = EA30 D855 D50F 90CD F54D  0698 0713 C3ED F586 2A37



Re: Using ASM for invokedynamic bytecode generation

2011-09-09 Thread Pekka Enberg
Hi Mark,

On Thu, Sep 8, 2011 at 10:33 PM, Mark Wielaard m...@klomp.org wrote:
 I don't know much about what is needed for invoke dynamic byte code
 generation. Note that java/lang/reflect/Proxy.java for example also can
 generate byte code, but just does it by hand. Is such an approach
 possible?

It's possible, sure. I was thinking of using ASM because I suspect the
generated bytecode won't be trivial. I'll see how quickly I hit limitations
with generating bytecode by hand. Is a light-weight GNU Classpath
specific bytecode helper API totally out of the question?

Pekka