< prev index next >

src/hotspot/share/runtime/thread.cpp

Print this page

  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/iterator.hpp"
  51 #include "memory/metaspaceShared.hpp"
  52 #include "memory/oopFactory.hpp"
  53 #include "memory/resourceArea.hpp"
  54 #include "memory/universe.hpp"
  55 #include "oops/access.inline.hpp"
  56 #include "oops/instanceKlass.hpp"
  57 #include "oops/objArrayOop.hpp"
  58 #include "oops/oop.inline.hpp"
  59 #include "oops/symbol.hpp"
  60 #include "oops/typeArrayOop.inline.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/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"
  80 #include "runtime/jniPeriodicChecker.hpp"

1620 void JavaThread::resize_all_jvmci_counters(int new_size) {
1621   VM_JVMCIResizeCounters op(new_size);
1622   VMThread::execute(&op);
1623 }
1624 
1625 #endif // INCLUDE_JVMCI
1626 
1627 // A JavaThread is a normal Java thread
1628 
1629 void JavaThread::initialize() {
1630   // Initialize fields
1631 
1632   set_saved_exception_pc(NULL);
1633   set_threadObj(NULL);
1634   _anchor.clear();
1635   set_entry_point(NULL);
1636   set_jni_functions(jni_functions());
1637   set_callee_target(NULL);
1638   set_vm_result(NULL);
1639   set_vm_result_2(NULL);

1640   set_vframe_array_head(NULL);
1641   set_vframe_array_last(NULL);
1642   set_deferred_locals(NULL);
1643   set_deopt_mark(NULL);
1644   set_deopt_compiled_method(NULL);
1645   set_monitor_chunks(NULL);
1646   _on_thread_list = false;
1647   _thread_state = _thread_new;
1648   _terminated = _not_terminated;
1649   _array_for_gc = NULL;
1650   _suspend_equivalent = false;
1651   _in_deopt_handler = 0;
1652   _doing_unsafe_access = false;
1653   _stack_guard_state = stack_guard_unused;
1654 #if INCLUDE_JVMCI
1655   _pending_monitorenter = false;
1656   _pending_deoptimization = -1;
1657   _pending_failed_speculation = 0;
1658   _pending_transfer_to_interpreter = false;
1659   _in_retryable_allocation = false;

2825   guarantee(base < os::current_stack_pointer(), "Error calculating stack red zone");
2826 
2827   if (!os::guard_memory((char *) base, stack_red_zone_size())) {
2828     warning("Attempt to guard stack red zone failed.");
2829   }
2830 }
2831 
2832 void JavaThread::disable_stack_red_zone() {
2833   // The base notation is from the stacks point of view, growing downward.
2834   // We need to adjust it to work correctly with guard_memory()
2835   assert(_stack_guard_state != stack_guard_unused, "must be using guard pages.");
2836   address base = stack_red_zone_base() - stack_red_zone_size();
2837   if (!os::unguard_memory((char *)base, stack_red_zone_size())) {
2838     warning("Attempt to unguard stack red zone failed.");
2839   }
2840 }
2841 
2842 void JavaThread::frames_do(void f(frame*, const RegisterMap* map)) {
2843   // ignore is there is no stack
2844   if (!has_last_Java_frame()) return;



2845   // traverse the stack frames. Starts from top frame.
2846   for (StackFrameStream fst(this); !fst.is_done(); fst.next()) {
2847     frame* fr = fst.current();
2848     f(fr, fst.register_map());
2849   }
2850 }
2851 
2852 
2853 #ifndef PRODUCT
2854 // Deoptimization
2855 // Function for testing deoptimization
2856 void JavaThread::deoptimize() {
2857   StackFrameStream fst(this, false);
2858   bool deopt = false;           // Dump stack only if a deopt actually happens.
2859   bool only_at = strlen(DeoptimizeOnlyAt) > 0;
2860   // Iterate over all frames in the thread and deoptimize
2861   for (; !fst.is_done(); fst.next()) {
2862     if (fst.current()->can_be_deoptimized()) {
2863 
2864       if (only_at) {

  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/iterator.hpp"
  51 #include "memory/metaspaceShared.hpp"
  52 #include "memory/oopFactory.hpp"
  53 #include "memory/resourceArea.hpp"
  54 #include "memory/universe.hpp"
  55 #include "oops/access.inline.hpp"
  56 #include "oops/instanceKlass.hpp"
  57 #include "oops/objArrayOop.hpp"
  58 #include "oops/oop.inline.hpp"
  59 #include "oops/symbol.hpp"
  60 #include "oops/typeArrayOop.inline.hpp"
  61 #include "oops/inlineKlass.hpp"
  62 #include "oops/verifyOopClosure.hpp"
  63 #include "prims/jvm_misc.hpp"
  64 #include "prims/jvmtiExport.hpp"
  65 #include "prims/jvmtiThreadState.hpp"
  66 #include "runtime/arguments.hpp"
  67 #include "runtime/atomic.hpp"
  68 #include "runtime/biasedLocking.hpp"
  69 #include "runtime/fieldDescriptor.inline.hpp"
  70 #include "runtime/flags/jvmFlagConstraintList.hpp"
  71 #include "runtime/flags/jvmFlagRangeList.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"
  81 #include "runtime/jniPeriodicChecker.hpp"

1621 void JavaThread::resize_all_jvmci_counters(int new_size) {
1622   VM_JVMCIResizeCounters op(new_size);
1623   VMThread::execute(&op);
1624 }
1625 
1626 #endif // INCLUDE_JVMCI
1627 
1628 // A JavaThread is a normal Java thread
1629 
1630 void JavaThread::initialize() {
1631   // Initialize fields
1632 
1633   set_saved_exception_pc(NULL);
1634   set_threadObj(NULL);
1635   _anchor.clear();
1636   set_entry_point(NULL);
1637   set_jni_functions(jni_functions());
1638   set_callee_target(NULL);
1639   set_vm_result(NULL);
1640   set_vm_result_2(NULL);
1641   set_return_buffered_value(NULL);
1642   set_vframe_array_head(NULL);
1643   set_vframe_array_last(NULL);
1644   set_deferred_locals(NULL);
1645   set_deopt_mark(NULL);
1646   set_deopt_compiled_method(NULL);
1647   set_monitor_chunks(NULL);
1648   _on_thread_list = false;
1649   _thread_state = _thread_new;
1650   _terminated = _not_terminated;
1651   _array_for_gc = NULL;
1652   _suspend_equivalent = false;
1653   _in_deopt_handler = 0;
1654   _doing_unsafe_access = false;
1655   _stack_guard_state = stack_guard_unused;
1656 #if INCLUDE_JVMCI
1657   _pending_monitorenter = false;
1658   _pending_deoptimization = -1;
1659   _pending_failed_speculation = 0;
1660   _pending_transfer_to_interpreter = false;
1661   _in_retryable_allocation = false;

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