Skip to content

Fix switching logic for JVM #93

@kjw142857

Description

@kjw142857

high

The patching logic for switch offsets is incorrect.

  1. 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.
  2. The mapping logic seems reversed or misaligned: caseLabelIndex[0] is being patched with the offset of the last label in caseLabels.
  3. 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions