use of com.jopdesign.common.processormodel.AllocationModel in project jop by jop-devel.
the class AppSetup method initProcessorModel.
private void initProcessorModel(Model model) {
ProcessorModel pm;
switch(model) {
case JOP:
pm = new JOPModel(config);
break;
case jamuth:
pm = new JamuthModel(config);
break;
case allocation:
pm = new AllocationModel(config);
break;
case JVM:
pm = new JVMModel();
break;
default:
throw new BadConfigurationError("Unknown processor model " + model);
}
appInfo.setProcessorModel(pm);
// load referenced classes as roots
for (String jvmClass : pm.getJVMClasses()) {
ClassInfo rootInfo = appInfo.loadClass(jvmClass.replaceAll("/", "."));
if (rootInfo == null) {
System.err.println("Error loading JVM class '" + jvmClass + "'.");
System.exit(4);
}
}
if (appInfo.doLoadNatives()) {
for (String nativeClass : pm.getNativeClasses()) {
ClassInfo rootInfo = appInfo.loadClass(nativeClass.replaceAll("/", "."));
if (rootInfo == null) {
System.err.println("Error loading Native class '" + nativeClass + "'.");
System.exit(4);
}
}
}
// we do not set the JVM and native classes as root anymore, instead we let the PM decide which roots we need
for (String root : pm.getJVMRoots()) {
MemberID mID = MemberID.parse(root);
// make sure the class exists..
ClassInfo cls = appInfo.loadClass(mID.getClassName());
// Get the member and add it as root
if (mID.hasMemberName()) {
MethodInfo methodInfo = cls.getMethodInfo(mID);
if (methodInfo == null) {
System.err.println("Could not find JVM root " + root);
System.exit(5);
}
appInfo.addRoot(methodInfo);
} else {
appInfo.addRoot(cls);
}
}
}
Aggregations