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

Don't use CodeCache for allocations if it is already full

    Details

    • Subcomponent:
    • Resolved In Build:
      b110
    • CPU:
      sparc
    • OS:
      solaris_10
    • Verification:
      Not verified

      Backports

        Description

        The failure examples in 7008325 show that even when CodeCache is full and compilation is switched off VM still trying to allocate in CodeCache:

        # java.lang.OutOfMemoryError: requested 1824 bytes for CodeCache: no room for vtable chunks. Out of swap space?
        #
        # Internal Error (vtableStubs.cpp:63), pid=28881, tid=330
        # Error: CodeCache: no room for vtable chunks


        V [libjvm.so+0x547b70] void report_vm_out_of_memory(const char*,int,unsigned long,const char*)+0x68;; void report_vm_out_of_memory(const char*,int,unsigned long,const char*)+0x68
        V [libjvm.so+0xa39578] void*VtableStub::operator new(unsigned long,int)+0xb8;; void*VtableStub::operator new(unsigned long,int)+0xb8
        V [libjvm.so+0xa39e8c] VtableStub*VtableStubs::create_vtable_stub(int)+0x3c;; VtableStub*VtableStubs::create_vtable_stub(int)+0x3c
        V [libjvm.so+0xa397e4] unsigned char*VtableStubs::create_stub(bool,int,methodOopDesc*)+0x3c;; unsigned char*VtableStubs::create_stub(bool,int,methodOopDesc*)+0x3c
        V [libjvm.so+0x2ba2ac] void CompiledIC::set_to_megamorphic(CallInfo*,Bytecodes::Code,Thread*)+0x11c;; void CompiledIC::set_to_megamorphic(CallInfo*,Bytecodes::Code,Thread*)+0x11c
        V [libjvm.so+0x2bce98] methodHandle SharedRuntime::handle_ic_miss_helper(JavaThread*,Thread*)+0x7a8;; methodHandle SharedRuntime::handle_ic_miss_helper(JavaThread*,Thread*)+0x7a8
        V [libjvm.so+0x952988] unsigned char*SharedRuntime::handle_wrong_method_ic_miss(JavaThread*)+0x30;; unsigned char*SharedRuntime::handle_wrong_method_ic_miss(JavaThread*)+0x30
        v ~RuntimeStub::ic_miss_stub
        J java.awt.Component.getHWPeerAboveMe()Ljava/awt/peer/ComponentPeer;

        Code Cache [0xffffffff77800000, 0xffffffff7b800000, 0xffffffff7b800000)
         total_blobs=40649 nmethods=16532 adapters=501 free_code_cache=770368

          Issue Links

            Activity

            Hide
            kvn Vladimir Kozlov added a comment -
            BT2:SUGGESTED FIX

            src/share/vm/runtime/sharedRuntime.cpp
            *** 1246,1255 ****
            --- 1246,1269 ----
              methodHandle SharedRuntime::handle_ic_miss_helper(JavaThread *thread, TRAPS) {
                ResourceMark rm(thread);
                CallInfo call_info;
                Bytecodes::Code bc;
              
            + // If the code cache is full deoptimize this frame.
            + if (!UseCompiler) {
            + // bypass VM_DeoptimizeFrame and deoptimize the frame directly
            + RegisterMap reg_map(thread, false);
            + frame stub_frame = thread->last_frame();
            + assert(stub_frame.is_runtime_frame(), "sanity check");
            + frame caller_frame = stub_frame.sender(&reg_map);
            + assert(!caller_frame.is_interpreted_frame() && !caller_frame.is_entry_frame(), "unexpected frame");
            + Deoptimization::deoptimize_frame(thread, caller_frame.id());
            + assert(stub_frame.sender(&reg_map).is_deoptimized_frame(),
            + "caller should be deoptimized now");
            + return find_callee_method(thread, CHECK_(methodHandle()));
            + }
            +
                // receiver is NULL for static calls. An exception is thrown for NULL
                // receivers for non-static calls
                Handle receiver = find_callee_info(thread, bc, call_info,
                                                   CHECK_(methodHandle()));
                // Compiler1 can produce virtual call sites that can actually be statically bound

            src/share/vm/oops/methodOop.cpp
            *** 683,693 ****
                // normal calls. For vtable calls life gets more complicated. When a
                // call-site goes mega-morphic we need adapters in all methods which can be
                // called from the vtable. We need adapters on such methods that get loaded
                // later. Ditto for mega-morphic itable calls. If this proves to be a
                // problem we'll make these lazily later.
            ! (void) make_adapters(h_method, CHECK);
              
                // ONLY USE the h_method now as make_adapter may have blocked
              
              }
              
            --- 683,693 ----
                // normal calls. For vtable calls life gets more complicated. When a
                // call-site goes mega-morphic we need adapters in all methods which can be
                // called from the vtable. We need adapters on such methods that get loaded
                // later. Ditto for mega-morphic itable calls. If this proves to be a
                // problem we'll make these lazily later.
            ! if (UseCompiler) (void) make_adapters(h_method, CHECK);
              
                // ONLY USE the h_method now as make_adapter may have blocked
              
              }
            Show
            kvn Vladimir Kozlov added a comment - BT2:SUGGESTED FIX src/share/vm/runtime/sharedRuntime.cpp *** 1246,1255 **** --- 1246,1269 ----   methodHandle SharedRuntime::handle_ic_miss_helper(JavaThread *thread, TRAPS) {     ResourceMark rm(thread);     CallInfo call_info;     Bytecodes::Code bc;    + // If the code cache is full deoptimize this frame. + if (!UseCompiler) { + // bypass VM_DeoptimizeFrame and deoptimize the frame directly + RegisterMap reg_map(thread, false); + frame stub_frame = thread->last_frame(); + assert(stub_frame.is_runtime_frame(), "sanity check"); + frame caller_frame = stub_frame.sender(&reg_map); + assert(!caller_frame.is_interpreted_frame() && !caller_frame.is_entry_frame(), "unexpected frame"); + Deoptimization::deoptimize_frame(thread, caller_frame.id()); + assert(stub_frame.sender(&reg_map).is_deoptimized_frame(), + "caller should be deoptimized now"); + return find_callee_method(thread, CHECK_(methodHandle())); + } +     // receiver is NULL for static calls. An exception is thrown for NULL     // receivers for non-static calls     Handle receiver = find_callee_info(thread, bc, call_info,                                        CHECK_(methodHandle()));     // Compiler1 can produce virtual call sites that can actually be statically bound src/share/vm/oops/methodOop.cpp *** 683,693 ****     // normal calls. For vtable calls life gets more complicated. When a     // call-site goes mega-morphic we need adapters in all methods which can be     // called from the vtable. We need adapters on such methods that get loaded     // later. Ditto for mega-morphic itable calls. If this proves to be a     // problem we'll make these lazily later. ! (void) make_adapters(h_method, CHECK);        // ONLY USE the h_method now as make_adapter may have blocked      }    --- 683,693 ----     // normal calls. For vtable calls life gets more complicated. When a     // call-site goes mega-morphic we need adapters in all methods which can be     // called from the vtable. We need adapters on such methods that get loaded     // later. Ditto for mega-morphic itable calls. If this proves to be a     // problem we'll make these lazily later. ! if (UseCompiler) (void) make_adapters(h_method, CHECK);        // ONLY USE the h_method now as make_adapter may have blocked      }
            Hide
            thlenz Thomas Lenz (Inactive) added a comment -
            BT2:WORK AROUND

            increase -XX:CodeCacheMinimumFreeSpace -XX:ReservedCodeCacheSize
            e.g.:
            -XX:CodeCacheMinimumFreeSpace=2M -XX:ReservedCodeCacheSize=64M
            Show
            thlenz Thomas Lenz (Inactive) added a comment - BT2:WORK AROUND increase -XX:CodeCacheMinimumFreeSpace -XX:ReservedCodeCacheSize e.g.: -XX:CodeCacheMinimumFreeSpace=2M -XX:ReservedCodeCacheSize=64M
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk8/jdk8/hotspot/rev/891687731b59
            User: amurillo
            Date: 2013-10-01 20:52:09 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk8/jdk8/hotspot/rev/891687731b59 User: amurillo Date: 2013-10-01 20:52:09 +0000

              People

              • Assignee:
                anoll Albert Noll (Inactive)
                Reporter:
                kvn Vladimir Kozlov
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: