|
From: <ans...@us...> - 2007-01-16 23:32:48
|
Revision: 3083
http://jnode.svn.sourceforge.net/jnode/?rev=3083&view=rev
Author: ansari82
Date: 2007-01-16 15:32:46 -0800 (Tue, 16 Jan 2007)
Log Message:
-----------
Added support for explicit opt and fallback compilers, and use them for boot image and runtime compilation
Modified Paths:
--------------
branches/jikesRVM/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java
branches/jikesRVM/core/src/core/org/jnode/vm/LoadCompileService.java
branches/jikesRVM/core/src/core/org/jnode/vm/VmArchitecture.java
branches/jikesRVM/core/src/core/org/jnode/vm/x86/VmX86Architecture.java
Modified: branches/jikesRVM/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java
===================================================================
--- branches/jikesRVM/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2007-01-16 23:20:01 UTC (rev 3082)
+++ branches/jikesRVM/builder/src/builder/org/jnode/build/AbstractBootImageBuilder.java 2007-01-16 23:32:46 UTC (rev 3083)
@@ -197,15 +197,6 @@
throws ClassNotFoundException {
final NativeCodeCompiler[] compilers = arch.getCompilers();
final int optLevel = compilers.length - 1;
- // Use the most optimizing compiler here
- final NativeCodeCompiler compiler = compilers[optLevel];
- NativeCodeCompiler backup, test = null;
- for(int i = 0; i < compilers.length; i++) {
- if(compilers[i] instanceof X86Level1ACompiler) {
- test = compilers[i]; break;
- }
- }
- if(test==null)backup=null; else backup=test;
int oldCount;
int newCount;
@@ -233,11 +224,11 @@
for (int i = 0; i < cnt; i++) {
final VmMethod method = vmClass.getDeclaredMethod(i);
mcnt++;
- if(compiler instanceof JikesRVMOptCompiler && !JikesRVMOptCompiler.compilableMethod(method)) {
- backup.compileBootstrap(method, os, optLevel);
+ if(method.hasNoOptCompilePragma() || !JikesRVMOptCompiler.compilableMethod(method)) {
+ arch.getFallbackCompiler().compileBootstrap(method, os, optLevel);
}
else {
- compiler.compileBootstrap(method, os, optLevel);
+ arch.getOptCompiler().compileBootstrap(method, os, optLevel);
}
}
vmClass.setCompiled();
Modified: branches/jikesRVM/core/src/core/org/jnode/vm/LoadCompileService.java
===================================================================
--- branches/jikesRVM/core/src/core/org/jnode/vm/LoadCompileService.java 2007-01-16 23:20:01 UTC (rev 3082)
+++ branches/jikesRVM/core/src/core/org/jnode/vm/LoadCompileService.java 2007-01-16 23:32:46 UTC (rev 3083)
@@ -37,7 +37,8 @@
private final ObjectResolver resolver;
private final NativeCodeCompiler[] compilers;
-
+
+ private final NativeCodeCompiler optCompiler, fallbackCompiler;
private final NativeCodeCompiler[] testCompilers;
private static boolean started = false;
@@ -53,6 +54,8 @@
final VmArchitecture arch = VmMagic.currentProcessor()
.getArchitecture();
this.compilers = arch.getCompilers();
+ optCompiler = arch.getOptCompiler();
+ fallbackCompiler = arch.getFallbackCompiler();
this.testCompilers = arch.getTestCompilers();
}
@@ -207,10 +210,10 @@
index = cmps.length - 1;
}
if (vmMethod.getNativeCodeOptLevel() < optLevel) {
- if(cmps[index] instanceof JikesRVMOptCompiler &&
- !vmMethod.getDeclaringClass().getName().startsWith("org.jnode.test")
- || vmMethod.hasNoOptCompilePragma())
- cmp = cmps[index-1];
+ if(cmps[index] == optCompiler &&
+ !(vmMethod.getDeclaringClass().getName().startsWith("org.jnode.test")
+ || vmMethod.hasNoOptCompilePragma()))
+ cmp = fallbackCompiler;
else
cmp = cmps[index];
cmp.compileRuntime(vmMethod, resolver, optLevel, null);
Modified: branches/jikesRVM/core/src/core/org/jnode/vm/VmArchitecture.java
===================================================================
--- branches/jikesRVM/core/src/core/org/jnode/vm/VmArchitecture.java 2007-01-16 23:20:01 UTC (rev 3082)
+++ branches/jikesRVM/core/src/core/org/jnode/vm/VmArchitecture.java 2007-01-16 23:32:46 UTC (rev 3083)
@@ -317,4 +317,8 @@
protected VmMultiMediaSupport createMultiMediaSupport() {
return new VmJavaMultiMediaSupport();
}
+
+ //Get specific compilers
+ public abstract NativeCodeCompiler getFallbackCompiler();
+ public abstract NativeCodeCompiler getOptCompiler();
}
Modified: branches/jikesRVM/core/src/core/org/jnode/vm/x86/VmX86Architecture.java
===================================================================
--- branches/jikesRVM/core/src/core/org/jnode/vm/x86/VmX86Architecture.java 2007-01-16 23:20:01 UTC (rev 3082)
+++ branches/jikesRVM/core/src/core/org/jnode/vm/x86/VmX86Architecture.java 2007-01-16 23:32:46 UTC (rev 3083)
@@ -105,6 +105,7 @@
/** The compilers */
private final NativeCodeCompiler[] compilers;
+ private final NativeCodeCompiler optCompiler, fallbackCompiler;
/** The compilers under test */
private final NativeCodeCompiler[] testCompilers;
@@ -151,6 +152,8 @@
this.compilers[2] = new JikesRVMOptCompiler();
this.compilers[3] = this.compilers[2];
+ optCompiler = compilers[2];
+ fallbackCompiler = compilers[1];
// this.compilers[3] = this.compilers[1];
this.testCompilers = null;
@@ -453,4 +456,12 @@
return super.createMultiMediaSupport();
}
}
+
+ public NativeCodeCompiler getFallbackCompiler() {
+ return fallbackCompiler;
+ }
+
+ public NativeCodeCompiler getOptCompiler() {
+ return optCompiler;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|