
The patching logic for switch offsets is incorrect.
- JVM offsets for
TABLESWITCH and LOOKUPSWITCH are 4-byte signed integers. Assigning to a single index in cg.code (which is a byte array) only updates the last byte of the offset.
- The mapping logic seems reversed or misaligned:
caseLabelIndex[0] is being patched with the offset of the last label in caseLabels.
caseLabelIndex contains indices relative to the start of the code, but the mapping should correspond to the specific case values or hash codes defined in the switch table.
Originally posted by @gemini-code-assist[bot] in #70 (comment)
The patching logic for switch offsets is incorrect.
TABLESWITCHandLOOKUPSWITCHare 4-byte signed integers. Assigning to a single index incg.code(which is a byte array) only updates the last byte of the offset.caseLabelIndex[0]is being patched with the offset of the last label incaseLabels.caseLabelIndexcontains indices relative to the start of the code, but the mapping should correspond to the specific case values or hash codes defined in the switch table.Originally posted by @gemini-code-assist[bot] in #70 (comment)