From 726b6df4af66badb4d9502d2f16ef5de169d12ac Mon Sep 17 00:00:00 2001 From: Christian Banse Date: Sun, 31 Dec 2023 20:00:16 +0100 Subject: [PATCH] Use information of operand value to determine type for java locals This PR uses the already existing information of the operand's value type to determine the type for java locals. Previously, most of the stack variables were of "unknown" type . Fixes #635 --- .../sootup/java/bytecode/frontend/AsmMethodSource.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sootup.java.bytecode/src/main/java/sootup/java/bytecode/frontend/AsmMethodSource.java b/sootup.java.bytecode/src/main/java/sootup/java/bytecode/frontend/AsmMethodSource.java index 3c84cbaa119..adee45052ad 100644 --- a/sootup.java.bytecode/src/main/java/sootup/java/bytecode/frontend/AsmMethodSource.java +++ b/sootup.java.bytecode/src/main/java/sootup/java/bytecode/frontend/AsmMethodSource.java @@ -291,9 +291,14 @@ void setStmt(@Nonnull AbstractInsnNode insn, @Nonnull Stmt stmt) { @Nonnull Local newStackLocal() { + return newStackLocal(UnknownType.getInstance()); + } + + @Nonnull + Local newStackLocal(Type type) { int idx = nextLocal++; JavaLocal l = - JavaJimple.newLocal("$stack" + idx, UnknownType.getInstance(), Collections.emptyList()); + JavaJimple.newLocal("$stack" + idx, type, Collections.emptyList()); locals.set(idx, l); return l; }