This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: java disassembler/assembler


Daniel Reynaud wrote:
- use of absolute or relative offset instead of labels. Example :
0: ldc "hello"
2: goto 0L      ; the L means "0 as a label", so goto offset 0
5: goto 0       ; traditional goto, so goto 0 means stay here
8: goto -8      ; traditional goto, go 8 bytes backward
Label0:
11: goto Label0 ; traditional jasmin goto, with a label as a target
14: goto 1      ; go 1 byte forward
17: goto 5L     ; go to offset 5

I think this is problematic, because there is a conceptual inconsistency. "goto Label0" goes to the instructions with label "Label10:". However "goto 0" does *not* go to the instruction with label "0:" - it goes to the instruction with label "5:". I prefer:

  goto NNN ; goto offset NNN
  goto +NNN; goto NNN bytes forwards
  goto -NNN; goto NNN bytes backwards
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]