lattice.addSharedLoc(higherName);
}
Set<Descriptor> descSet = inputGraph.getDescSetOfNode(higherNode);
+ // System.out.println("higherName=" + higherName + " higherNode=" + higherNode + " descSet="
+ // + descSet);
for (Iterator iterator2 = descSet.iterator(); iterator2.hasNext();) {
Descriptor d = (Descriptor) iterator2.next();
locSummary.addMapHNodeNameToLocationName(d.getSymbol(), higherName);
Set<Integer> lower = (Set<Integer>) iterator2.next();
String lowerName = generateElementName(basisSet, inputGraph, mapFToLocName, lower);
- locSummary.addMapHNodeNameToLocationName(lowerName, lowerName);
-
- HNode lowerNode = inputGraph.getHNode(higherName);
+ HNode lowerNode = inputGraph.getHNode(lowerName);
if (lowerNode != null && lowerNode.isSharedNode()) {
lattice.addSharedLoc(lowerName);
}
+ Set<Descriptor> lowerDescSet = inputGraph.getDescSetOfNode(lowerNode);
+ // System.out.println("lowerName=" + lowerName + " lowerNode=" + lowerNode + " descSet="
+ // + lowerDescSet);
+ for (Iterator iterator3 = lowerDescSet.iterator(); iterator3.hasNext();) {
+ Descriptor d = (Descriptor) iterator3.next();
+ locSummary.addMapHNodeNameToLocationName(d.getSymbol(), lowerName);
+ }
+ // locSummary.addMapHNodeNameToLocationName(lowerName, lowerName);
+
+ // System.out.println("higherName=" + higherName + " lowerName=" + lowerName);
if (higher.size() == 0) {
// empty case
lattice.put(lowerName);
for (Iterator iterator = nodeSet.iterator(); iterator.hasNext();) {
HNode node = (HNode) iterator.next();
- System.out.println("node=" + node);
+ // System.out.println("node=" + node);
if (node.isSkeleton() && (!visited.contains(node))) {
visited.add(node);
} else {
// we have a node that is neither combination or skeleton node
- System.out.println("%%%skeleton node=" + node + " outNode=" + outNode);
+ // System.out.println("%%%skeleton node=" + node + " outNode=" + outNode);
HNode startNode = scGraph.getCurrentHNode(node);
// if (node.getDescriptor() != null) {
Set<HNode> endNodeSetFromSimpleGraph =
simpleGraph.getDirectlyReachableSkeletonCombinationNodeFrom(outNode, null);
- System.out.println("endNodeSetFromSimpleGraph=" + endNodeSetFromSimpleGraph
- + " from=" + outNode);
+ // System.out.println("endNodeSetFromSimpleGraph=" + endNodeSetFromSimpleGraph
+ // + " from=" + outNode);
Set<HNode> endCombNodeSet = new HashSet<HNode>();
for (Iterator iterator3 = endNodeSetFromSimpleGraph.iterator(); iterator3.hasNext();) {
HNode endNode = (HNode) iterator3.next();
endCombNodeSet.add(getCombinationNodeInSCGraph(desc, endNode));
}
- System.out.println("endCombNodeSet=" + endCombNodeSet);
+ // System.out.println("endCombNodeSet=" + endCombNodeSet);
visited.add(outNode);
if (endCombNodeSet.size() > 0) {
// follows the straight line up to another skeleton/combination node
import IR.Descriptor;
import IR.FieldDescriptor;
+import IR.VarDescriptor;
public class HierarchyGraph {
Map<Set<HNode>, HNode> mapCombineNodeSetToCombinationNode;
Map<Set<HNode>, Set<HNode>> mapCombineNodeSetToOutgoingNodeSet;
- Map<HNode, String> mapHNodeToLocationName;
-
Set<HNode> nodeSet;
public static int seed = 0;
mapHNodeToUniqueIndex = new HashMap<HNode, Integer>();
mapHNodeToBasis = new HashMap<HNode, Set<Integer>>();
- mapHNodeToLocationName = new HashMap<HNode, String>();
mapMergeNodetoMergingSet = new HashMap<HNode, Set<HNode>>();
mapHNodeToCurrentHNode = new HashMap<HNode, HNode>();
this.desc = desc;
}
- public void addMapHNodeToLocationName(HNode node, String locName) {
- mapHNodeToLocationName.put(node, locName);
- }
-
- public String getLocationName(HNode node) {
- return mapHNodeToLocationName.get(node);
- }
-
public String getName() {
return name;
}
continue;
}
+ if (!isEligibleForMerging(node1, node2)) {
+ continue;
+ }
+
if (!node1.equals(node2)) {
Set<HNode> incomingNodeSet2 = getIncomingNodeSet(node2);
return false;
}
+ private boolean isEligibleForMerging(HNode node1, HNode node2) {
+
+ System.out.println("********isEligibleForMerging=" + node1 + " " + node2);
+
+ if (node1.isSharedNode() || node2.isSharedNode()) {
+
+ // if either of nodes is a shared node,
+ // all descriptors of node1 & node2 should have a primitive type
+
+ Set<Descriptor> descSet = new HashSet<Descriptor>();
+ descSet.addAll(getDescSetOfNode(node1));
+ descSet.addAll(getDescSetOfNode(node2));
+
+ for (Iterator iterator = descSet.iterator(); iterator.hasNext();) {
+ Descriptor desc = (Descriptor) iterator.next();
+ if (!isPrimitive(desc)) {
+ return false;
+ }
+ }
+ System.out.println("******** true");
+ return true;
+ }
+ return false;
+ }
+
+ private boolean isPrimitive(Descriptor desc) {
+
+ if (desc instanceof FieldDescriptor) {
+ return ((FieldDescriptor) desc).getType().isPrimitive();
+ } else if (desc instanceof VarDescriptor) {
+ return ((VarDescriptor) desc).getType().isPrimitive();
+ } else if (desc instanceof InterDescriptor) {
+ return true;
+ }
+
+ return false;
+ }
+
private void addEdgeWithNoCycleCheck(HNode srcHNode, HNode dstHNode) {
getIncomingNodeSet(dstHNode).add(srcHNode);
getOutgoingNodeSet(srcHNode).add(dstHNode);
HNode mergedNode = (HNode) iterator.next();
addMapHNodeToCurrentHNode(mergedNode, newMergeNode);
}
-
+ System.out.println("\n###mergedSkeletonNode=" + mergedSkeletonNode);
System.out.println("###MERGING NODE=" + set + " new node=" + newMergeNode);
+
+ for (Iterator iterator = set.iterator(); iterator.hasNext();) {
+ HNode hNode = (HNode) iterator.next();
+ System.out.println("old=" + hNode + "----->newNode=" + getCurrentHNode(hNode));
+ }
+
return newMergeNode;
}
private void addMapHNodeToCurrentHNode(HNode curNode, HNode newNode) {
if (curNode.isMergeNode()) {
Set<HNode> mergingSet = getMergingSet(curNode);
+ mergingSet.add(curNode);
+ System.out.println("addMapHNodeToCurrentHNode curNode=" + curNode + " meringSet="
+ + mergingSet);
for (Iterator iterator = mergingSet.iterator(); iterator.hasNext();) {
HNode mergingNode = (HNode) iterator.next();
mapHNodeToCurrentHNode.put(mergingNode, newNode);
for (Iterator iterator = mergedNode.iterator(); iterator.hasNext();) {
HNode node = (HNode) iterator.next();
if (node.isMergeNode()) {
+ mergingSet.add(node);
mergingSet.addAll(getMergingSet(node));
} else {
mergingSet.add(node);
HNode outNode = getCombinationNode(combineNode);
addEdgeWithNoCycleCheck(combinationNode, outNode);
} else if (curNode.isSkeleton()) {
- // HNode dstNode = getHNode(curNode.getDescriptor());
+ // HNode dstNode2 = getHNode(curNode.getDescriptor());
HNode dstNode = getCurrentHNode(curNode);
+ // System.out.println("-----curNode=" + curNode + "------->" + dstNode + " dstNode2="
+ // + dstNode2);
addEdgeWithNoCycleCheck(combinationNode, dstNode);
}
}
public void assignUniqueIndexToNode() {
int idx = 1;
+ System.out.println("nodeSet=" + nodeSet);
for (Iterator iterator = nodeSet.iterator(); iterator.hasNext();) {
HNode node = (HNode) iterator.next();
mapHNodeToUniqueIndex.put(node, idx);
Set<HNode> reachableNodeSet = getReachableNodeSetFrom(node);
System.out.println("node=" + node + " reachableNodeSet=" + reachableNodeSet);
-
+ System.out.println("mapHNodeToUniqueIndex.get(node)=" + mapHNodeToUniqueIndex.get(node));
// if a node is reachable from the current node
// need to remove the index of the reachable node from the basis
for (Iterator iterator2 = reachableNodeSet.iterator(); iterator2.hasNext();) {
HNode reachableNode = (HNode) iterator2.next();
System.out.println("reachableNode=" + reachableNode);
+ System.out.println("getHNodeIndex(reachableNode))="
+ + mapHNodeToUniqueIndex.get(reachableNode));
int idx = getHNodeIndex(reachableNode);
basis.remove(idx);
}
public static final Descriptor TOPDESC = new NameDescriptor(TOPLOC);
+ public static final Descriptor RETURNLOC = new NameDescriptor(RLOC);
+
public static String newline = System.getProperty("line.separator");
LocationInfo curMethodInfo;
assignCompositeLocation();
+ // System.exit(0);
+
constructHierarchyGraph();
debug_writeHierarchyDotFiles();
System.exit(0);
- // 2) construct lattices
- // inferLattices();
- // simplifyLattices();
- // 3) check properties
- // checkLattices();
-
- debug_writeLatticeDotFile();
-
- // 4) generate annotated source codes
- generateAnnoatedCode();
-
}
public Map<NTuple<Descriptor>, NTuple<Descriptor>> getMapCallerArgToCalleeParam(
while (!methodDescList.isEmpty()) {
MethodDescriptor md = methodDescList.removeLast();
+
+ System.out.println("\n#updateCompositeLocationAssignments=" + md);
+
FlowGraph flowGraph = getFlowGraph(md);
MethodSummary methodSummary = getMethodSummary(md);
Set<FlowNode> nodeSet = flowGraph.getNodeSet();
for (Iterator iterator = nodeSet.iterator(); iterator.hasNext();) {
FlowNode node = (FlowNode) iterator.next();
+ System.out.println("-node=" + node + " node.getDescTuple=" + node.getDescTuple());
if (node.getCompositeLocation() != null) {
CompositeLocation compLoc = node.getCompositeLocation();
CompositeLocation updatedCompLoc = updateCompositeLocation(compLoc);
node.setCompositeLocation(updatedCompLoc);
+ System.out.println("---updatedCompLoc1=" + updatedCompLoc);
} else {
NTuple<Descriptor> descTuple = node.getDescTuple();
CompositeLocation compLoc = convertToCompositeLocation(md, descTuple);
compLoc = updateCompositeLocation(compLoc);
node.setCompositeLocation(compLoc);
+ System.out.println("---updatedCompLoc2=" + compLoc);
}
if (node.isDeclaratonNode()) {
}
}
+ // update PCLOC and RETURNLOC if they have a composite location assignment
+ if (methodSummary.getRETURNLoc() != null) {
+ methodSummary.setRETURNLoc(updateCompositeLocation(methodSummary.getRETURNLoc()));
+ }
+ if (methodSummary.getPCLoc() != null) {
+ methodSummary.setPCLoc(updateCompositeLocation(methodSummary.getPCLoc()));
+ }
+
}
}
Location loc = compLoc.get(i);
String nodeIdentifier = loc.getLocIdentifier();
Descriptor enclosingDesc = loc.getDescriptor();
- System.out.println("enclosingDesc=" + enclosingDesc);
String locName;
if (!enclosingDesc.equals(GLOBALDESC)) {
LocationSummary locSummary = getLocationSummary(enclosingDesc);
MethodInvokeNode min = (MethodInvokeNode) iterator.next();
// need to translate a composite location that is started with the base
// tuple of 'min'.
- if (mapMethodInvokeNodeToBaseTuple.get(min) != null) {
- // if mapMethodInvokeNodeToBaseTuple doesn't have a mapping
- // it means that the corresponding callee method does not cause any
- // flows
- translateMapLocationToInferCompositeLocationToCalleeGraph(callerGlobalFlowGraph, min);
- }
+ translateMapLocationToInferCompositeLocationToCalleeGraph(callerGlobalFlowGraph, min);
calleeSet.add(min.getMethod());
}
FlowGraph calleeFlowGraph = getFlowGraph(mdCallee);
GlobalFlowGraph calleeGlobalGraph = getSubGlobalFlowGraph(mdCallee);
- NTuple<Location> baseLocTuple =
- translateToLocTuple(mdCaller, mapMethodInvokeNodeToBaseTuple.get(min));
+ NTuple<Location> baseLocTuple = null;
+ if (mapMethodInvokeNodeToBaseTuple.containsKey(min)) {
+ baseLocTuple = translateToLocTuple(mdCaller, mapMethodInvokeNodeToBaseTuple.get(min));
+ }
// System.out.println("\n-translate caller infer composite loc to callee=" + mdCallee
// + " baseLocTuple=" + baseLocTuple);
CompositeLocation callerCompLoc = callerMapLocToCompLoc.get(key);
if (!key.getDescriptor().equals(mdCaller)) {
- // System.out.println("--- caller key=" + key + " callerCompLoc=" + callerCompLoc);
-
- // && callerCompLoc.getTuple().startsWith(baseLocTuple)) {
- // need to translate to the callee side
- // TODO
CompositeLocation newCalleeCompLoc;
- if (callerCompLoc.getTuple().startsWith(baseLocTuple)) {
- System.out.println("---need to translate callerCompLoc=" + callerCompLoc
- + " with baseTuple=" + baseLocTuple);
+ if (baseLocTuple != null && callerCompLoc.getTuple().startsWith(baseLocTuple)) {
+ // System.out.println("---need to translate callerCompLoc=" + callerCompLoc
+ // + " with baseTuple=" + baseLocTuple);
newCalleeCompLoc =
translateCompositeLocationToCallee(callerCompLoc, baseLocTuple, mdCallee);
calleeGlobalGraph.addMapLocationToInferCompositeLocation(key, newCalleeCompLoc);
- System.out.println("---callee loc=" + key + " newCalleeCompLoc=" + newCalleeCompLoc);
+ // System.out.println("---callee loc=" + key + " newCalleeCompLoc=" + newCalleeCompLoc);
} else {
- // newCalleeCompLoc = callerCompLoc.clone();
+ // check if it is the global access
+ Location compLocFirstElement = callerCompLoc.getTuple().get(0);
+ if (compLocFirstElement.getDescriptor().equals(mdCallee)
+ && compLocFirstElement.getLocDescriptor().equals(GLOBALDESC)) {
+
+ newCalleeCompLoc = new CompositeLocation();
+ Location newMethodLoc = new Location(mdCallee, GLOBALDESC);
+
+ newCalleeCompLoc.addLocation(newMethodLoc);
+ for (int i = 1; i < callerCompLoc.getSize(); i++) {
+ newCalleeCompLoc.addLocation(callerCompLoc.get(i));
+ }
+ calleeGlobalGraph.addMapLocationToInferCompositeLocation(key, newCalleeCompLoc);
+
+ }
+
}
}
callerCompLoc.addLocation(argLocTuple.get(i));
}
- if (callerCompLoc.getTuple().startsWith(baseLocTuple)) {
+ if (baseLocTuple != null && callerCompLoc.getTuple().startsWith(baseLocTuple)) {
FlowNode calleeParamFlowNode = calleeFlowGraph.getParamFlowNode(idx);
NTuple<Descriptor> calleeParamDescTuple = calleeParamFlowNode.getDescTuple();
next: for (Iterator iterator = nodeSet.iterator(); iterator.hasNext();) {
GlobalFlowNode node = (GlobalFlowNode) iterator.next();
+ System.out.println("-GlobalFlowNode=" + node);
Location prefixLoc = node.getLocTuple().get(0);
if (calculatedPrefixSet.contains(prefixLoc)) {
private NTuple<Location> translateToCallerLocTuple(MethodInvokeNode min,
MethodDescriptor mdCallee, MethodDescriptor mdCaller, NTuple<Location> nodeLocTuple) {
- // this method will return NULL if the corresponding argument is literal
+ // this method will return the same nodeLocTuple if the corresponding argument is literal
// value.
- // assumes that we don't need to propagate callee flows to the argument
- // which is literal.
-
- // System.out.println("---translateToCallerLocTuple=" + min.printNode(0)
- // + " callee nodeLocTuple=" + nodeLocTuple);
FlowGraph calleeFlowGraph = getFlowGraph(mdCallee);
if (calleeFlowGraph.isParameter(nodeDescTuple)) {
int paramIdx = calleeFlowGraph.getParamIdx(nodeDescTuple);
NTuple<Descriptor> argDescTuple = mapMethodInvokeNodeToArgIdxMap.get(min).get(paramIdx);
- // System.out.println(" mapMethodInvokeNodeToArgIdxMap.get(min)="
- // + mapMethodInvokeNodeToArgIdxMap.get(min));
if (argDescTuple.size() == 0) {
// argument is literal
- return null;
+ return nodeLocTuple.clone();
}
NTuple<Location> argLocTuple = translateToLocTuple(mdCaller, argDescTuple);
FlowGraph flowGraph = getFlowGraph(md);
MethodSummary methodSummary = getMethodSummary(md);
- // construct a parameter mapping that maps a parameter descriptor to an
- // inferred composite
- // location
+ HierarchyGraph scGraph = getSkeletonCombinationHierarchyGraph(md);
+
+ // set the 'this' reference location
+ if (!md.isStatic()) {
+ System.out.println("setThisLocName=" + scGraph.getHNode(md.getThis()).getName());
+ methodSummary.setThisLocName(scGraph.getHNode(md.getThis()).getName());
+ }
+ // set the 'global' reference location if needed
+ if (methodSummary.hasGlobalAccess()) {
+ methodSummary.setGlobalLocName(scGraph.getHNode(GLOBALDESC).getName());
+ }
+
+ // construct a parameter mapping that maps a parameter descriptor to an
+ // inferred composite location
for (int paramIdx = 0; paramIdx < flowGraph.getNumParameters(); paramIdx++) {
FlowNode flowNode = flowGraph.getParamFlowNode(paramIdx);
CompositeLocation inferredCompLoc = flowNode.getCompositeLocation();
}
+ setupToAnalyze();
+ while (!toAnalyzeIsEmpty()) {
+ ClassDescriptor cd = toAnalyzeNext();
+ HierarchyGraph graph = getHierarchyGraph(cd);
+ for (Iterator iter = cd.getFields(); iter.hasNext();) {
+ FieldDescriptor fieldDesc = (FieldDescriptor) iter.next();
+ if (!(fieldDesc.isStatic() && fieldDesc.isFinal())) {
+ graph.getHNode(fieldDesc);
+ }
+ }
+ }
+
}
private HierarchyGraph getHierarchyGraph(Descriptor d) {
// for the method lattice, we need to look at the first element of
// NTuple<Descriptor>
+ boolean hasGlobalAccess = false;
for (Iterator iterator = nodeSet.iterator(); iterator.hasNext();) {
FlowNode srcNode = (FlowNode) iterator.next();
+ // if the srcNode is started with the global descriptor
+ // need to set as a skeleton node
+ if (!hasGlobalAccess && srcNode.getDescTuple().startsWith(GLOBALDESC)) {
+ hasGlobalAccess = true;
+ }
+
Set<FlowEdge> outEdgeSet = fg.getOutEdgeSet(srcNode);
for (Iterator iterator2 = outEdgeSet.iterator(); iterator2.hasNext();) {
FlowEdge outEdge = (FlowEdge) iterator2.next();
}
}
+ // If the method accesses static fields
+ // set hasGloabalAccess true in the method summary.
+ if (hasGlobalAccess) {
+ getMethodSummary(md).setHasGlobalAccess();
+ }
+ methodGraph.getHNode(GLOBALDESC).setSkeleton(true);
+
}
private MethodSummary getMethodSummary(MethodDescriptor md) {
rtr += "\")";
if (desc instanceof MethodDescriptor) {
- TypeDescriptor returnType = ((MethodDescriptor) desc).getReturnType();
+ System.out.println("#EXTRA LOC DECLARATION GEN=" + desc);
MethodSummary methodSummary = getMethodSummary((MethodDescriptor) desc);
- if (returnType != null && (!returnType.isVoid())) {
- rtr +=
- "\n@RETURNLOC(\"" + generateLocationAnnoatation(methodSummary.getRETURNLoc()) + "\")";
+ if (!ssjava.getMethodContainingSSJavaLoop().equals(desc)) {
+ TypeDescriptor returnType = ((MethodDescriptor) desc).getReturnType();
+ if (returnType != null && (!returnType.isVoid())) {
+ rtr +=
+ "\n@RETURNLOC(\"" + generateLocationAnnoatation(methodSummary.getRETURNLoc()) + "\")";
+ }
+ CompositeLocation pcLoc = methodSummary.getPCLoc();
+ if ((pcLoc != null) && (!pcLoc.get(0).isTop())) {
+ rtr += "\n@PCLOC(\"" + generateLocationAnnoatation(pcLoc) + "\")";
+ }
}
- rtr += "\n@THISLOC(\"this\")";
- rtr += "\n@GLOBALLOC(\"GLOBALLOC\")";
-
- CompositeLocation pcLoc = methodSummary.getPCLoc();
- if ((pcLoc != null) && (!pcLoc.get(0).isTop())) {
- rtr += "\n@PCLOC(\"" + generateLocationAnnoatation(pcLoc) + "\")";
- }
+ rtr += "\n@THISLOC(\"" + methodSummary.getThisLocName() + "\")";
+ rtr += "\n@GLOBALLOC(\"" + methodSummary.getGlobalLocName() + "\")";
}
setupToAnalazeMethod(cd);
- LocationInfo locInfo = mapClassToLocationInfo.get(cd);
String sourceFileName = cd.getSourceFileName();
if (cd.isInterface()) {
int classDefLine = mapDescToDefinitionLine.get(cd);
Vector<String> sourceVec = mapFileNameToLineVector.get(sourceFileName);
- if (locInfo == null) {
- locInfo = getLocationInfo(cd);
- }
-
- for (Iterator iter = cd.getFields(); iter.hasNext();) {
- FieldDescriptor fieldDesc = (FieldDescriptor) iter.next();
- if (!(fieldDesc.isStatic() && fieldDesc.isFinal())) {
- String locIdentifier = locInfo.getFieldInferLocation(fieldDesc).getLocIdentifier();
- if (!getLattice(cd).getElementSet().contains(locIdentifier)) {
- getLattice(cd).put(locIdentifier);
- }
- }
- }
+ LocationSummary fieldLocSummary = getLocationSummary(cd);
String fieldLatticeDefStr = generateLatticeDefinition(cd);
String annoatedSrc = fieldLatticeDefStr + newline + sourceVec.get(classDefLine);
sourceVec.set(classDefLine, annoatedSrc);
// generate annotations for field declarations
- LocationSummary fieldLocSummary = getLocationSummary(cd);
// Map<Descriptor, CompositeLocation> inferLocMap = fieldLocInfo.getMapDescToInferLocation();
Map<String, String> mapFieldNameToLocName = fieldLocSummary.getMapHNodeNameToLocationName();
// reference...
// boolean needToAddthisRef = hasThisReference(md);
- if (localLocElementSet.contains("this")) {
- methodLattice.put("this");
- }
+ // if (localLocElementSet.contains("this")) {
+ // methodLattice.put("this");
+ // }
String methodLatticeDefStr = generateLatticeDefinition(md);
String annoatedStr = methodLatticeDefStr + newline + sourceVec.get(methodDefLine);
return desc;
}
- private void calcualtePCLOC(MethodDescriptor md) {
+ private void calculatePCLOC(MethodDescriptor md) {
System.out.println("#calcualtePCLOC");
MethodSummary methodSummary = getMethodSummary(md);
System.out.println("paramLocTupleHavingInFlowSet=" + paramLocTupleHavingInFlowSet);
- if (!coversAllParamters(md, fg, paramLocTupleHavingInFlowSet)) {
- // if (numParamsWithIncomingValue > 0 && numParamsWithIncomingValue != fg.getNumParameters())
- // {
+ if (paramLocTupleHavingInFlowSet.size() > 0
+ && !coversAllParamters(md, fg, paramLocTupleHavingInFlowSet)) {
// Here, generates a location in the method lattice that is higher than the
// paramLocTupleHavingInFlowSet
private void calculateRETURNLOC(MethodDescriptor md) {
- System.out.println("#calculateRETURNLOC");
+ System.out.println("#calculateRETURNLOC= " + md);
// calculate a return location:
// the return location type is lower than all parameters and the location of return values
System.out.println("\nSSJAVA:Calculate PCLOC/RETURNLOC locations: " + md);
- calcualtePCLOC(md);
+ calculatePCLOC(md);
calculateRETURNLOC(md);
}
if (lastDescOfPrefix instanceof FieldDescriptor) {
enclosingDescriptor = ((FieldDescriptor) lastDescOfPrefix).getType().getClassDesc();
// System.out.println("enclosingDescriptor0=" + enclosingDescriptor);
+ } else if (lastDescOfPrefix.equals(GLOBALDESC)) {
+ MethodDescriptor currentMethodDesc = (MethodDescriptor) prefixLocTuple.get(0).getDescriptor();
+ enclosingDescriptor = currentMethodDesc.getClassDesc();
} else {
// var descriptor case
enclosingDescriptor = ((VarDescriptor) lastDescOfPrefix).getType().getClassDesc();