This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git
The following commit(s) were added to refs/heads/master by this push:
new 64962b09 Refactor common code
64962b09 is described below
commit 64962b09e87f32ef8a43b5cfc5138ace414ca806
Author: Gary David Gregory (Code signing key) <[email protected]>
AuthorDate: Sat Oct 29 11:02:58 2022 -0400
Refactor common code
---
.../verifier/structurals/ExecutionVisitor.java | 31 +++++++++-------------
1 file changed, 12 insertions(+), 19 deletions(-)
diff --git
a/src/main/java/org/apache/bcel/verifier/structurals/ExecutionVisitor.java
b/src/main/java/org/apache/bcel/verifier/structurals/ExecutionVisitor.java
index 72d97c53..4400d0c6 100644
--- a/src/main/java/org/apache/bcel/verifier/structurals/ExecutionVisitor.java
+++ b/src/main/java/org/apache/bcel/verifier/structurals/ExecutionVisitor.java
@@ -810,13 +810,7 @@ public class ExecutionVisitor extends EmptyVisitor {
stack().push(Type.INT);
}
- /**
- * Symbolically executes the corresponding Java Virtual Machine
instruction.
- *
- * @since 6.0
- */
- @Override
- public void visitINVOKEDYNAMIC(final INVOKEDYNAMIC o) {
+ private void visitInvokedInternals(final InvokeInstruction o) {
stack().pop(o.getArgumentTypes(cpg).length);
// We are sure the invoked method will xRETURN eventually
// We simulate xRETURNs functionality here because we
@@ -831,6 +825,16 @@ public class ExecutionVisitor extends EmptyVisitor {
}
}
+ /**
+ * Symbolically executes the corresponding Java Virtual Machine
instruction.
+ *
+ * @since 6.0
+ */
+ @Override
+ public void visitINVOKEDYNAMIC(final INVOKEDYNAMIC o) {
+ visitInvokedInternals(o);
+ }
+
/** Symbolically executes the corresponding Java Virtual Machine
instruction. */
@Override
public void visitINVOKEINTERFACE(final INVOKEINTERFACE o) {
@@ -878,18 +882,7 @@ public class ExecutionVisitor extends EmptyVisitor {
/** Symbolically executes the corresponding Java Virtual Machine
instruction. */
@Override
public void visitINVOKESTATIC(final INVOKESTATIC o) {
- stack().pop(o.getArgumentTypes(cpg).length);
- // We are sure the invoked method will xRETURN eventually
- // We simulate xRETURNs functionality here because we
- // don't really "jump into" and simulate the invoked
- // method.
- if (o.getReturnType(cpg) != Type.VOID) {
- Type t = o.getReturnType(cpg);
- if (t.equals(Type.BOOLEAN) || t.equals(Type.CHAR) ||
t.equals(Type.BYTE) || t.equals(Type.SHORT)) {
- t = Type.INT;
- }
- stack().push(t);
- }
+ visitInvokedInternals(o);
}
/** Symbolically executes the corresponding Java Virtual Machine
instruction. */