Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/bytecodeparser/CodeParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ public void parse(OpHandler opHandler) throws BadBytecode {
if(stop)
break;
int index = context.iterator.next();
Op op = Opcodes.OPCODES.get(context.iterator.byteAt(index)).init(context, index);
Op opcode = Opcodes.OPCODES.get(context.iterator.byteAt(index));
if(opcode == null) continue;
Op op = opcode.init(context, index);
opHandler.handle(op, index);
}
}
Expand Down Expand Up @@ -86,4 +88,4 @@ public void begin() {
public void stop() {
stop = true;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void simulate(Stack stack) {
se = stack.pop2();
else se = stack.pop();
}
if(op.as(MethodInvocationOpcode.class).isInstanceMethod())
if (op.as(MethodInvocationOpcode.class).isInstanceMethod() && !stack.isEmpty())
stack.pop();
if(returnTypeLength != null) {
if(returnTypeLength == DOUBLE)
Expand Down Expand Up @@ -326,4 +326,4 @@ public MethodParam[] merge() {
return result;
}
}
}
}
6 changes: 4 additions & 2 deletions src/bytecodeparser/analysis/stack/StackAnalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ void analyze(int from, Stack stack) throws BadBytecode {
Stack currentStack = stack.copy();
while(iterator.hasNext()) {
int index = iterator.next();
Op op = Opcodes.OPCODES.get(iterator.byteAt(index)).init(context, index);
Op opcode = Opcodes.OPCODES.get(iterator.byteAt(index));
if(opcode == null) continue;
Op op = opcode.init(context, index);
trace.append("\n").append(index).append(":").append(op.getName()).append(" --> ");
Frame frame = frames[index];
frame.isAccessible = true;
Expand Down Expand Up @@ -332,4 +334,4 @@ protected void updateCursors(int pos, int length) {
}
}
}
}
}