Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8285739

disable EscapeBarrier deopt for virtual threads

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 19, repo-loom
    • Fix Version/s: 19
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b24

      Description

      We need to find out how to disable escape analysis when both JVMTI and Preview are enabled.
      There are several spots where EA is used.

      src/hotspot/share/prims/jvmtiTagMap.cpp (Heap Walking API implementation):

      // Deprecated function to iterate over all objects in the heap
      void JvmtiTagMap::iterate_over_heap(jvmtiHeapObjectFilter object_filter,
                                          Klass* klass,
                                          jvmtiHeapObjectCallback heap_object_callback,
                                          const void* user_data)
      {
        // EA based optimizations on tagged objects are already reverted.
        EscapeBarrier eb(object_filter == JVMTI_HEAP_OBJECT_UNTAGGED ||
                         object_filter == JVMTI_HEAP_OBJECT_EITHER,
                         JavaThread::current());
        eb.deoptimize_objects_all_threads();
        . . .

      // Iterates over all objects in the heap
      void JvmtiTagMap::iterate_through_heap(jint heap_filter,
                          Klass* klass,
                          const jvmtiHeapCallbacks* callbacks,
                          const void* user_data)
      {
       // EA based optimizations on tagged objects are already reverted.
       EscapeBarrier eb(false, JavaThread::current()); // disable due to virtual threads
       eb.deoptimize_objects_all_threads();
       . . .

      // iterate over all objects that are reachable from a set of roots
      void JvmtiTagMap::iterate_over_reachable_objects(jvmtiHeapRootCallback heap_root_callback,
                               jvmtiStackReferenceCallback stack_ref_callback,
                               jvmtiObjectReferenceCallback object_ref_callback,
                               const void* user_data) {
       JavaThread* jt = JavaThread::current();
       EscapeBarrier eb(true, jt);
       . . .

      void JvmtiTagMap::follow_references(jint heap_filter,
                                          Klass* klass,
                                          jobject object,
                                          const jvmtiHeapCallbacks* callbacks,
                                          const void* user_data)
      {
        . . .
        // EA based optimizations that are tagged or reachable from initial_object are already reverted.
        EscapeBarrier eb(initial_object.is_null() &&

      src/hotspot/share/prims/jvmtiImpl.hpp (implementation GetLocal/SetLocal):

      class VM_GetOrSetLocal : public VM_BaseGetOrSetLocal {
       protected:
        JavaThread* _thread;
        EscapeBarrier _eb;
        . . .

      src/hotspot/share/prims/jvmtiEnvBase.cpp (ForceEarlyReturn implementation):

      jvmtiError
      JvmtiEnvBase::force_early_return(jthread thread, jvalue value, TosState tos) {
        . . .
        // Eagerly reallocate scalar replaced objects.
        EscapeBarrier eb(true, current_thread, java_thread);
        . . .

      src/hotspot/share/prims/jvmtiEnv.cpp (implementation of GetOwnedMonitorInfo, GetOwnedMonitorStackDepthInfo and PopFrame):

      JvmtiEnv::GetOwnedMonitorInfo(jthread thread, jint* owned_monitor_count_ptr, jobject** owned_monitors_ptr) {
          . . .
          EscapeBarrier eb(true, calling_thread, java_thread);
        . . .

      JvmtiEnv::GetOwnedMonitorStackDepthInfo(jthread thread, jint* monitor_info_count_ptr, jvmtiMonitorStackDepthInfo** monitor_info_ptr) {
        . . .
          EscapeBarrier eb(true, calling_thread, java_thread);
        . . .

      JvmtiEnv::PopFrame(jthread thread) {
        . . .
        // Eagerly reallocate scalar replaced objects.
        EscapeBarrier eb(true, current_thread, java_thread);
        . . .

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              lmesnik Leonid Mesnik
              Reporter:
              sspitsyn Serguei Spitsyn
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: