< prev index next >

src/hotspot/share/runtime/javaThread.hpp

Print this page
@@ -478,10 +478,12 @@
    // It's signed for error detection.
    intx _held_monitor_count;  // used by continuations for fast lock detection
    intx _jni_monitor_count;
    ObjectMonitor* _unlocked_inflated_monitor;
  
+   bool _can_call_java;
+ 
    // This is the field we poke in the interpreter and native
    // wrapper (Object.wait) to check for preemption.
    address _preempt_alternate_return;
    // When preempting on monitorenter we could have acquired the
    // monitor after freezing all vthread frames. In that case we

@@ -552,13 +554,26 @@
    };
    void exit(bool destroy_vm, ExitType exit_type = normal_exit);
  
    void cleanup_failed_attach_current_thread(bool is_daemon);
  
+   class NoJavaCodeMark : public StackObj {
+     friend JavaThread;
+     JavaThread* _target;
+     bool _orig;
+    public:
+     NoJavaCodeMark(JavaThread* t) : _target(t), _orig(t->_can_call_java) {
+       _target->_can_call_java = false;
+     }
+     ~NoJavaCodeMark() {
+       _target->_can_call_java = _orig;
+     }
+   };
+ 
    // Testers
    virtual bool is_Java_thread() const            { return true;  }
-   virtual bool can_call_java() const             { return true; }
+   virtual bool can_call_java() const             { return _can_call_java; }
  
    virtual bool is_active_Java_thread() const;
  
    // Thread oop. threadObj() can be null for initial JavaThread
    // (or for threads attached via JNI)

@@ -1027,10 +1042,12 @@
    // Print current stack trace for checked JNI warnings and JNI fatal errors.
    // This is the external format from above, but selecting the platform
    // or vthread as applicable.
    void print_jni_stack();
  
+   void print_native_stack_on(outputStream* st);
+ 
    // Print stack traces in various internal formats
    void trace_stack()                             PRODUCT_RETURN;
    void trace_stack_from(vframe* start_vf)        PRODUCT_RETURN;
    void trace_frames()                            PRODUCT_RETURN;
  

@@ -1209,12 +1226,13 @@
    // Track the class we want to initialize but for which we have to wait
    // on its init_lock() because it is already being initialized.
    void set_class_to_be_initialized(InstanceKlass* k);
    InstanceKlass* class_to_be_initialized() const;
  
-   // Track executing class initializer, see ThreadInClassInitializer
-   void set_class_being_initialized(InstanceKlass* k);
+   // The most recent active <clinit> invocation is tracked by this variable.
+   // The setter returns the previous value, so it can be restored later if needed.
+   InstanceKlass* set_class_being_initialized(InstanceKlass* k);
    InstanceKlass* class_being_initialized() const;
  
  private:
    InstanceKlass* _class_to_be_initialized;
    InstanceKlass* _class_being_initialized;
< prev index next >