Re: Forced remapping of local variables

Eric Bruneton <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
[email protected] wrote:
> Hi all,
> 
> is it possible to "search-and-replace" the usage of a given local variable
> through another (unoccupied) local variable throughout a method, using ASM? For
> example, assume that the local variable with index 1 holds an integer, and I
> want to store that integer in local variable 555 (assuming that 555 is
> unoccupied while also some local vars between 1 and 55 are unoccupied). 

this is possible: the LocalVariablesSorter class does a similar thing.

> Is there an automated, "easy" way to do that using ASM? I tried to manually
> replace localvar indexes inside ASMifier-generated code, but learned that the
> dumped bytecode still groups localvars closer to the "bottom", ignoring my
> instructions...

ASM does not change the local variable indexes by itself. If you use a 
class adapter to change them explicitely (like LocalVariablesSorter), 
they will be written in the class file without any further 
transformation or grouping.

Eric
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.