diff src/share/vm/jvmci/jvmciRuntime.cpp @ 21626:ca3c6538bcec

JVMCI update makefiles for Solaris/SPARC; os::read at early stage of VM does not work, use ::read as fallback in JVMCIRuntime::parse_lines (JBS:GRAAL-54)
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Mon, 01 Jun 2015 14:17:05 +0200
parents ed013f4d38e5
children 9966b358bc2b
line wrap: on
line diff
--- a/src/share/vm/jvmci/jvmciRuntime.cpp	Mon Jun 01 13:19:48 2015 +0200
+++ b/src/share/vm/jvmci/jvmciRuntime.cpp	Mon Jun 01 14:17:05 2015 +0200
@@ -1111,7 +1111,12 @@
     int file_handle = os::open(path, 0, 0);
     if (file_handle != -1) {
       char* buffer = NEW_C_HEAP_ARRAY(char, st.st_size + 1, mtInternal);
-      int num_read = (int) os::read(file_handle, (char*) buffer, st.st_size);
+      int num_read;
+      if(ThreadLocalStorage::thread() == NULL) { // Solaris needs a JavaThread for os::read, if no thread started yet, fallback.
+        num_read = (int) ::read(file_handle, (char*) buffer, st.st_size);
+      } else {
+        num_read = (int) os::read(file_handle, (char*) buffer, st.st_size);
+      }
       if (num_read == -1) {
         warning("Error reading file %s due to %s", path, strerror(errno));
       } else if (num_read != st.st_size) {