use of com.jopdesign.common.AppInfo in project jop by jop-devel.
the class AppLoader method processClassName.
private int processClassName(String className) {
AppInfo appInfo = AppInfo.getSingleton();
int cnt = 0;
ClassInfo cls;
if (appInfo.hasClassInfo(className)) {
cls = appInfo.getClassInfo(className);
} else {
cls = appInfo.loadClass(className);
if (cls != null) {
newClasses.add(cls);
cnt++;
}
}
if (cls != null) {
enqueue(cls);
}
return cnt;
}
use of com.jopdesign.common.AppInfo in project jop by jop-devel.
the class TypeGraphTool method main.
public static void main(String[] args) {
// setup some defaults, initialize without any per-program defaults
AppSetup setup = new AppSetup();
setup.setUsageInfo("typegraph", "This is tool to examine the type graph.");
setup.setVersionInfo("The version of this whole application is 0.1");
// set the name of the (optional) user-provided config file
setup.setConfigFilename("typegraph.properties");
TypeGraphTool typeGraph = new TypeGraphTool();
setup.registerTool("typegraph", typeGraph);
AppInfo appInfo = setup.initAndLoad(args, false, true, true);
typeGraph.run(setup.getConfig());
}
use of com.jopdesign.common.AppInfo in project jop by jop-devel.
the class SuperGraphTest method main.
public static void main(String[] args) {
TestFramework testFramework = new TestFramework();
AppSetup setup = testFramework.setupAppSetup("java/tools/test/test/cg1.zip", null);
AppInfo appInfo = testFramework.setupAppInfo("wcet.devel.CallGraph1.run", true);
SuperGraphTest testInst = new SuperGraphTest();
testInst.appInfo = appInfo;
MethodInfo mainMethod = appInfo.getMainMethod();
SuperGraph sg0 = new SuperGraph(testInst, testInst.getFlowGraph(mainMethod), 0);
try {
testInst.getFlowGraph(mainMethod).exportDOT(new File("/tmp/cg1-run.dot"));
sg0.exportDOT(new File("/tmp/cg1-super0.dot"));
} catch (IOException e) {
e.printStackTrace();
}
SuperGraph sg2 = new SuperGraph(testInst, testInst.getFlowGraph(mainMethod), 2);
try {
FileWriter fw = new FileWriter("/tmp/cg1-super2.dot");
sg2.exportDOT(new File("/tmp/cg1-super2.dot"));
fw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
use of com.jopdesign.common.AppInfo in project jop by jop-devel.
the class ConstantCache method addStaticFieldAddress.
private void addStaticFieldAddress(ControlFlowGraph cfg, FieldInstruction fii) {
AppInfo appInfo = cfg.getAppInfo();
ConstantPoolGen cpg = cfg.getMethodInfo().getConstantPoolGen();
String fieldName = fii.getFieldName(cpg) + fii.getSignature(cpg);
Integer address = project.getLinkerInfo().getStaticFieldAddress(((ObjectType) fii.getReferenceType(cpg)).getClassName(), fieldName);
addAddress(staticAddressMap, cfg.getMethodInfo(), address);
}
use of com.jopdesign.common.AppInfo in project jop by jop-devel.
the class InvokeSite method getInvokeeRef.
/**
* Get the MethodRef to the referenced method. If the instruction is handled in java, return a reference
* to the method which implements the instruction.
* <p>
* The MethodRef refers to the actual reference. {@link MethodRef#getMethodInfo()} resolves the actual
* MethodInfo, which might be defined in a super class of the referenced method, if the method is inherited.
* For invokespecial, the implementing method might even be defined in a subclass of the referenced method,
* if resolveSuper is set to false, see {@link #isInvokeSuper()} for details.
* </p>
* <p>To find all possible implementations if the invocation is a virtual invoke (see {@link #isVirtual()}),
* use {@link AppInfo#findImplementations(InvokeSite)}.</p>
*
* @see #isInvokeSuper()
* @see AppInfo#findImplementations(InvokeSite)
* @param resolveSuper if true, try to resolve the super method reference (see {@link #isInvokeSuper()}),
* else return a reference to the method as it is defined by the instruction.
* @return a method reference to the invokee method.
*/
public MethodRef getInvokeeRef(boolean resolveSuper) {
Instruction instr = instruction.getInstruction();
AppInfo appInfo = AppInfo.getSingleton();
if (instr instanceof InvokeInstruction) {
MethodRef ref = getReferencedMethod(invoker, (InvokeInstruction) instr);
// need to check isInvokeSpecial here, since it is not checked by isSuperMethod!
if (resolveSuper && isInvokeSpecial() && isSuperMethod(ref)) {
ref = resolveInvokeSuper(ref);
}
return ref;
}
if (appInfo.getProcessorModel().isImplementedInJava(invoker, instr)) {
return appInfo.getProcessorModel().getJavaImplementation(appInfo, invoker, instr).getMethodRef();
}
throw new JavaClassFormatError("InvokeSite handle does not refer to an invoke instruction: " + toString());
}
Aggregations