diff src/gpu/hsail/vm/gpu_hsail.cpp @ 16898:433ece7d941d

Merge.
author Doug Simon <doug.simon@oracle.com>
date Fri, 22 Aug 2014 16:03:49 +0200
parents bbb987aec58d
children 2d6dd2eebd51
line wrap: on
line diff
--- a/src/gpu/hsail/vm/gpu_hsail.cpp	Fri Aug 22 15:56:51 2014 +0200
+++ b/src/gpu/hsail/vm/gpu_hsail.cpp	Fri Aug 22 16:03:49 2014 +0200
@@ -140,6 +140,8 @@
                                                 jint num_tlabs, int allocBytesPerWorkitem, jobject oop_map_array, TRAPS) {
   ResourceMark rm(THREAD);
   objArrayOop argsArray = (objArrayOop) JNIHandles::resolve(args);
+  // Note this length does not include the iteration variable since it is replaced by the HSA workitemid
+  int argsArrayLength = argsArray->length();
   assert(THREAD->is_Java_thread(), "must be a JavaThread");
 
   // We avoid HSAILAllocationInfo logic if kernel does not allocate
@@ -296,7 +298,8 @@
             KlassHandle methKlass = mh->method_holder();
             Thread* THREAD = Thread::current();
             JavaValue result(T_VOID);
-            JavaCallArguments javaArgs;
+            // Add the iteration variable to the HSA args length
+            JavaCallArguments javaArgs(argsArrayLength + 1);
             // re-resolve the args_handle here
             objArrayOop resolvedArgsArray = (objArrayOop) JNIHandles::resolve(args);
 
@@ -344,8 +347,11 @@
   // The kernel entrypoint is always run for the time being  
   const char* entryPointName = "&run";
   jlong okra_kernel;
-  jint okra_status = _okra_create_kernel(_device_context, code, entryPointName, (void**)&okra_kernel);
-  guarantee(okra_status==0, "_okra_create_kernel failed");
+  {
+    TraceTime t("generate kernel ", TraceGPUInteraction);
+    jint okra_status = _okra_create_kernel(_device_context, code, entryPointName, (void**)&okra_kernel);
+    guarantee(okra_status==0, "_okra_create_kernel failed");
+  }
   return (jlong) okra_kernel;
 GPU_END