move logic from C++ to Java, Part 1
Christian Thalinger
christian.thalinger at oracle.com
Sat Feb 9 20:23:50 PST 2013
I think we should try to move more code from C++ to Java. This whole Java-native dance makes things just complicated. Here is a small patch to start.
-- Chris
graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java src/share/vm/graal/graalCompilerToVM.cpp
diff --git a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java
@@ -22,18 +22,21 @@
*/
package com.oracle.graal.hotspot;
+import sun.misc.Unsafe;
+
/**
* Used to communicate configuration details, runtime offsets, etc. to Graal upon compileMethod.
*/
public final class HotSpotVMConfig extends CompilerObject {
private static final long serialVersionUID = -4744897993263044184L;
+ private static final Unsafe unsafe = Unsafe.getUnsafe();
HotSpotVMConfig() {
}
// os information, register layout, code generation, ...
- public boolean windowsOs;
+ public final boolean windowsOs = System.getProperty("os.name").startsWith("Windows");
public int codeEntryAlignment;
public boolean verifyOops;
public boolean ciTime;
@@ -44,7 +47,7 @@
public boolean useAESIntrinsics;
// offsets, ...
- public int vmPageSize;
+ public final int vmPageSize = unsafe.pageSize();
public int stackShadowPages;
/**
diff --git a/src/share/vm/graal/graalCompilerToVM.cpp b/src/share/vm/graal/graalCompilerToVM.cpp
--- a/src/share/vm/graal/graalCompilerToVM.cpp
+++ b/src/share/vm/graal/graalCompilerToVM.cpp
@@ -602,11 +602,7 @@
#define set_int_array(name, value) do { env->SetObjectField(config, getFieldID(env, config, name, "[I"), value); } while (0)
guarantee(HeapWordSize == sizeof(char*), "Graal assumption that HeadWordSize == machine word size is wrong");
-#ifdef _WIN64
- set_boolean("windowsOs", true);
-#else
- set_boolean("windowsOs", false);
-#endif
+
set_boolean("verifyOops", VerifyOops);
set_boolean("ciTime", CITime);
set_boolean("useFastLocking", GraalUseFastLocking);
@@ -615,7 +611,6 @@
set_boolean("useAESIntrinsics", UseAESIntrinsics);
set_boolean("useTLAB", UseTLAB);
set_int("codeEntryAlignment", CodeEntryAlignment);
- set_int("vmPageSize", os::vm_page_size());
set_int("stackShadowPages", StackShadowPages);
set_int("hubOffset", oopDesc::klass_offset_in_bytes());
set_int("markOffset", oopDesc::mark_offset_in_bytes());
More information about the graal-dev
mailing list