cp-tools-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Cp-tools-discuss] gnu.bytecode


From: Elliott Hughes
Subject: Re: [Cp-tools-discuss] gnu.bytecode
Date: Thu, 30 Dec 2004 21:37:42 -0800

On Dec 29, 2004, at 22:36, C. Brian Jones wrote:

On Wed, 2004-12-29 at 22:57, Elliott Hughes wrote:
is this the right/a sensible place to talk about gnu.bytecode?

i know there's *a* copy of gnu.bytecode in the repository, but i know
it's not *the* copy. for some reason, it was easier to find this list
than any equivalent kawa one.

i've been writing a tool similar to javap/jcf-dump, but which outputs
something in a form suitable for re-assembly into a .class file. aside
from the lack of support for 1.5 changes, i've found that the
LocalVariableTable support doesn't work (try
gnu.classpath.tools.JavapMain or gnu.bytecode.dump on a class compiled
with "javac -g" to see). there's a really simple fix for JavapMain and
my disassembler, but i don't know if it'll break kawa or anything else
that uses gnu.bytecode.

is this where i'd find people who're interested?

I'm interested in fixing the local variable table problem.  I think it
used to work but definitely doesn't now. Per might be interested on the
kawa list.

there are two problems. one is that nothing writes to the start_pc and end_pc fields in Variable, so even if you could get hold of a Variable, you wouldn't know what bytecode indexes it covers. the other problem -- and the reason i didn't use the word 'scope' in the previous sentence -- is that the code that reads the LocalVariableTable keeps creating new Scope instances but doesn't link them up.

i think the intent was probably that the start_pc and end_pc fields would be removed from Variable, and the Variable's Scope's start and end Label instances' position fields would be used for that information. but i'm not convinced that works in general. nothing i've seen says that the range of bytecode indexes for which a slot contains a given variable has to correspond to a scope in the usual sense.

my fix doesn't create any new Scope instances, and does assign Variable's start_pc and end_pc fields.

Anyway there is a partial library for disassembly in the
newest japitools which I've receive permission to extend and dump into
cp-tools.  I will have to add additional lower level support to it but
that's okay.  The facets of gnu.bytecode that allow for changing actual
bytecode and writing class files back out are useless to me.

it's useful to have that functionality, though. an assembler would want that. other language implementations want that.

it would be nice to have one library good enough for all these projects to share. (and it would be best if it were part of the JDK, so it was available everywhere, but that's something we can do little about.)

at the same time, a more direct mapping to/from the class file format would be handy for my purposes. and something that's a complete and direct implementation of chapter 4, and which makes reference to it, would be nice.

--
http://www.jessies.org/~enh/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]