Skip to content

Improve variable store #6

@JonathanxD

Description

@JonathanxD

Currently CodeAPI only increments the variable count instead of reuse variable slots of other frames.

CodeAPI-BytecodeWriter:

public int a(boolean b) {
  if(b) {
    int x = 10; // astore 2
    return x;
  } else {
    int x2 = 11; // astore 3
    return x2;
  }
}

Javac:

public int a(boolean b) {
  if(b) {
    int x = 10; // astore 2
    return x;
  } else {
    int x2 = 11;  // astore 2
    return x2;
  }
}

This issue relates to #4, but issue #4 was dropped, then this issue will cover a particular problem that #4 would solve.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions