Skip to content

Commit

Permalink
Use information of operand value to determine type for java locals
Browse files Browse the repository at this point in the history
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 soot-oss#635
  • Loading branch information
oxisto committed Dec 31, 2023
1 parent 23e5a3e commit 36de671
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import org.objectweb.asm.tree.AbstractInsnNode;
import sootup.core.jimple.Jimple;
import sootup.core.jimple.basic.Immediate;
Expand All @@ -35,6 +33,10 @@
import sootup.core.jimple.common.stmt.Stmt;
import sootup.core.jimple.visitor.ReplaceUseStmtVisitor;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.stream.Collectors;

/**
* Stack operand.
*
Expand Down Expand Up @@ -67,7 +69,7 @@ class Operand {

Local getOrAssignValueToStackLocal() {
if (stackLocal == null) {
changeStackLocal(methodSource.newStackLocal());
changeStackLocal(methodSource.newStackLocal().withType(value.getType()));
}

return stackLocal;
Expand Down

0 comments on commit 36de671

Please sign in to comment.