From 070e3989cf5449fd086b0613a6bbf201f7a56541 Mon Sep 17 00:00:00 2001 From: Manu Sridharan Date: Tue, 27 Nov 2012 14:04:00 -0500 Subject: [PATCH] fix missing detection of certain static initializer calls Patch from Christophe Foket on the mailing list. --- .../SSAPropagationCallGraphBuilder.java | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/propagation/SSAPropagationCallGraphBuilder.java b/com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/propagation/SSAPropagationCallGraphBuilder.java index 6f1517dca..288719f5f 100644 --- a/com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/propagation/SSAPropagationCallGraphBuilder.java +++ b/com.ibm.wala.core/src/com/ibm/wala/ipa/callgraph/propagation/SSAPropagationCallGraphBuilder.java @@ -856,10 +856,6 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap System.err.println("visitGet " + field); } - // skip getfields of primitive type (optimisation) - if (field.getFieldType().isPrimitiveType()) { - return; - } PointerKey def = getPointerKeyForLocal(lval); assert def != null; @@ -871,6 +867,23 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap if (f == null) { return; } + + if(isStatic){ + IClass klass = getClassHierarchy().lookupClass(field.getDeclaringClass()); + if (klass == null) { + } else { + // side effect of getstatic: may call class initializer + if (DEBUG) { + System.err.println("getstatic call class init " + klass); + } + processClassInitializer(klass); + } + } + + // skip getfields of primitive type (optimisation) + if (field.getFieldType().isPrimitiveType()) { + return; + } if (hasNoInterestingUses(lval)) { system.recordImplicitPointsToSet(def); @@ -878,15 +891,6 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap if (isStatic) { PointerKey fKey = getPointerKeyForStaticField(f); system.newConstraint(def, assignOperator, fKey); - IClass klass = getClassHierarchy().lookupClass(field.getDeclaringClass()); - if (klass == null) { - } else { - // side effect of getstatic: may call class initializer - if (DEBUG) { - System.err.println("getstatic call class init " + klass); - } - processClassInitializer(klass); - } } else { PointerKey refKey = getPointerKeyForLocal(ref); // if (!supportFullPointerFlowGraph &&