changeset 9436:1191af6137ed

8143014: Access PtrQueue member offsets through derived classes Summary: Moved accessors to derived classes and updated callers. Reviewed-by: tschatzl, jmasa, twisti
author kbarrett
date Tue, 17 Nov 2015 16:40:52 -0500
parents a8b594dc36ce
children 9c936a3abf69 fd4e8b7cf408 d91e023b7294 4da64841abd7
files src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp src/cpu/aarch64/vm/macroAssembler_aarch64.cpp src/cpu/ppc/vm/macroAssembler_ppc.cpp src/cpu/ppc/vm/stubGenerator_ppc.cpp src/cpu/sparc/vm/c1_Runtime1_sparc.cpp src/cpu/sparc/vm/macroAssembler_sparc.cpp src/cpu/x86/vm/c1_Runtime1_x86.cpp src/cpu/x86/vm/macroAssembler_x86.cpp src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java src/share/vm/c1/c1_LIRGenerator.cpp src/share/vm/gc/g1/dirtyCardQueue.hpp src/share/vm/gc/g1/ptrQueue.hpp src/share/vm/gc/g1/satbMarkQueue.hpp src/share/vm/gc/g1/vmStructs_g1.hpp src/share/vm/opto/compile.cpp src/share/vm/opto/escape.cpp src/share/vm/opto/graphKit.cpp src/share/vm/opto/macro.cpp src/share/vm/runtime/vmStructs.cpp
diffstat 19 files changed, 158 insertions(+), 89 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp	Tue Nov 17 16:40:52 2015 -0500
@@ -1169,12 +1169,12 @@
         const Register tmp = rscratch1;
 
         Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
-                                             PtrQueue::byte_offset_of_active()));
+                                             SATBMarkQueue::byte_offset_of_active()));
 
         Address queue_index(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
-                                             PtrQueue::byte_offset_of_index()));
+                                             SATBMarkQueue::byte_offset_of_index()));
         Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
-                                        PtrQueue::byte_offset_of_buf()));
+                                        SATBMarkQueue::byte_offset_of_buf()));
 
         Label done;
         Label runtime;
@@ -1219,9 +1219,9 @@
         const Register thread = rthread;
 
         Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
-                                             PtrQueue::byte_offset_of_index()));
+                                             DirtyCardQueue::byte_offset_of_index()));
         Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
-                                        PtrQueue::byte_offset_of_buf()));
+                                        DirtyCardQueue::byte_offset_of_buf()));
 
         const Register card_addr = rscratch2;
         ExternalAddress cardtable((address) ct->byte_map_base);
--- a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Tue Nov 17 16:40:52 2015 -0500
@@ -3487,18 +3487,18 @@
     assert_different_registers(obj, pre_val, tmp);
 
   Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
-                                       PtrQueue::byte_offset_of_active()));
+                                       SATBMarkQueue::byte_offset_of_active()));
   Address index(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
-                                       PtrQueue::byte_offset_of_index()));
+                                       SATBMarkQueue::byte_offset_of_index()));
   Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
-                                       PtrQueue::byte_offset_of_buf()));
+                                       SATBMarkQueue::byte_offset_of_buf()));
 
 
   // Is marking active?
-  if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
+  if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
     ldrw(tmp, in_progress);
   } else {
-    assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption");
+    assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
     ldrb(tmp, in_progress);
   }
   cbzw(tmp, done);
@@ -3566,9 +3566,9 @@
   assert(thread == rthread, "must be");
 
   Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
-                                       PtrQueue::byte_offset_of_index()));
+                                       DirtyCardQueue::byte_offset_of_index()));
   Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
-                                       PtrQueue::byte_offset_of_buf()));
+                                       DirtyCardQueue::byte_offset_of_buf()));
 
   BarrierSet* bs = Universe::heap()->barrier_set();
   CardTableModRefBS* ct = (CardTableModRefBS*)bs;
--- a/src/cpu/ppc/vm/macroAssembler_ppc.cpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/cpu/ppc/vm/macroAssembler_ppc.cpp	Tue Nov 17 16:40:52 2015 -0500
@@ -2633,11 +2633,11 @@
   Label runtime, filtered;
 
   // Is marking active?
-  if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
-    lwz(Rtmp1, in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active()), R16_thread);
+  if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
+    lwz(Rtmp1, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), R16_thread);
   } else {
-    guarantee(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption");
-    lbz(Rtmp1, in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active()), R16_thread);
+    guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
+    lbz(Rtmp1, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), R16_thread);
   }
   cmpdi(CCR0, Rtmp1, 0);
   beq(CCR0, filtered);
@@ -2672,13 +2672,13 @@
   // (The index field is typed as size_t.)
   const Register Rbuffer = Rtmp1, Rindex = Rtmp2;
 
-  ld(Rindex, in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_index()), R16_thread);
+  ld(Rindex, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_index()), R16_thread);
   cmpdi(CCR0, Rindex, 0);
   beq(CCR0, runtime); // If index == 0, goto runtime.
-  ld(Rbuffer, in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_buf()), R16_thread);
+  ld(Rbuffer, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_buf()), R16_thread);
 
   addi(Rindex, Rindex, -wordSize); // Decrement index.
-  std(Rindex, in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_index()), R16_thread);
+  std(Rindex, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_index()), R16_thread);
 
   // Record the previous value.
   stdx(Rpre_val, Rbuffer, Rindex);
@@ -2757,13 +2757,13 @@
 
   const Register Rqueue_index = Rtmp2,
                  Rqueue_buf   = Rtmp3;
-  ld(Rqueue_index, in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_index()), R16_thread);
+  ld(Rqueue_index, in_bytes(JavaThread::dirty_card_queue_offset() + DirtyCardQueue::byte_offset_of_index()), R16_thread);
   cmpdi(CCR0, Rqueue_index, 0);
   beq(CCR0, runtime); // index == 0 then jump to runtime
-  ld(Rqueue_buf, in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_buf()), R16_thread);
+  ld(Rqueue_buf, in_bytes(JavaThread::dirty_card_queue_offset() + DirtyCardQueue::byte_offset_of_buf()), R16_thread);
 
   addi(Rqueue_index, Rqueue_index, -wordSize); // decrement index
-  std(Rqueue_index, in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_index()), R16_thread);
+  std(Rqueue_index, in_bytes(JavaThread::dirty_card_queue_offset() + DirtyCardQueue::byte_offset_of_index()), R16_thread);
 
   stdx(Rcard_addr, Rqueue_buf, Rqueue_index); // store card
   b(filtered);
--- a/src/cpu/ppc/vm/stubGenerator_ppc.cpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/cpu/ppc/vm/stubGenerator_ppc.cpp	Tue Nov 17 16:40:52 2015 -0500
@@ -630,11 +630,11 @@
           Label filtered;
 
           // Is marking active?
-          if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
-            __ lwz(Rtmp1, in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active()), R16_thread);
+          if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
+            __ lwz(Rtmp1, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), R16_thread);
           } else {
-            guarantee(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption");
-            __ lbz(Rtmp1, in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active()), R16_thread);
+            guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
+            __ lbz(Rtmp1, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active()), R16_thread);
           }
           __ cmpdi(CCR0, Rtmp1, 0);
           __ beq(CCR0, filtered);
--- a/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Tue Nov 17 16:40:52 2015 -0500
@@ -857,13 +857,13 @@
         bool with_frame = false; // I don't know if we can do with-frame.
         int satb_q_index_byte_offset =
           in_bytes(JavaThread::satb_mark_queue_offset() +
-                   PtrQueue::byte_offset_of_index());
+                   SATBMarkQueue::byte_offset_of_index());
         int satb_q_buf_byte_offset =
           in_bytes(JavaThread::satb_mark_queue_offset() +
-                   PtrQueue::byte_offset_of_buf());
+                   SATBMarkQueue::byte_offset_of_buf());
 
         __ bind(restart);
-        // Load the index into the SATB buffer. PtrQueue::_index is a
+        // Load the index into the SATB buffer. SATBMarkQueue::_index is a
         // size_t so ld_ptr is appropriate
         __ ld_ptr(G2_thread, satb_q_index_byte_offset, tmp);
 
@@ -961,14 +961,14 @@
 
         int dirty_card_q_index_byte_offset =
           in_bytes(JavaThread::dirty_card_queue_offset() +
-                   PtrQueue::byte_offset_of_index());
+                   DirtyCardQueue::byte_offset_of_index());
         int dirty_card_q_buf_byte_offset =
           in_bytes(JavaThread::dirty_card_queue_offset() +
-                   PtrQueue::byte_offset_of_buf());
+                   DirtyCardQueue::byte_offset_of_buf());
 
         __ bind(restart);
 
-        // Get the index into the update buffer. PtrQueue::_index is
+        // Get the index into the update buffer. DirtyCardQueue::_index is
         // a size_t so ld_ptr is appropriate here.
         __ ld_ptr(G2_thread, dirty_card_q_index_byte_offset, tmp3);
 
--- a/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Tue Nov 17 16:40:52 2015 -0500
@@ -3632,19 +3632,19 @@
 
   int satb_q_index_byte_offset =
     in_bytes(JavaThread::satb_mark_queue_offset() +
-             PtrQueue::byte_offset_of_index());
+             SATBMarkQueue::byte_offset_of_index());
 
   int satb_q_buf_byte_offset =
     in_bytes(JavaThread::satb_mark_queue_offset() +
-             PtrQueue::byte_offset_of_buf());
-
-  assert(in_bytes(PtrQueue::byte_width_of_index()) == sizeof(intptr_t) &&
-         in_bytes(PtrQueue::byte_width_of_buf()) == sizeof(intptr_t),
+             SATBMarkQueue::byte_offset_of_buf());
+
+  assert(in_bytes(SATBMarkQueue::byte_width_of_index()) == sizeof(intptr_t) &&
+         in_bytes(SATBMarkQueue::byte_width_of_buf()) == sizeof(intptr_t),
          "check sizes in assembly below");
 
   __ bind(restart);
 
-  // Load the index into the SATB buffer. PtrQueue::_index is a size_t
+  // Load the index into the SATB buffer. SATBMarkQueue::_index is a size_t
   // so ld_ptr is appropriate.
   __ ld_ptr(G2_thread, satb_q_index_byte_offset, L0);
 
@@ -3736,17 +3736,17 @@
   }
 
   // Is marking active?
-  if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
+  if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
     ld(G2,
        in_bytes(JavaThread::satb_mark_queue_offset() +
-                PtrQueue::byte_offset_of_active()),
+                SATBMarkQueue::byte_offset_of_active()),
        tmp);
   } else {
-    guarantee(in_bytes(PtrQueue::byte_width_of_active()) == 1,
+    guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1,
               "Assumption");
     ldsb(G2,
          in_bytes(JavaThread::satb_mark_queue_offset() +
-                  PtrQueue::byte_offset_of_active()),
+                  SATBMarkQueue::byte_offset_of_active()),
          tmp);
   }
 
@@ -3847,13 +3847,13 @@
 
   int dirty_card_q_index_byte_offset =
     in_bytes(JavaThread::dirty_card_queue_offset() +
-             PtrQueue::byte_offset_of_index());
+             DirtyCardQueue::byte_offset_of_index());
   int dirty_card_q_buf_byte_offset =
     in_bytes(JavaThread::dirty_card_queue_offset() +
-             PtrQueue::byte_offset_of_buf());
+             DirtyCardQueue::byte_offset_of_buf());
   __ bind(restart);
 
-  // Load the index into the update buffer. PtrQueue::_index is
+  // Load the index into the update buffer. DirtyCardQueue::_index is
   // a size_t so ld_ptr is appropriate here.
   __ ld_ptr(G2_thread, dirty_card_q_index_byte_offset, L0);
 
--- a/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Tue Nov 17 16:40:52 2015 -0500
@@ -1622,9 +1622,9 @@
         NOT_LP64(__ get_thread(thread);)
 
         Address queue_index(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
-                                             PtrQueue::byte_offset_of_index()));
+                                             SATBMarkQueue::byte_offset_of_index()));
         Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
-                                        PtrQueue::byte_offset_of_buf()));
+                                        SATBMarkQueue::byte_offset_of_buf()));
 
         Label done;
         Label runtime;
@@ -1698,9 +1698,9 @@
         const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
 
         Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
-                                             PtrQueue::byte_offset_of_index()));
+                                             DirtyCardQueue::byte_offset_of_index()));
         Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
-                                        PtrQueue::byte_offset_of_buf()));
+                                        DirtyCardQueue::byte_offset_of_buf()));
 
         __ push(rax);
         __ push(rcx);
--- a/src/cpu/x86/vm/macroAssembler_x86.cpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/cpu/x86/vm/macroAssembler_x86.cpp	Tue Nov 17 16:40:52 2015 -0500
@@ -4248,18 +4248,18 @@
   }
 
   Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
-                                       PtrQueue::byte_offset_of_active()));
+                                       SATBMarkQueue::byte_offset_of_active()));
   Address index(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
-                                       PtrQueue::byte_offset_of_index()));
+                                       SATBMarkQueue::byte_offset_of_index()));
   Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
-                                       PtrQueue::byte_offset_of_buf()));
+                                       SATBMarkQueue::byte_offset_of_buf()));
 
 
   // Is marking active?
-  if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
+  if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
     cmpl(in_progress, 0);
   } else {
-    assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption");
+    assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
     cmpb(in_progress, 0);
   }
   jcc(Assembler::equal, done);
@@ -4346,9 +4346,9 @@
 #endif // _LP64
 
   Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
-                                       PtrQueue::byte_offset_of_index()));
+                                       DirtyCardQueue::byte_offset_of_index()));
   Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
-                                       PtrQueue::byte_offset_of_buf()));
+                                       DirtyCardQueue::byte_offset_of_buf()));
 
   CardTableModRefBS* ct =
     barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
--- a/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java	Tue Nov 17 16:40:52 2015 -0500
@@ -1193,9 +1193,12 @@
     @HotSpotVMConstant(name = "frame::interpreter_frame_sender_sp_offset", archs = {"amd64"}) @Stable public int frameInterpreterFrameSenderSpOffset;
     @HotSpotVMConstant(name = "frame::interpreter_frame_last_sp_offset", archs = {"amd64"}) @Stable public int frameInterpreterFrameLastSpOffset;
 
-    @HotSpotVMField(name = "PtrQueue::_active", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueActiveOffset;
-    @HotSpotVMField(name = "PtrQueue::_buf", type = "void**", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueBufferOffset;
-    @HotSpotVMField(name = "PtrQueue::_index", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueIndexOffset;
+    @HotSpotVMConstant(name = "dirtyCardQueueBufferOffset") @Stable private int dirtyCardQueueBufferOffset;
+    @HotSpotVMConstant(name = "dirtyCardQueueIndexOffset") @Stable private int dirtyCardQueueIndexOffset;
+
+    @HotSpotVMConstant(name = "satbMarkQueueBufferOffset") @Stable private int satbMarkQueueBufferOffset;
+    @HotSpotVMConstant(name = "satbMarkQueueIndexOffset") @Stable private int satbMarkQueueIndexOffset;
+    @HotSpotVMConstant(name = "satbMarkQueueActiveOffset") @Stable private int satbMarkQueueActiveOffset;
 
     @HotSpotVMField(name = "OSThread::_interrupted", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int osThreadInterruptedOffset;
 
@@ -1396,23 +1399,23 @@
     // G1 Collector Related Values.
 
     public int g1CardQueueIndexOffset() {
-        return javaThreadDirtyCardQueueOffset + ptrQueueIndexOffset;
+        return javaThreadDirtyCardQueueOffset + dirtyCardQueueIndexOffset;
     }
 
     public int g1CardQueueBufferOffset() {
-        return javaThreadDirtyCardQueueOffset + ptrQueueBufferOffset;
+        return javaThreadDirtyCardQueueOffset + dirtyCardQueueBufferOffset;
     }
 
     public int g1SATBQueueMarkingOffset() {
-        return javaThreadSatbMarkQueueOffset + ptrQueueActiveOffset;
+        return javaThreadSatbMarkQueueOffset + satbMarkQueueActiveOffset;
     }
 
     public int g1SATBQueueIndexOffset() {
-        return javaThreadSatbMarkQueueOffset + ptrQueueIndexOffset;
+        return javaThreadSatbMarkQueueOffset + satbMarkQueueIndexOffset;
     }
 
     public int g1SATBQueueBufferOffset() {
-        return javaThreadSatbMarkQueueOffset + ptrQueueBufferOffset;
+        return javaThreadSatbMarkQueueOffset + satbMarkQueueBufferOffset;
     }
 
     @HotSpotVMField(name = "java_lang_Class::_klass_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int klassOffset;
--- a/src/share/vm/c1/c1_LIRGenerator.cpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/share/vm/c1/c1_LIRGenerator.cpp	Tue Nov 17 16:40:52 2015 -0500
@@ -1464,10 +1464,10 @@
                                                      bool do_load, bool patch, CodeEmitInfo* info) {
   // First we test whether marking is in progress.
   BasicType flag_type;
-  if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
+  if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
     flag_type = T_INT;
   } else {
-    guarantee(in_bytes(PtrQueue::byte_width_of_active()) == 1,
+    guarantee(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1,
               "Assumption");
     // Use unsigned type T_BOOLEAN here rather than signed T_BYTE since some platforms, eg. ARM,
     // need to use unsigned instructions to use the large offset to load the satb_mark_queue.
@@ -1477,7 +1477,7 @@
   LIR_Address* mark_active_flag_addr =
     new LIR_Address(thrd,
                     in_bytes(JavaThread::satb_mark_queue_offset() +
-                             PtrQueue::byte_offset_of_active()),
+                             SATBMarkQueue::byte_offset_of_active()),
                     flag_type);
   // Read the marking-in-progress flag.
   LIR_Opr flag_val = new_register(T_INT);
--- a/src/share/vm/gc/g1/dirtyCardQueue.hpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/share/vm/gc/g1/dirtyCardQueue.hpp	Tue Nov 17 16:40:52 2015 -0500
@@ -72,6 +72,18 @@
   void **get_buf() { return _buf;}
   size_t get_index() { return _index;}
   void reinitialize() { _buf = 0; _sz = 0; _index = 0;}
+
+  // Compiler support.
+  static ByteSize byte_offset_of_index() {
+    return PtrQueue::byte_offset_of_index<DirtyCardQueue>();
+  }
+  using PtrQueue::byte_width_of_index;
+
+  static ByteSize byte_offset_of_buf() {
+    return PtrQueue::byte_offset_of_buf<DirtyCardQueue>();
+  }
+  using PtrQueue::byte_width_of_buf;
+
 };
 
 
--- a/src/share/vm/gc/g1/ptrQueue.hpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/share/vm/gc/g1/ptrQueue.hpp	Tue Nov 17 16:40:52 2015 -0500
@@ -140,19 +140,27 @@
   }
 
   // To support compiler.
+
+protected:
+  template<typename Derived>
   static ByteSize byte_offset_of_index() {
-    return byte_offset_of(PtrQueue, _index);
+    return byte_offset_of(Derived, _index);
   }
+
   static ByteSize byte_width_of_index() { return in_ByteSize(sizeof(size_t)); }
 
+  template<typename Derived>
   static ByteSize byte_offset_of_buf() {
-    return byte_offset_of(PtrQueue, _buf);
+    return byte_offset_of(Derived, _buf);
   }
+
   static ByteSize byte_width_of_buf() { return in_ByteSize(sizeof(void*)); }
 
+  template<typename Derived>
   static ByteSize byte_offset_of_active() {
-    return byte_offset_of(PtrQueue, _active);
+    return byte_offset_of(Derived, _active);
   }
+
   static ByteSize byte_width_of_active() { return in_ByteSize(sizeof(bool)); }
 
 };
--- a/src/share/vm/gc/g1/satbMarkQueue.hpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/share/vm/gc/g1/satbMarkQueue.hpp	Tue Nov 17 16:40:52 2015 -0500
@@ -68,6 +68,23 @@
   void print(const char* name);
   static void print(const char* name, void** buf, size_t index, size_t sz);
 #endif // PRODUCT
+
+  // Compiler support.
+  static ByteSize byte_offset_of_index() {
+    return PtrQueue::byte_offset_of_index<SATBMarkQueue>();
+  }
+  using PtrQueue::byte_width_of_index;
+
+  static ByteSize byte_offset_of_buf() {
+    return PtrQueue::byte_offset_of_buf<SATBMarkQueue>();
+  }
+  using PtrQueue::byte_width_of_buf;
+
+  static ByteSize byte_offset_of_active() {
+    return PtrQueue::byte_offset_of_active<SATBMarkQueue>();
+  }
+  using PtrQueue::byte_width_of_active;
+
 };
 
 class SATBMarkQueueSet: public PtrQueueSet {
--- a/src/share/vm/gc/g1/vmStructs_g1.hpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/share/vm/gc/g1/vmStructs_g1.hpp	Tue Nov 17 16:40:52 2015 -0500
@@ -28,6 +28,7 @@
 #include "gc/g1/g1CollectedHeap.hpp"
 #include "gc/g1/heapRegion.hpp"
 #include "gc/g1/heapRegionManager.hpp"
+#include "utilities/macros.hpp"
 
 #define VM_STRUCTS_G1(nonstatic_field, static_field)                          \
                                                                               \
@@ -62,6 +63,34 @@
                                                                               \
   nonstatic_field(HeapRegionSetCount,  _length,         uint)                 \
   nonstatic_field(HeapRegionSetCount,  _capacity,       size_t)               \
+                                                                              \
+  nonstatic_field(PtrQueue,            _active,         bool)                 \
+  nonstatic_field(PtrQueue,            _buf,            void**)               \
+  nonstatic_field(PtrQueue,            _index,          size_t)               \
+
+
+#define VM_INT_CONSTANTS_G1(declare_constant, declare_constant_with_value)    \
+                                                                              \
+  JVMCI_ONLY(                                                                 \
+    declare_constant_with_value(                                              \
+      "dirtyCardQueueBufferOffset",                                           \
+      in_bytes(DirtyCardQueue::byte_offset_of_buf()))                         \
+    declare_constant_with_value(                                              \
+      "dirtyCardQueueIndexOffset",                                            \
+      in_bytes(DirtyCardQueue::byte_offset_of_index()))                       \
+    ) /* JVMCI_ONLY */                                                        \
+                                                                              \
+  JVMCI_ONLY(                                                                 \
+    declare_constant_with_value(                                              \
+      "satbMarkQueueBufferOffset",                                            \
+      in_bytes(SATBMarkQueue::byte_offset_of_buf()))                          \
+    declare_constant_with_value(                                              \
+      "satbMarkQueueIndexOffset",                                             \
+      in_bytes(SATBMarkQueue::byte_offset_of_index()))                        \
+    declare_constant_with_value(                                              \
+      "satbMarkQueueActiveOffset",                                            \
+      in_bytes(SATBMarkQueue::byte_offset_of_active()))                       \
+    ) /* JVMCI_ONLY */                                                        \
 
 
 #define VM_TYPES_G1(declare_type, declare_toplevel_type)                      \
@@ -76,10 +105,10 @@
   declare_toplevel_type(HeapRegionSetBase)                                    \
   declare_toplevel_type(HeapRegionSetCount)                                   \
   declare_toplevel_type(G1MonitoringSupport)                                  \
+  declare_toplevel_type(PtrQueue)                                             \
                                                                               \
   declare_toplevel_type(G1CollectedHeap*)                                     \
   declare_toplevel_type(HeapRegion*)                                          \
   declare_toplevel_type(G1MonitoringSupport*)                                 \
 
-
 #endif // SHARE_VM_GC_G1_VMSTRUCTS_G1_HPP
--- a/src/share/vm/opto/compile.cpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/share/vm/opto/compile.cpp	Tue Nov 17 16:40:52 2015 -0500
@@ -3549,7 +3549,7 @@
 void Compile::verify_barriers() {
   if (UseG1GC) {
     // Verify G1 pre-barriers
-    const int marking_offset = in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active());
+    const int marking_offset = in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active());
 
     ResourceArea *area = Thread::current()->resource_area();
     Unique_Node_List visited(area);
--- a/src/share/vm/opto/escape.cpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/share/vm/opto/escape.cpp	Tue Nov 17 16:40:52 2015 -0500
@@ -539,11 +539,11 @@
               if (tls->Opcode() == Op_ThreadLocal) {
                 int offs = (int)igvn->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot);
                 if (offs == in_bytes(JavaThread::satb_mark_queue_offset() +
-                                     PtrQueue::byte_offset_of_buf())) {
+                                     SATBMarkQueue::byte_offset_of_buf())) {
                   break; // G1 pre barrier previous oop value store.
                 }
                 if (offs == in_bytes(JavaThread::dirty_card_queue_offset() +
-                                     PtrQueue::byte_offset_of_buf())) {
+                                     DirtyCardQueue::byte_offset_of_buf())) {
                   break; // G1 post barrier card address store.
                 }
               }
--- a/src/share/vm/opto/graphKit.cpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/share/vm/opto/graphKit.cpp	Tue Nov 17 16:40:52 2015 -0500
@@ -3986,16 +3986,16 @@
   float likely  = PROB_LIKELY(0.999);
   float unlikely  = PROB_UNLIKELY(0.999);
 
-  BasicType active_type = in_bytes(PtrQueue::byte_width_of_active()) == 4 ? T_INT : T_BYTE;
-  assert(in_bytes(PtrQueue::byte_width_of_active()) == 4 || in_bytes(PtrQueue::byte_width_of_active()) == 1, "flag width");
+  BasicType active_type = in_bytes(SATBMarkQueue::byte_width_of_active()) == 4 ? T_INT : T_BYTE;
+  assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 4 || in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "flag width");
 
   // Offsets into the thread
   const int marking_offset = in_bytes(JavaThread::satb_mark_queue_offset() +  // 648
-                                          PtrQueue::byte_offset_of_active());
+                                          SATBMarkQueue::byte_offset_of_active());
   const int index_offset   = in_bytes(JavaThread::satb_mark_queue_offset() +  // 656
-                                          PtrQueue::byte_offset_of_index());
+                                          SATBMarkQueue::byte_offset_of_index());
   const int buffer_offset  = in_bytes(JavaThread::satb_mark_queue_offset() +  // 652
-                                          PtrQueue::byte_offset_of_buf());
+                                          SATBMarkQueue::byte_offset_of_buf());
 
   // Now the actual pointers into the thread
   Node* marking_adr = __ AddP(no_base, tls, __ ConX(marking_offset));
@@ -4008,7 +4008,7 @@
   // if (!marking)
   __ if_then(marking, BoolTest::ne, zero, unlikely); {
     BasicType index_bt = TypeX_X->basic_type();
-    assert(sizeof(size_t) == type2aelembytes(index_bt), "Loading G1 PtrQueue::_index with wrong size.");
+    assert(sizeof(size_t) == type2aelembytes(index_bt), "Loading G1 SATBMarkQueue::_index with wrong size.");
     Node* index   = __ load(__ ctrl(), index_adr, TypeX_X, index_bt, Compile::AliasIdxRaw);
 
     if (do_load) {
@@ -4196,9 +4196,9 @@
 
   // Offsets into the thread
   const int index_offset  = in_bytes(JavaThread::dirty_card_queue_offset() +
-                                     PtrQueue::byte_offset_of_index());
+                                     DirtyCardQueue::byte_offset_of_index());
   const int buffer_offset = in_bytes(JavaThread::dirty_card_queue_offset() +
-                                     PtrQueue::byte_offset_of_buf());
+                                     DirtyCardQueue::byte_offset_of_buf());
 
   // Pointers into the thread
 
--- a/src/share/vm/opto/macro.cpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/share/vm/opto/macro.cpp	Tue Nov 17 16:40:52 2015 -0500
@@ -290,7 +290,7 @@
             cmpx->in(1)->is_Load()) {
           Node* adr = cmpx->in(1)->as_Load()->in(MemNode::Address);
           const int marking_offset = in_bytes(JavaThread::satb_mark_queue_offset() +
-                                              PtrQueue::byte_offset_of_active());
+                                              SATBMarkQueue::byte_offset_of_active());
           if (adr->is_AddP() && adr->in(AddPNode::Base) == top() &&
               adr->in(AddPNode::Address)->Opcode() == Op_ThreadLocal &&
               adr->in(AddPNode::Offset) == MakeConX(marking_offset)) {
--- a/src/share/vm/runtime/vmStructs.cpp	Tue Nov 17 12:37:55 2015 +0000
+++ b/src/share/vm/runtime/vmStructs.cpp	Tue Nov 17 16:40:52 2015 -0500
@@ -1378,10 +1378,6 @@
   nonstatic_field(vframeArrayElement,          _bci,                                          int)                                   \
   nonstatic_field(vframeArrayElement,          _method,                                       Method*)                               \
                                                                                                                                      \
-  nonstatic_field(PtrQueue,                    _active,                                       bool)                                  \
-  nonstatic_field(PtrQueue,                    _buf,                                          void**)                                \
-  nonstatic_field(PtrQueue,                    _index,                                        size_t)                                \
-                                                                                                                                     \
   nonstatic_field(AccessFlags,                 _flags,                                        jint)                                  \
   nonstatic_field(elapsedTimer,                _counter,                                      jlong)                                 \
   nonstatic_field(elapsedTimer,                _active,                                       bool)                                  \
@@ -2273,8 +2269,6 @@
   /* Miscellaneous types */                                               \
   /***************/                                                       \
                                                                           \
-  declare_toplevel_type(PtrQueue)                                         \
-                                                                          \
   /* freelist */                                                          \
   declare_toplevel_type(FreeChunk*)                                       \
   declare_toplevel_type(AdaptiveFreeList<FreeChunk>*)                     \
@@ -3066,6 +3060,9 @@
 #define GENERATE_VM_INT_CONSTANT_ENTRY(name) \
  { QUOTE(name), (int32_t) name },
 
+#define GENERATE_VM_INT_CONSTANT_WITH_VALUE_ENTRY(name, value) \
+ { (name), (int32_t)(value) },
+
 #define GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY(name, value) \
  { name, (int32_t) value },
 
@@ -3296,6 +3293,9 @@
   VM_INT_CONSTANTS_CMS(GENERATE_VM_INT_CONSTANT_ENTRY)
 
   VM_INT_CONSTANTS_PARNEW(GENERATE_VM_INT_CONSTANT_ENTRY)
+
+  VM_INT_CONSTANTS_G1(GENERATE_VM_INT_CONSTANT_ENTRY,
+                      GENERATE_VM_INT_CONSTANT_WITH_VALUE_ENTRY)
 #endif // INCLUDE_ALL_GCS
 
 #if INCLUDE_TRACE