changeset 22460:f27c163d7dc2

moved JVMCI fields from ThreadShadow to Thread
author Doug Simon <doug.simon@oracle.com>
date Mon, 24 Aug 2015 22:35:47 +0200
parents 0dd2b79625b3
children 07d9f0909560
files jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotVMConfig.java src/cpu/sparc/vm/sharedRuntime_sparc.cpp src/cpu/sparc/vm/templateInterpreter_sparc.cpp src/cpu/x86/vm/sharedRuntime_x86_64.cpp src/cpu/x86/vm/templateInterpreter_x86_64.cpp src/share/vm/jvmci/vmStructs_jvmci.hpp src/share/vm/runtime/deoptimization.cpp src/share/vm/runtime/thread.cpp src/share/vm/runtime/thread.hpp src/share/vm/runtime/vmStructs.cpp src/share/vm/utilities/exceptions.hpp
diffstat 11 files changed, 37 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotVMConfig.java	Mon Aug 24 10:38:13 2015 -0700
+++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotVMConfig.java	Mon Aug 24 22:35:47 2015 +0200
@@ -942,11 +942,14 @@
     /**
      * This field is used to pass exception objects into and out of the runtime system during
      * exception handling for compiled code.
-     * <p>
-     * <b>NOTE: This is not the same as {@link #pendingExceptionOffset}.</b>
      */
     @HotSpotVMField(name = "JavaThread::_exception_oop", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadExceptionOopOffset;
     @HotSpotVMField(name = "JavaThread::_exception_pc", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int threadExceptionPcOffset;
+    @HotSpotVMField(name = "ThreadShadow::_pending_exception", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingExceptionOffset;
+
+    @HotSpotVMField(name = "JavaThread::_pending_deoptimization", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingDeoptimizationOffset;
+    @HotSpotVMField(name = "JavaThread::_pending_failed_speculation", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingFailedSpeculationOffset;
+    @HotSpotVMField(name = "JavaThread::_pending_transfer_to_interpreter", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingTransferToInterpreterOffset;
 
     @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_sp", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET) @Stable private int javaFrameAnchorLastJavaSpOffset;
     @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_pc", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable private int javaFrameAnchorLastJavaPcOffset;
@@ -1018,17 +1021,6 @@
     }
 
     /**
-     * Offset of the _pending_exception field in ThreadShadow (defined in exceptions.hpp). This
-     * field is used to propagate exceptions through C/C++ calls.
-     * <p>
-     * <b>NOTE: This is not the same as {@link #threadExceptionOopOffset}.</b>
-     */
-    @HotSpotVMField(name = "ThreadShadow::_pending_exception", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingExceptionOffset;
-    @HotSpotVMField(name = "ThreadShadow::_pending_deoptimization", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingDeoptimizationOffset;
-    @HotSpotVMField(name = "ThreadShadow::_pending_failed_speculation", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingFailedSpeculationOffset;
-    @HotSpotVMField(name = "ThreadShadow::_pending_transfer_to_interpreter", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingTransferToInterpreterOffset;
-
-    /**
      * Mark word right shift to get identity hash code.
      */
     @HotSpotVMConstant(name = "markOopDesc::hash_shift") @Stable public int identityHashCodeShift;
--- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Mon Aug 24 10:38:13 2015 -0700
+++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Mon Aug 24 22:35:47 2015 +0200
@@ -3554,9 +3554,9 @@
   __ set_last_Java_frame(SP, NULL);
   masm->block_comment("/set_last_java_frame");
 
-  __ ld(G2_thread, in_bytes(ThreadShadow::pending_deoptimization_offset()), O1);
+  __ ld(G2_thread, in_bytes(JavaThread::pending_deoptimization_offset()), O1);
   __ sub(G0, 1, L1);
-  __ st_ptr(L1, G2_thread, in_bytes(ThreadShadow::pending_deoptimization_offset()));
+  __ st_ptr(L1, G2_thread, in_bytes(JavaThread::pending_deoptimization_offset()));
 
   __ mov((int32_t)Deoptimization::Unpack_reexecute, L0deopt_mode);
   __ mov(G2_thread, O0);
--- a/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Mon Aug 24 10:38:13 2015 -0700
+++ b/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Mon Aug 24 22:35:47 2015 +0200
@@ -209,7 +209,7 @@
     Label L;
 
     //__ cmp(, 0);
-    Address pending_monitor_enter_addr(G2_thread, Thread::pending_monitorenter_offset());
+    Address pending_monitor_enter_addr(G2_thread, JavaThread::pending_monitorenter_offset());
     __ ldbool(pending_monitor_enter_addr, Gtemp);  // Load if pending monitor enter
     __ cmp_and_br_short(Gtemp, G0, Assembler::equal, Assembler::pn, L);
     // Clear flag.
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Mon Aug 24 10:38:13 2015 -0700
+++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Mon Aug 24 22:35:47 2015 +0200
@@ -3405,8 +3405,8 @@
   // fetch_unroll_info needs to call last_java_frame()
   __ set_last_Java_frame(noreg, noreg, NULL);
 
-  __ movl(c_rarg1, Address(r15_thread, in_bytes(ThreadShadow::pending_deoptimization_offset())));
-  __ movl(Address(r15_thread, in_bytes(ThreadShadow::pending_deoptimization_offset())), -1);
+  __ movl(c_rarg1, Address(r15_thread, in_bytes(JavaThread::pending_deoptimization_offset())));
+  __ movl(Address(r15_thread, in_bytes(JavaThread::pending_deoptimization_offset())), -1);
 
   __ movl(r14, (int32_t)Deoptimization::Unpack_reexecute);
   __ mov(c_rarg0, r15_thread);
--- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Mon Aug 24 10:38:13 2015 -0700
+++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Mon Aug 24 22:35:47 2015 +0200
@@ -208,10 +208,10 @@
   // Check if we need to take lock at entry of synchronized method.
   {
     Label L;
-    __ cmpb(Address(r15_thread, Thread::pending_monitorenter_offset()), 0);
+    __ cmpb(Address(r15_thread, JavaThread::pending_monitorenter_offset()), 0);
     __ jcc(Assembler::zero, L);
     // Clear flag.
-    __ movb(Address(r15_thread, Thread::pending_monitorenter_offset()), 0);
+    __ movb(Address(r15_thread, JavaThread::pending_monitorenter_offset()), 0);
     // Satisfy calling convention for lock_method().
     __ get_method(rbx);
     // Take lock.
--- a/src/share/vm/jvmci/vmStructs_jvmci.hpp	Mon Aug 24 10:38:13 2015 -0700
+++ b/src/share/vm/jvmci/vmStructs_jvmci.hpp	Mon Aug 24 22:35:47 2015 +0200
@@ -31,9 +31,9 @@
 #include "jvmci/jvmciEnv.hpp"
 
 #define VM_STRUCTS_JVMCI(nonstatic_field, static_field)                       \
-  nonstatic_field(ThreadShadow,  _pending_deoptimization, int)                \
-  nonstatic_field(ThreadShadow,  _pending_failed_speculation, oop)            \
-  nonstatic_field(ThreadShadow,  _pending_transfer_to_interpreter, bool)      \
+  nonstatic_field(JavaThread,    _pending_deoptimization, int)                \
+  nonstatic_field(JavaThread,    _pending_failed_speculation, oop)            \
+  nonstatic_field(JavaThread,    _pending_transfer_to_interpreter, bool)      \
   nonstatic_field(MethodData,    _jvmci_ir_size, int)                         \
   nonstatic_field(JVMCIEnv,      _task, CompileTask*)                         \
   nonstatic_field(JVMCIEnv,      _jvmti_can_hotswap_or_post_breakpoint, bool) \
--- a/src/share/vm/runtime/deoptimization.cpp	Mon Aug 24 10:38:13 2015 -0700
+++ b/src/share/vm/runtime/deoptimization.cpp	Mon Aug 24 22:35:47 2015 +0200
@@ -1505,7 +1505,7 @@
 
     if (trap_bci == SynchronizationEntryBCI) {
       trap_bci = 0;
-      Thread::current()->set_pending_monitorenter(true);
+      thread->set_pending_monitorenter(true);
     }
 
     if (reason == Deoptimization::Reason_transfer_to_interpreter) {
--- a/src/share/vm/runtime/thread.cpp	Mon Aug 24 10:38:13 2015 -0700
+++ b/src/share/vm/runtime/thread.cpp	Mon Aug 24 22:35:47 2015 +0200
@@ -843,9 +843,6 @@
   active_handles()->oops_do(f);
   // Do oop for ThreadShadow
   f->do_oop((oop*)&_pending_exception);
-#if INCLUDE_JVMCI
-  f->do_oop((oop*)&_pending_failed_speculation);
-#endif
   handle_area()->oops_do(f);
 }
 
@@ -1487,6 +1484,10 @@
   _doing_unsafe_access = false;
   _stack_guard_state = stack_guard_unused;
 #if INCLUDE_JVMCI
+  _pending_monitorenter = false;
+  _pending_deoptimization = -1;
+  _pending_failed_speculation = NULL;
+  _pending_transfer_to_interpreter = false;
   _jvmci_alternate_call_target = NULL;
   _jvmci_implicit_exception_pc = NULL;
   if (JVMCICounterSize > 0) {
@@ -2782,6 +2783,8 @@
   // Traverse the GCHandles
   Thread::oops_do(f, cld_f, cf);
 
+  JVMCI_ONLY(f->do_oop((oop*)&_pending_failed_speculation);)
+
   assert( (!has_last_Java_frame() && java_call_counter() == 0) ||
           (has_last_Java_frame() && java_call_counter() > 0), "wrong java_sp info!");
 
--- a/src/share/vm/runtime/thread.hpp	Mon Aug 24 10:38:13 2015 -0700
+++ b/src/share/vm/runtime/thread.hpp	Mon Aug 24 22:35:47 2015 +0200
@@ -917,6 +917,10 @@
  private:
 
 #if INCLUDE_JVMCI
+  int       _pending_deoptimization;
+  oop       _pending_failed_speculation;
+  bool      _pending_monitorenter;
+  bool      _pending_transfer_to_interpreter;
   address   _jvmci_alternate_call_target;
   address   _jvmci_implicit_exception_pc;    // pc at which the most recent implicit exception occurred
 
@@ -1303,6 +1307,13 @@
   void set_deferred_card_mark(MemRegion mr)      { _deferred_card_mark = mr;   }
 
 #if INCLUDE_JVMCI
+  int  pending_deoptimization() const             { return _pending_deoptimization; }
+  oop  pending_failed_speculation() const         { return _pending_failed_speculation; }
+  bool has_pending_monitorenter() const           { return _pending_monitorenter; }
+  void set_pending_monitorenter(bool b)           { _pending_monitorenter = b; }
+  void set_pending_deoptimization(int reason)     { _pending_deoptimization = reason; }
+  void set_pending_failed_speculation(oop failed_speculation) { _pending_failed_speculation = failed_speculation; }
+  void set_pending_transfer_to_interpreter(bool b) { _pending_transfer_to_interpreter = b; }
   void set_jvmci_alternate_call_target(address a) { _jvmci_alternate_call_target = a; }
   void set_jvmci_implicit_exception_pc(address a) { _jvmci_implicit_exception_pc = a; }
 #endif
@@ -1401,6 +1412,9 @@
   static ByteSize saved_exception_pc_offset()    { return byte_offset_of(JavaThread, _saved_exception_pc  ); }
   static ByteSize osthread_offset()              { return byte_offset_of(JavaThread, _osthread            ); }
 #if INCLUDE_JVMCI
+  static ByteSize pending_deoptimization_offset() { return byte_offset_of(JavaThread, _pending_deoptimization); }
+  static ByteSize pending_monitorenter_offset()  { return byte_offset_of(JavaThread, _pending_monitorenter); }
+  static ByteSize pending_failed_speculation_offset() { return byte_offset_of(JavaThread, _pending_failed_speculation); }
   static ByteSize jvmci_alternate_call_target_offset() { return byte_offset_of(JavaThread, _jvmci_alternate_call_target); }
   static ByteSize jvmci_implicit_exception_pc_offset() { return byte_offset_of(JavaThread, _jvmci_implicit_exception_pc); }
   static ByteSize jvmci_counters_offset()        { return byte_offset_of(JavaThread, _jvmci_counters      ); }
--- a/src/share/vm/runtime/vmStructs.cpp	Mon Aug 24 10:38:13 2015 -0700
+++ b/src/share/vm/runtime/vmStructs.cpp	Mon Aug 24 22:35:47 2015 +0200
@@ -3497,7 +3497,7 @@
 
 
 #if INCLUDE_JVMCI
-// Emit intialization code for HotSpotVMConfig.  It's placed here so
+// Emit initialization code for HotSpotVMConfig.  It's placed here so
 // it can take advantage of the relaxed access checking enjoyed by
 // VMStructs.
 #include "HotSpotVMConfig.inline.hpp"
--- a/src/share/vm/utilities/exceptions.hpp	Mon Aug 24 10:38:13 2015 -0700
+++ b/src/share/vm/utilities/exceptions.hpp	Mon Aug 24 22:35:47 2015 +0200
@@ -61,12 +61,6 @@
   friend class VMStructs;
 
  protected:
-#if INCLUDE_JVMCI
-  int _pending_deoptimization;
-  oop _pending_failed_speculation;
-  bool _pending_monitorenter;
-  bool _pending_transfer_to_interpreter;
-#endif
   oop  _pending_exception;                       // Thread has gc actions.
   const char* _exception_file;                   // file information for exception (debugging only)
   int         _exception_line;                   // line information for exception (debugging only)
@@ -85,24 +79,9 @@
   bool has_pending_exception() const             { return _pending_exception != NULL; }
   const char* exception_file() const             { return _exception_file; }
   int  exception_line() const                    { return _exception_line; }
-#if INCLUDE_JVMCI
-  int  pending_deoptimization() const            { return _pending_deoptimization; }
-  oop  pending_failed_speculation() const        { return _pending_failed_speculation; }
-  bool has_pending_monitorenter() const          { return _pending_monitorenter; }
-#endif
 
   // Code generation support
   static ByteSize pending_exception_offset()     { return byte_offset_of(ThreadShadow, _pending_exception); }
-#if INCLUDE_JVMCI
-  static ByteSize pending_deoptimization_offset() { return byte_offset_of(ThreadShadow, _pending_deoptimization); }
-  static ByteSize pending_monitorenter_offset()  { return byte_offset_of(ThreadShadow, _pending_monitorenter); }
-  static ByteSize pending_failed_speculation_offset() { return byte_offset_of(ThreadShadow, _pending_failed_speculation); }
-
-  void set_pending_monitorenter(bool b)          { _pending_monitorenter = b; }
-  void set_pending_deoptimization(int reason)    { _pending_deoptimization = reason; }
-  void set_pending_failed_speculation(oop failed_speculation)    { _pending_failed_speculation = failed_speculation; }
-  void set_pending_transfer_to_interpreter(bool b) { _pending_transfer_to_interpreter = b; }
-#endif
 
   // use THROW whenever possible!
   void set_pending_exception(oop exception, const char* file, int line);
@@ -112,9 +91,6 @@
 
   ThreadShadow() : _pending_exception(NULL),
                    _exception_file(NULL), _exception_line(0)
-#if INCLUDE_JVMCI
-                   , _pending_monitorenter(false), _pending_deoptimization(-1), _pending_failed_speculation(NULL), _pending_transfer_to_interpreter(false)
-#endif
   {}
 };