Commit f53e9383 authored by Lukáš Marek's avatar Lukáš Marek

Small rename and package move

parent accb6f81
......@@ -4,13 +4,14 @@ import java.util.List;
import org.objectweb.asm.tree.AbstractInsnNode;
import ch.usi.dag.disl.staticcontext.customdatacache.MethodCDCache;
import ch.usi.dag.disl.util.cfg.CtrlFlowGraph;
public class BasicBlockStaticContext extends
MethodAnalysisContext<CtrlFlowGraph> {
MethodCDCache<CtrlFlowGraph> {
public int getTotBBs() {
return thisAnalysis.getNodes().size();
return customData.getNodes().size();
}
public int getBBSize() {
......@@ -35,11 +36,11 @@ public class BasicBlockStaticContext extends
}
public int getBBindex() {
return thisAnalysis.getIndex(staticContextData.getRegionStart());
return customData.getIndex(staticContextData.getRegionStart());
}
@Override
protected CtrlFlowGraph analysis() {
protected CtrlFlowGraph produceCustomData() {
return new CtrlFlowGraph(staticContextData.getMethodNode());
}
}
......@@ -16,7 +16,7 @@ public class LoopStaticContext extends BasicBlockStaticContext {
private Map<BasicBlock, Set<BasicBlock>> dominatormapping;
@Override
protected CtrlFlowGraph analysis() {
protected CtrlFlowGraph produceCustomData() {
MethodNode method = staticContextData.getMethodNode();
CtrlFlowGraph cfg = CtrlFlowGraph.build(method);
......@@ -77,7 +77,7 @@ public class LoopStaticContext extends BasicBlockStaticContext {
public boolean isFirstOfLoop() {
BasicBlock entry = thisAnalysis.getBB(staticContextData
BasicBlock entry = customData.getBB(staticContextData
.getRegionStart());
for (BasicBlock bb : entry.getPredecessors()) {
......
package ch.usi.dag.disl.staticcontext;
package ch.usi.dag.disl.staticcontext.customdatacache;
public abstract class ClassAnalysisContext<V> extends
AnalysisContext<String, V> {
public abstract class ClassCDCache<V> extends CustomDataCache<String, V> {
@Override
protected final String key() {
......
package ch.usi.dag.disl.staticcontext;
package ch.usi.dag.disl.staticcontext.customdatacache;
import java.util.HashMap;
import java.util.Map;
......@@ -6,24 +6,25 @@ import java.util.Map;
import ch.usi.dag.disl.snippet.Shadow;
import ch.usi.dag.disl.staticcontext.AbstractStaticContext;
public abstract class AnalysisContext<K, V> extends AbstractStaticContext {
public abstract class CustomDataCache<K, V> extends AbstractStaticContext {
private Map<K, V> analysisCache = new HashMap<K, V>();
protected V thisAnalysis;
private Map<K, V> cache = new HashMap<K, V>();
protected V customData;
public void staticContextData(Shadow sa) {
staticContextData = sa;
thisAnalysis = analysisCache.get(key());
super.staticContextData(sa);
customData = cache.get(key());
if (thisAnalysis == null) {
if (customData == null) {
thisAnalysis = analysis();
analysisCache.put(key(), thisAnalysis);
customData = produceCustomData();
cache.put(key(), customData);
}
}
protected abstract K key();
protected abstract V analysis();
protected abstract V produceCustomData();
}
package ch.usi.dag.disl.staticcontext;
package ch.usi.dag.disl.staticcontext.customdatacache;
public abstract class MethodAnalysisContext<V> extends
AnalysisContext<String, V> {
public abstract class MethodCDCache<V> extends CustomDataCache<String, V> {
@Override
protected final String key() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment