move logic from C++ to Java, Part 1

Christian Thalinger christian.thalinger at oracle.com
Fri May 3 22:50:27 PDT 2013


On Feb 11, 2013, at 8:38 AM, Lukas Stadler <lukas.stadler at jku.at> wrote:

> Thanks Christian! I will integrate the patch. Keep them coming :-)
> You're right, the more of our logic we have in Java the better.

He!  This patch never got integrated! ;-)

http://hg.openjdk.java.net/graal/graal/rev/674a8b9e62f8 took care of vmPageSize but I still propose the change for windowsOs.  I'll send a RFR in a second.

-- Chris

> 
> - Lukas
> 
> On Feb 10, 2013, at 5:23 AM, Christian Thalinger <christian.thalinger at oracle.com> wrote:
> 
>> 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