# HG changeset patch # User Matthias Grimmer # Date 1391589150 -3600 # Node ID d04be74665fb24531b853c8e3067029019c2b4f4 # Parent e2db5c351ef3624f41168610d93f0d4ecb9e5c5d GNFI: add comments diff -r e2db5c351ef3 -r d04be74665fb graal/com.oracle.graal.ffi.amd64/src/com/oracle/graal/ffi/amd64/AMD64NativeFunctionInterface.java --- a/graal/com.oracle.graal.ffi.amd64/src/com/oracle/graal/ffi/amd64/AMD64NativeFunctionInterface.java Wed Feb 05 09:26:36 2014 +0100 +++ b/graal/com.oracle.graal.ffi.amd64/src/com/oracle/graal/ffi/amd64/AMD64NativeFunctionInterface.java Wed Feb 05 09:32:30 2014 +0100 @@ -99,7 +99,7 @@ @Override public AMD64NativeFunctionHandle getFunctionHandle(String functionName, Class returnType, Class[] argumentTypes) { - if (rtldDefault.asRawValue() == AMD64NativeLibraryHandle.INVALID_HANDLE) { + if (rtldDefault.asRawValue() == AMD64NativeLibraryHandle.INVALID_RTLD_DEFAULT_HANDLE) { throw new AssertionError("No library provided or RTLD_DEFAULT not supported!"); } return getFunctionHandle(rtldDefault, functionName, returnType, argumentTypes); diff -r e2db5c351ef3 -r d04be74665fb graal/com.oracle.graal.ffi.amd64/src/com/oracle/graal/ffi/amd64/AMD64NativeLibraryHandle.java --- a/graal/com.oracle.graal.ffi.amd64/src/com/oracle/graal/ffi/amd64/AMD64NativeLibraryHandle.java Wed Feb 05 09:26:36 2014 +0100 +++ b/graal/com.oracle.graal.ffi.amd64/src/com/oracle/graal/ffi/amd64/AMD64NativeLibraryHandle.java Wed Feb 05 09:32:30 2014 +0100 @@ -27,7 +27,12 @@ public class AMD64NativeLibraryHandle implements NativeLibraryHandle { private final long handle; - public static final long INVALID_HANDLE = 0xDEADFACE; + // The native side (graalCompilerToVM.cpp) sets the rtldDefault handle to 0xDEADFACE if the + // platform is Windows. + // AMD64NativeFunctionInterface checks if rtld_default handle is valid. + // Windows is currently not supported. + // Using 0 is not possible as it is a valid value for rtldDefault on some platforms. + public static final long INVALID_RTLD_DEFAULT_HANDLE = 0xDEADFACE; public AMD64NativeLibraryHandle(long handle) { this.handle = handle; @@ -38,6 +43,6 @@ } public boolean isValid() { - return handle != 0 && handle != INVALID_HANDLE; + return handle != 0; } } diff -r e2db5c351ef3 -r d04be74665fb src/share/vm/graal/graalCompilerToVM.cpp --- a/src/share/vm/graal/graalCompilerToVM.cpp Wed Feb 05 09:26:36 2014 +0100 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Wed Feb 05 09:32:30 2014 +0100 @@ -563,7 +563,10 @@ #if defined(TARGET_OS_FAMILY_bsd) || defined(TARGET_OS_FAMILY_linux) set_long("rtldDefault", (jlong) RTLD_DEFAULT); #else - set_long("rtldDefault", (jlong) 0xDEADFACE); //TODO(mg): will crash on java side, not supported! + // Windows is not supported at the moment. + // On Java-side we do a check on 0xDEADFACE and crash if rtldDefault == 0xDEADFACE. + // Using 0 is not possible as it is a valid value for rtldDefault on some platforms. + set_long("rtldDefault", (jlong) 0xDEADFACE); #endif #undef set_boolean