diff src/share/vm/memory/threadLocalAllocBuffer.cpp @ 16795:a29e6e7b7a86

Replace hsail donor threads with hsail tlabs
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Tue, 12 Aug 2014 16:30:17 -0700
parents 4ca6dc0799b6
children 52b4284cb496
line wrap: on
line diff
--- a/src/share/vm/memory/threadLocalAllocBuffer.cpp	Tue Aug 12 16:12:49 2014 -0700
+++ b/src/share/vm/memory/threadLocalAllocBuffer.cpp	Tue Aug 12 16:30:17 2014 -0700
@@ -48,6 +48,13 @@
   for(JavaThread *thread = Threads::first(); thread; thread = thread->next()) {
     thread->tlab().accumulate_statistics();
     thread->tlab().initialize_statistics();
+#ifdef GRAAL
+    for (jint i = 0; i < thread->get_gpu_hsail_tlabs_count(); i++) {
+      thread->get_gpu_hsail_tlab_at(i)->accumulate_statistics();
+      thread->get_gpu_hsail_tlab_at(i)->initialize_statistics();
+    }
+#endif
+
   }
 
   // Publish new stats if some allocation occurred.
@@ -129,6 +136,11 @@
 void ThreadLocalAllocBuffer::resize_all_tlabs() {
   for(JavaThread *thread = Threads::first(); thread; thread = thread->next()) {
     thread->tlab().resize();
+#ifdef GRAAL
+    for (jint i = 0; i < thread->get_gpu_hsail_tlabs_count(); i++) {
+      thread->get_gpu_hsail_tlab_at(i)->resize();
+    }
+#endif
   }
 }
 
@@ -188,11 +200,12 @@
   invariants();
 }
 
-void ThreadLocalAllocBuffer::initialize() {
+void ThreadLocalAllocBuffer::initialize(Thread* owning_thread) {
   initialize(NULL,                    // start
              NULL,                    // top
              NULL);                   // end
 
+  _owning_thread = owning_thread;
   set_desired_size(initial_desired_size());
 
   // Following check is needed because at startup the main (primordial)
@@ -221,7 +234,7 @@
   // During jvm startup, the main (primordial) thread is initialized
   // before the heap is initialized.  So reinitialize it now.
   guarantee(Thread::current()->is_Java_thread(), "tlab initialization thread not Java thread");
-  Thread::current()->tlab().initialize();
+  Thread::current()->tlab().initialize(Thread::current());
 
   if (PrintTLAB && Verbose) {
     gclog_or_tty->print("TLAB min: " SIZE_FORMAT " initial: " SIZE_FORMAT " max: " SIZE_FORMAT "\n",
@@ -303,9 +316,7 @@
 }
 
 Thread* ThreadLocalAllocBuffer::myThread() {
-  return (Thread*)(((char *)this) +
-                   in_bytes(start_offset()) -
-                   in_bytes(Thread::tlab_start_offset()));
+  return _owning_thread;
 }