changeset 13119:124860fac470

Merge.
author Doug Simon <doug.simon@oracle.com>
date Fri, 22 Nov 2013 21:09:36 +0100
parents d511d688b782 (current diff) 0267afb6816b (diff)
children 3adfe375b01b
files
diffstat 7 files changed, 76 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java	Fri Nov 22 21:08:09 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java	Fri Nov 22 21:09:36 2013 +0100
@@ -36,6 +36,7 @@
 
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
+import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 
@@ -61,11 +62,29 @@
         register(new HotSpotForeignCallLinkage(EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF, null, exceptionCc, NOT_REEXECUTABLE, ANY_LOCATION));
         register(new HotSpotForeignCallLinkage(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF, exceptionCc, null, NOT_REEXECUTABLE, ANY_LOCATION));
 
+        // When the java.ext.dirs property is modified then the crypto classes might not be found.
+        // If that's the case we ignore the ClassNotFoundException and continue since we cannot
+        // replace a non-existing method anyway.
+        try {
+            // These stubs do callee saving
+            registerForeignCall(ENCRYPT_BLOCK, config.aescryptEncryptBlockStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION);
+            registerForeignCall(DECRYPT_BLOCK, config.aescryptDecryptBlockStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION);
+        } catch (GraalInternalError e) {
+            if (!(e.getCause() instanceof ClassNotFoundException)) {
+                throw e;
+            }
+        }
+        try {
+            // These stubs do callee saving
+            registerForeignCall(ENCRYPT, config.cipherBlockChainingEncryptAESCryptStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION);
+            registerForeignCall(DECRYPT, config.cipherBlockChainingDecryptAESCryptStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION);
+        } catch (GraalInternalError e) {
+            if (!(e.getCause() instanceof ClassNotFoundException)) {
+                throw e;
+            }
+        }
+
         // These stubs do callee saving
-        registerForeignCall(ENCRYPT_BLOCK, config.aescryptEncryptBlockStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION);
-        registerForeignCall(DECRYPT_BLOCK, config.aescryptDecryptBlockStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION);
-        registerForeignCall(ENCRYPT, config.cipherBlockChainingEncryptAESCryptStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION);
-        registerForeignCall(DECRYPT, config.cipherBlockChainingDecryptAESCryptStub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION);
         registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION);
 
         super.initialize(providers, config);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Fri Nov 22 21:08:09 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Fri Nov 22 21:09:36 2013 +0100
@@ -89,8 +89,12 @@
         this.startAt = startAt;
         this.stopAt = stopAt;
 
-        // We don't want the VM to exit when a method fails to compile.
+        // We don't want the VM to exit when a method fails to compile...
         ExitVMOnException.setValue(false);
+
+        // ...but we want to see exceptions.
+        PrintBailout.setValue(true);
+        PrintStackTraceOnException.setValue(true);
     }
 
     /**
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java	Fri Nov 22 21:08:09 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java	Fri Nov 22 21:09:36 2013 +0100
@@ -118,7 +118,7 @@
         }
 
         public boolean makeNullCheckFor(Value value, LIRFrameState nullCheckState, int implicitNullCheckLimit) {
-            if (state == null && value.equals(address.base) && address.index == Value.ILLEGAL && address.displacement >= 0 && address.displacement < implicitNullCheckLimit) {
+            if (state == null && value.equals(address.base) && address.index.equals(Value.ILLEGAL) && address.displacement >= 0 && address.displacement < implicitNullCheckLimit) {
                 state = nullCheckState;
                 return true;
             }
--- a/src/gpu/hsail/vm/gpu_hsail.cpp	Fri Nov 22 21:08:09 2013 +0100
+++ b/src/gpu/hsail/vm/gpu_hsail.cpp	Fri Nov 22 21:09:36 2013 +0100
@@ -33,8 +33,8 @@
 
 void * gpu::Hsail::_device_context;
 
-gpu::Hsail::okra_ctx_create_func_t      gpu::Hsail::_okra_ctx_create;
-gpu::Hsail::okra_kernel_create_func_t   gpu::Hsail::_okra_kernel_create;
+gpu::Hsail::okra_create_context_func_t  gpu::Hsail::_okra_create_context;
+gpu::Hsail::okra_create_kernel_func_t   gpu::Hsail::_okra_create_kernel;
 gpu::Hsail::okra_push_object_func_t     gpu::Hsail::_okra_push_object;
 gpu::Hsail::okra_push_boolean_func_t    gpu::Hsail::_okra_push_boolean;
 gpu::Hsail::okra_push_byte_func_t       gpu::Hsail::_okra_push_byte;
@@ -92,13 +92,13 @@
   // The kernel entrypoint is always run for the time being  
   const char* entryPointName = "&run";
 
-  _device_context = _okra_ctx_create();
+  _device_context = _okra_create_context();
 
   // code is not null terminated, must be a better way to do this
   unsigned char* nullTerminatedCodeBuffer = (unsigned char*) malloc(code_len + 1);
   memcpy(nullTerminatedCodeBuffer, code, code_len);
   nullTerminatedCodeBuffer[code_len] = 0;
-  void* kernel = _okra_kernel_create(_device_context, nullTerminatedCodeBuffer, entryPointName);
+  void* kernel = _okra_create_kernel(_device_context, nullTerminatedCodeBuffer, entryPointName);
   free(nullTerminatedCodeBuffer);
   return kernel;
 }
@@ -113,6 +113,16 @@
 
 #define STD_BUFFER_SIZE 1024
 
+#define STRINGIFY(x)     #x
+
+#define LOOKUP_OKRA_FUNCTION(name, alias)  \
+  _##alias =                               \
+    CAST_TO_FN_PTR(alias##_func_t, os::dll_lookup(handle, STRINGIFY(name))); \
+  if (_##alias == NULL) {      \
+  tty->print_cr("[HSAIL] ***** Error: Failed to lookup %s in %s, wrong version of OKRA?", STRINGIFY(name), okra_library_name); \
+        return 0; \
+  } \
+
 bool gpu::Hsail::probe_linkage() {
   if (okra_library_name != NULL) {
     char *buffer = (char*)malloc(STD_BUFFER_SIZE);
@@ -123,34 +133,19 @@
     free(buffer);
     if (handle != NULL) {
 
-      _okra_ctx_create =
-        CAST_TO_FN_PTR(okra_ctx_create_func_t, os::dll_lookup(handle, "okra_create_context"));
-      _okra_kernel_create =
-        CAST_TO_FN_PTR(okra_kernel_create_func_t, os::dll_lookup(handle, "okra_create_kernel"));
-      _okra_push_object =
-        CAST_TO_FN_PTR(okra_push_object_func_t, os::dll_lookup(handle, "okra_push_object"));
-      _okra_push_boolean =
-        CAST_TO_FN_PTR(okra_push_boolean_func_t, os::dll_lookup(handle, "okra_push_boolean"));
-      _okra_push_byte =
-        CAST_TO_FN_PTR(okra_push_byte_func_t, os::dll_lookup(handle, "okra_push_byte"));
-      _okra_push_double =
-        CAST_TO_FN_PTR(okra_push_double_func_t, os::dll_lookup(handle, "okra_push_double"));
-      _okra_push_float =
-        CAST_TO_FN_PTR(okra_push_float_func_t, os::dll_lookup(handle, "okra_push_float"));
-      _okra_push_int =
-        CAST_TO_FN_PTR(okra_push_int_func_t, os::dll_lookup(handle, "okra_push_int"));
-      _okra_push_long =
-        CAST_TO_FN_PTR(okra_push_long_func_t, os::dll_lookup(handle, "okra_push_long"));
-      _okra_execute_with_range =
-        CAST_TO_FN_PTR(okra_execute_with_range_func_t, os::dll_lookup(handle, "okra_execute_with_range"));
-      _okra_clearargs =
-        CAST_TO_FN_PTR(okra_clearargs_func_t, os::dll_lookup(handle, "okra_clearargs"));
-      _okra_register_heap =
-        CAST_TO_FN_PTR(okra_register_heap_func_t, os::dll_lookup(handle, "okra_register_heap"));
+      LOOKUP_OKRA_FUNCTION(okra_create_context, okra_create_context);
+      LOOKUP_OKRA_FUNCTION(okra_create_kernel, okra_create_kernel);
+      LOOKUP_OKRA_FUNCTION(okra_push_object, okra_push_object);
+      LOOKUP_OKRA_FUNCTION(okra_push_boolean, okra_push_boolean);
+      LOOKUP_OKRA_FUNCTION(okra_push_byte, okra_push_byte);
+      LOOKUP_OKRA_FUNCTION(okra_push_double, okra_push_double);
+      LOOKUP_OKRA_FUNCTION(okra_push_float, okra_push_float);
+      LOOKUP_OKRA_FUNCTION(okra_push_int, okra_push_int);
+      LOOKUP_OKRA_FUNCTION(okra_push_long, okra_push_long);
+      LOOKUP_OKRA_FUNCTION(okra_execute_with_range, okra_execute_with_range);
+      LOOKUP_OKRA_FUNCTION(okra_clearargs, okra_clearargs);
+      LOOKUP_OKRA_FUNCTION(okra_register_heap, okra_register_heap);
 
-      if (TraceGPUInteraction) {
-        tty->print_cr("[HSAIL] Success: library linkage _okra_clearargs=0x%08x", _okra_clearargs);
-      }
       return true;
     } else {
       // Unable to dlopen okra
--- a/src/gpu/hsail/vm/gpu_hsail.hpp	Fri Nov 22 21:08:09 2013 +0100
+++ b/src/gpu/hsail/vm/gpu_hsail.hpp	Fri Nov 22 21:09:36 2013 +0100
@@ -44,8 +44,8 @@
 #endif
 
 private:
-  typedef void* (*okra_ctx_create_func_t)();
-  typedef void* (*okra_kernel_create_func_t)(void*, unsigned char *, const char *);
+  typedef void* (*okra_create_context_func_t)();
+  typedef void* (*okra_create_kernel_func_t)(void*, unsigned char *, const char *);
   typedef bool (*okra_push_object_func_t)(void*, void*);
   typedef bool (*okra_push_boolean_func_t)(void*, jboolean);
   typedef bool (*okra_push_byte_func_t)(void*, jbyte);
@@ -58,8 +58,8 @@
   typedef bool (*okra_register_heap_func_t)(void*, size_t);
   
 public:
-  static okra_ctx_create_func_t                 _okra_ctx_create;
-  static okra_kernel_create_func_t              _okra_kernel_create;
+  static okra_create_context_func_t             _okra_create_context;
+  static okra_create_kernel_func_t              _okra_create_kernel;
   static okra_push_object_func_t                _okra_push_object;
   static okra_push_boolean_func_t               _okra_push_boolean;
   static okra_push_byte_func_t                  _okra_push_byte;
--- a/src/os_gpu/linux_ptx/vm/gpu_linux.cpp	Fri Nov 22 21:08:09 2013 +0100
+++ b/src/os_gpu/linux_ptx/vm/gpu_linux.cpp	Fri Nov 22 21:09:36 2013 +0100
@@ -81,13 +81,19 @@
         tty->print_cr("Found supported nVidia GPU device vendor : 0x%04x device 0x%04x", vendor, device);
       }
       break;
-    } else if (vendor == amd_vendor_id) {
-      gpu_device_exists = true;
-      set_target_il_type(gpu::HSAIL);
-      if (TraceGPUInteraction) {
-        tty->print_cr("Found supported AMD GPU device vendor : 0x%04x device 0x%04x", vendor, device);
-      }
-      break;
+       /*
+        * Remove AMD detection until we decide how to detect real HSA hardware.
+        * In the current form this check does not work correctly on AMD CPU system with 
+        * Nvidia GPU.
+        *
+        * } else if (vendor == amd_vendor_id) {
+        *   gpu_device_exists = true;
+        *   set_target_il_type(gpu::HSAIL);
+        *   if (TraceGPUInteraction) {
+        *     tty->print_cr("Found supported AMD GPU device vendor : 0x%04x device 0x%04x", vendor, device);
+        *   }
+        *   break;
+        */
     }
   }
 
--- a/src/share/vm/runtime/thread.cpp	Fri Nov 22 21:08:09 2013 +0100
+++ b/src/share/vm/runtime/thread.cpp	Fri Nov 22 21:09:36 2013 +0100
@@ -3378,10 +3378,6 @@
   // Initialize the os module before using TLS
   os::init();
 
-  // Probe for existance of supported GPU and initialize it if one
-  // exists.
-  gpu::init();
-
   // Initialize system properties.
   Arguments::init_system_properties();
 
@@ -3395,6 +3391,10 @@
   jint parse_result = Arguments::parse(args);
   if (parse_result != JNI_OK) return parse_result;
 
+  // Probe for existance of supported GPU and initialize it if one
+  // exists.
+  gpu::init();
+
   os::init_before_ergo();
 
   jint ergo_result = Arguments::apply_ergo();