< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page




  40 #include "gc/shared/workgroup.hpp"
  41 #include "interpreter/interpreter.hpp"
  42 #include "interpreter/linkResolver.hpp"
  43 #include "interpreter/oopMapCache.hpp"
  44 #include "jfr/jfrEvents.hpp"
  45 #include "jvmtifiles/jvmtiEnv.hpp"
  46 #include "logging/log.hpp"
  47 #include "logging/logConfiguration.hpp"
  48 #include "logging/logStream.hpp"
  49 #include "memory/allocation.inline.hpp"
  50 #include "memory/metaspaceShared.hpp"
  51 #include "memory/oopFactory.hpp"
  52 #include "memory/resourceArea.hpp"
  53 #include "memory/universe.hpp"
  54 #include "oops/access.inline.hpp"
  55 #include "oops/instanceKlass.hpp"
  56 #include "oops/objArrayOop.hpp"
  57 #include "oops/oop.inline.hpp"
  58 #include "oops/symbol.hpp"
  59 #include "oops/typeArrayOop.inline.hpp"

  60 #include "oops/verifyOopClosure.hpp"
  61 #include "prims/jvm_misc.hpp"
  62 #include "prims/jvmtiExport.hpp"
  63 #include "prims/jvmtiThreadState.hpp"
  64 #include "runtime/arguments.hpp"
  65 #include "runtime/atomic.hpp"
  66 #include "runtime/biasedLocking.hpp"
  67 #include "runtime/fieldDescriptor.inline.hpp"
  68 #include "runtime/flags/jvmFlagConstraintList.hpp"
  69 #include "runtime/flags/jvmFlagRangeList.hpp"
  70 #include "runtime/flags/jvmFlagWriteableList.hpp"
  71 #include "runtime/deoptimization.hpp"
  72 #include "runtime/frame.inline.hpp"
  73 #include "runtime/handles.inline.hpp"
  74 #include "runtime/handshake.hpp"
  75 #include "runtime/init.hpp"
  76 #include "runtime/interfaceSupport.inline.hpp"
  77 #include "runtime/java.hpp"
  78 #include "runtime/javaCalls.hpp"
  79 #include "runtime/jniHandles.inline.hpp"


1662   VM_JVMCIResizeCounters op(new_size);
1663   VMThread::execute(&op);
1664   return !op.failed();
1665 }
1666 
1667 #endif // INCLUDE_JVMCI
1668 
1669 // A JavaThread is a normal Java thread
1670 
1671 void JavaThread::initialize() {
1672   // Initialize fields
1673 
1674   set_saved_exception_pc(NULL);
1675   set_threadObj(NULL);
1676   _anchor.clear();
1677   set_entry_point(NULL);
1678   set_jni_functions(jni_functions());
1679   set_callee_target(NULL);
1680   set_vm_result(NULL);
1681   set_vm_result_2(NULL);

1682   set_vframe_array_head(NULL);
1683   set_vframe_array_last(NULL);
1684   set_deferred_locals(NULL);
1685   set_deopt_mark(NULL);
1686   set_deopt_compiled_method(NULL);
1687   clear_must_deopt_id();
1688   set_monitor_chunks(NULL);
1689   _on_thread_list = false;
1690   set_thread_state(_thread_new);
1691   _terminated = _not_terminated;
1692   _array_for_gc = NULL;
1693   _suspend_equivalent = false;
1694   _in_deopt_handler = 0;
1695   _doing_unsafe_access = false;
1696   _stack_guard_state = stack_guard_unused;
1697 #if INCLUDE_JVMCI
1698   _pending_monitorenter = false;
1699   _pending_deoptimization = -1;
1700   _pending_failed_speculation = 0;
1701   _pending_transfer_to_interpreter = false;


2812   guarantee(base < os::current_stack_pointer(), "Error calculating stack red zone");
2813 
2814   if (!os::guard_memory((char *) base, stack_red_zone_size())) {
2815     warning("Attempt to guard stack red zone failed.");
2816   }
2817 }
2818 
2819 void JavaThread::disable_stack_red_zone() {
2820   // The base notation is from the stacks point of view, growing downward.
2821   // We need to adjust it to work correctly with guard_memory()
2822   assert(_stack_guard_state != stack_guard_unused, "must be using guard pages.");
2823   address base = stack_red_zone_base() - stack_red_zone_size();
2824   if (!os::unguard_memory((char *)base, stack_red_zone_size())) {
2825     warning("Attempt to unguard stack red zone failed.");
2826   }
2827 }
2828 
2829 void JavaThread::frames_do(void f(frame*, const RegisterMap* map)) {
2830   // ignore is there is no stack
2831   if (!has_last_Java_frame()) return;



2832   // traverse the stack frames. Starts from top frame.
2833   for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
2834     frame* fr = fst.current();
2835     f(fr, fst.register_map());
2836   }
2837 }
2838 
2839 
2840 #ifndef PRODUCT
2841 // Deoptimization
2842 // Function for testing deoptimization
2843 void JavaThread::deoptimize() {
2844   // BiasedLocking needs an updated RegisterMap for the revoke monitors pass
2845   StackFrameStream fst(this, UseBiasedLocking);
2846   bool deopt = false;           // Dump stack only if a deopt actually happens.
2847   bool only_at = strlen(DeoptimizeOnlyAt) > 0;
2848   // Iterate over all frames in the thread and deoptimize
2849   for (; !fst.is_done(); fst.next()) {
2850     if (fst.current()->can_be_deoptimized()) {
2851 




  40 #include "gc/shared/workgroup.hpp"
  41 #include "interpreter/interpreter.hpp"
  42 #include "interpreter/linkResolver.hpp"
  43 #include "interpreter/oopMapCache.hpp"
  44 #include "jfr/jfrEvents.hpp"
  45 #include "jvmtifiles/jvmtiEnv.hpp"
  46 #include "logging/log.hpp"
  47 #include "logging/logConfiguration.hpp"
  48 #include "logging/logStream.hpp"
  49 #include "memory/allocation.inline.hpp"
  50 #include "memory/metaspaceShared.hpp"
  51 #include "memory/oopFactory.hpp"
  52 #include "memory/resourceArea.hpp"
  53 #include "memory/universe.hpp"
  54 #include "oops/access.inline.hpp"
  55 #include "oops/instanceKlass.hpp"
  56 #include "oops/objArrayOop.hpp"
  57 #include "oops/oop.inline.hpp"
  58 #include "oops/symbol.hpp"
  59 #include "oops/typeArrayOop.inline.hpp"
  60 #include "oops/valueKlass.hpp"
  61 #include "oops/verifyOopClosure.hpp"
  62 #include "prims/jvm_misc.hpp"
  63 #include "prims/jvmtiExport.hpp"
  64 #include "prims/jvmtiThreadState.hpp"
  65 #include "runtime/arguments.hpp"
  66 #include "runtime/atomic.hpp"
  67 #include "runtime/biasedLocking.hpp"
  68 #include "runtime/fieldDescriptor.inline.hpp"
  69 #include "runtime/flags/jvmFlagConstraintList.hpp"
  70 #include "runtime/flags/jvmFlagRangeList.hpp"
  71 #include "runtime/flags/jvmFlagWriteableList.hpp"
  72 #include "runtime/deoptimization.hpp"
  73 #include "runtime/frame.inline.hpp"
  74 #include "runtime/handles.inline.hpp"
  75 #include "runtime/handshake.hpp"
  76 #include "runtime/init.hpp"
  77 #include "runtime/interfaceSupport.inline.hpp"
  78 #include "runtime/java.hpp"
  79 #include "runtime/javaCalls.hpp"
  80 #include "runtime/jniHandles.inline.hpp"


1663   VM_JVMCIResizeCounters op(new_size);
1664   VMThread::execute(&op);
1665   return !op.failed();
1666 }
1667 
1668 #endif // INCLUDE_JVMCI
1669 
1670 // A JavaThread is a normal Java thread
1671 
1672 void JavaThread::initialize() {
1673   // Initialize fields
1674 
1675   set_saved_exception_pc(NULL);
1676   set_threadObj(NULL);
1677   _anchor.clear();
1678   set_entry_point(NULL);
1679   set_jni_functions(jni_functions());
1680   set_callee_target(NULL);
1681   set_vm_result(NULL);
1682   set_vm_result_2(NULL);
1683   set_return_buffered_value(NULL);
1684   set_vframe_array_head(NULL);
1685   set_vframe_array_last(NULL);
1686   set_deferred_locals(NULL);
1687   set_deopt_mark(NULL);
1688   set_deopt_compiled_method(NULL);
1689   clear_must_deopt_id();
1690   set_monitor_chunks(NULL);
1691   _on_thread_list = false;
1692   set_thread_state(_thread_new);
1693   _terminated = _not_terminated;
1694   _array_for_gc = NULL;
1695   _suspend_equivalent = false;
1696   _in_deopt_handler = 0;
1697   _doing_unsafe_access = false;
1698   _stack_guard_state = stack_guard_unused;
1699 #if INCLUDE_JVMCI
1700   _pending_monitorenter = false;
1701   _pending_deoptimization = -1;
1702   _pending_failed_speculation = 0;
1703   _pending_transfer_to_interpreter = false;


2814   guarantee(base < os::current_stack_pointer(), "Error calculating stack red zone");
2815 
2816   if (!os::guard_memory((char *) base, stack_red_zone_size())) {
2817     warning("Attempt to guard stack red zone failed.");
2818   }
2819 }
2820 
2821 void JavaThread::disable_stack_red_zone() {
2822   // The base notation is from the stacks point of view, growing downward.
2823   // We need to adjust it to work correctly with guard_memory()
2824   assert(_stack_guard_state != stack_guard_unused, "must be using guard pages.");
2825   address base = stack_red_zone_base() - stack_red_zone_size();
2826   if (!os::unguard_memory((char *)base, stack_red_zone_size())) {
2827     warning("Attempt to unguard stack red zone failed.");
2828   }
2829 }
2830 
2831 void JavaThread::frames_do(void f(frame*, const RegisterMap* map)) {
2832   // ignore is there is no stack
2833   if (!has_last_Java_frame()) return;
2834   // Because this method is used to verify oops, it must support
2835   // oops in buffered values
2836 
2837   // traverse the stack frames. Starts from top frame.
2838   for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
2839     frame* fr = fst.current();
2840     f(fr, fst.register_map());
2841   }
2842 }
2843 
2844 
2845 #ifndef PRODUCT
2846 // Deoptimization
2847 // Function for testing deoptimization
2848 void JavaThread::deoptimize() {
2849   // BiasedLocking needs an updated RegisterMap for the revoke monitors pass
2850   StackFrameStream fst(this, UseBiasedLocking);
2851   bool deopt = false;           // Dump stack only if a deopt actually happens.
2852   bool only_at = strlen(DeoptimizeOnlyAt) > 0;
2853   // Iterate over all frames in the thread and deoptimize
2854   for (; !fst.is_done(); fst.next()) {
2855     if (fst.current()->can_be_deoptimized()) {
2856 


< prev index next >