Skip to content

Commit

Permalink
JACOBIN-536 Updating location of increments to f.PC
Browse files Browse the repository at this point in the history
  • Loading branch information
platypusguy committed Jun 28, 2024
1 parent 01f521e commit 0fdf05c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/jvm/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,8 @@ frameInterpreter:
var idx int
if opcode == opcodes.LDC { // LDC uses a 1-byte index into the CP, LDC_W uses a 2-byte index
idx = int(f.Meth[f.PC+1])
f.PC += 1
} else {
idx = (int(f.Meth[f.PC+1]) * 256) + int(f.Meth[f.PC+2])
f.PC += 2
}

CPe := classloader.FetchCPentry(f.CP.(*classloader.CPool), idx)
Expand Down Expand Up @@ -278,6 +276,12 @@ frameInterpreter:
push(f, stringAddr)
}

if opcode == opcodes.LDC {
f.PC += 1
} else {
f.PC += 2
}

case opcodes.LDC2_W: // 0x14 (push long or double from CP indexed by next two bytes)
idx := (int(f.Meth[f.PC+1]) * 256) + int(f.Meth[f.PC+2])
f.PC += 2
Expand Down

0 comments on commit 0fdf05c

Please sign in to comment.