hotspot/src/share/vm/runtime/sharedRuntime.cpp
changeset 25064 244218e6ec0a
parent 24462 0676642e6560
child 25351 7c198a690050
child 25345 783763c99421
equal deleted inserted replaced
25063:fc4e54527641 25064:244218e6ec0a
   196   _ICmiss_count[index] = 1;
   196   _ICmiss_count[index] = 1;
   197 }
   197 }
   198 
   198 
   199 void SharedRuntime::print_ic_miss_histogram() {
   199 void SharedRuntime::print_ic_miss_histogram() {
   200   if (ICMissHistogram) {
   200   if (ICMissHistogram) {
   201     tty->print_cr ("IC Miss Histogram:");
   201     tty->print_cr("IC Miss Histogram:");
   202     int tot_misses = 0;
   202     int tot_misses = 0;
   203     for (int i = 0; i < _ICmiss_index; i++) {
   203     for (int i = 0; i < _ICmiss_index; i++) {
   204       tty->print_cr("  at: " INTPTR_FORMAT "  nof: %d", _ICmiss_at[i], _ICmiss_count[i]);
   204       tty->print_cr("  at: " INTPTR_FORMAT "  nof: %d", _ICmiss_at[i], _ICmiss_count[i]);
   205       tot_misses += _ICmiss_count[i];
   205       tot_misses += _ICmiss_count[i];
   206     }
   206     }
   207     tty->print_cr ("Total IC misses: %7d", tot_misses);
   207     tty->print_cr("Total IC misses: %7d", tot_misses);
   208   }
   208   }
   209 }
   209 }
   210 #endif // PRODUCT
   210 #endif // PRODUCT
   211 
   211 
   212 #if INCLUDE_ALL_GCS
   212 #if INCLUDE_ALL_GCS
   264   // infinity operands.
   264   // infinity operands.
   265   union { jfloat f; juint i; } xbits, ybits;
   265   union { jfloat f; juint i; } xbits, ybits;
   266   xbits.f = x;
   266   xbits.f = x;
   267   ybits.f = y;
   267   ybits.f = y;
   268   // x Mod Infinity == x unless x is infinity
   268   // x Mod Infinity == x unless x is infinity
   269   if ( ((xbits.i & float_sign_mask) != float_infinity) &&
   269   if (((xbits.i & float_sign_mask) != float_infinity) &&
   270        ((ybits.i & float_sign_mask) == float_infinity) ) {
   270        ((ybits.i & float_sign_mask) == float_infinity) ) {
   271     return x;
   271     return x;
   272   }
   272   }
   273 #endif
   273 #endif
   274   return ((jfloat)fmod((double)x,(double)y));
   274   return ((jfloat)fmod((double)x,(double)y));
   279 #ifdef _WIN64
   279 #ifdef _WIN64
   280   union { jdouble d; julong l; } xbits, ybits;
   280   union { jdouble d; julong l; } xbits, ybits;
   281   xbits.d = x;
   281   xbits.d = x;
   282   ybits.d = y;
   282   ybits.d = y;
   283   // x Mod Infinity == x unless x is infinity
   283   // x Mod Infinity == x unless x is infinity
   284   if ( ((xbits.l & double_sign_mask) != double_infinity) &&
   284   if (((xbits.l & double_sign_mask) != double_infinity) &&
   285        ((ybits.l & double_sign_mask) == double_infinity) ) {
   285        ((ybits.l & double_sign_mask) == double_infinity) ) {
   286     return x;
   286     return x;
   287   }
   287   }
   288 #endif
   288 #endif
   289   return ((jdouble)fmod((double)x,(double)y));
   289   return ((jdouble)fmod((double)x,(double)y));
   535   address stub;
   535   address stub;
   536   // Look up the code blob
   536   // Look up the code blob
   537   CodeBlob *cb = CodeCache::find_blob(pc);
   537   CodeBlob *cb = CodeCache::find_blob(pc);
   538 
   538 
   539   // Should be an nmethod
   539   // Should be an nmethod
   540   assert( cb && cb->is_nmethod(), "safepoint polling: pc must refer to an nmethod" );
   540   assert(cb && cb->is_nmethod(), "safepoint polling: pc must refer to an nmethod");
   541 
   541 
   542   // Look up the relocation information
   542   // Look up the relocation information
   543   assert( ((nmethod*)cb)->is_at_poll_or_poll_return(pc),
   543   assert(((nmethod*)cb)->is_at_poll_or_poll_return(pc),
   544     "safepoint polling: type must be poll" );
   544     "safepoint polling: type must be poll");
   545 
   545 
   546   assert( ((NativeInstruction*)pc)->is_safepoint_poll(),
   546   assert(((NativeInstruction*)pc)->is_safepoint_poll(),
   547     "Only polling locations are used for safepoint");
   547     "Only polling locations are used for safepoint");
   548 
   548 
   549   bool at_poll_return = ((nmethod*)cb)->is_at_poll_return(pc);
   549   bool at_poll_return = ((nmethod*)cb)->is_at_poll_return(pc);
   550   bool has_wide_vectors = ((nmethod*)cb)->has_wide_vectors();
   550   bool has_wide_vectors = ((nmethod*)cb)->has_wide_vectors();
   551   if (at_poll_return) {
   551   if (at_poll_return) {
   560     assert(SharedRuntime::polling_page_safepoint_handler_blob() != NULL,
   560     assert(SharedRuntime::polling_page_safepoint_handler_blob() != NULL,
   561            "polling page safepoint stub not created yet");
   561            "polling page safepoint stub not created yet");
   562     stub = SharedRuntime::polling_page_safepoint_handler_blob()->entry_point();
   562     stub = SharedRuntime::polling_page_safepoint_handler_blob()->entry_point();
   563   }
   563   }
   564 #ifndef PRODUCT
   564 #ifndef PRODUCT
   565   if( TraceSafepoint ) {
   565   if (TraceSafepoint) {
   566     char buf[256];
   566     char buf[256];
   567     jio_snprintf(buf, sizeof(buf),
   567     jio_snprintf(buf, sizeof(buf),
   568                  "... found polling page %s exception at pc = "
   568                  "... found polling page %s exception at pc = "
   569                  INTPTR_FORMAT ", stub =" INTPTR_FORMAT,
   569                  INTPTR_FORMAT ", stub =" INTPTR_FORMAT,
   570                  at_poll_return ? "return" : "loop",
   570                  at_poll_return ? "return" : "loop",
  1472           tty->print_cr(" code: " INTPTR_FORMAT, callee_method->code());
  1472           tty->print_cr(" code: " INTPTR_FORMAT, callee_method->code());
  1473         }
  1473         }
  1474         should_be_mono = true;
  1474         should_be_mono = true;
  1475       } else if (inline_cache->is_icholder_call()) {
  1475       } else if (inline_cache->is_icholder_call()) {
  1476         CompiledICHolder* ic_oop = inline_cache->cached_icholder();
  1476         CompiledICHolder* ic_oop = inline_cache->cached_icholder();
  1477         if ( ic_oop != NULL) {
  1477         if (ic_oop != NULL) {
  1478 
  1478 
  1479           if (receiver()->klass() == ic_oop->holder_klass()) {
  1479           if (receiver()->klass() == ic_oop->holder_klass()) {
  1480             // This isn't a real miss. We must have seen that compiled code
  1480             // This isn't a real miss. We must have seen that compiled code
  1481             // is now available and we want the call site converted to a
  1481             // is now available and we want the call site converted to a
  1482             // monomorphic compiled call site.
  1482             // monomorphic compiled call site.
  1726       //
  1726       //
  1727       RelocIterator iter(nm, call->instruction_address(), call->next_instruction_address());
  1727       RelocIterator iter(nm, call->instruction_address(), call->next_instruction_address());
  1728       iter.next();
  1728       iter.next();
  1729       assert(iter.has_current(), "must have a reloc at java call site");
  1729       assert(iter.has_current(), "must have a reloc at java call site");
  1730       relocInfo::relocType typ = iter.reloc()->type();
  1730       relocInfo::relocType typ = iter.reloc()->type();
  1731       if ( typ != relocInfo::static_call_type &&
  1731       if (typ != relocInfo::static_call_type &&
  1732            typ != relocInfo::opt_virtual_call_type &&
  1732            typ != relocInfo::opt_virtual_call_type &&
  1733            typ != relocInfo::static_stub_type) {
  1733            typ != relocInfo::static_stub_type) {
  1734         return;
  1734         return;
  1735       }
  1735       }
  1736       address destination = call->destination();
  1736       address destination = call->destination();
  1782   // even though the copy_array API also performs dynamic checks to ensure
  1782   // even though the copy_array API also performs dynamic checks to ensure
  1783   // that src and dest are truly arrays (and are conformable).
  1783   // that src and dest are truly arrays (and are conformable).
  1784   // The copy_array mechanism is awkward and could be removed, but
  1784   // The copy_array mechanism is awkward and could be removed, but
  1785   // the compilers don't call this function except as a last resort,
  1785   // the compilers don't call this function except as a last resort,
  1786   // so it probably doesn't matter.
  1786   // so it probably doesn't matter.
  1787   src->klass()->copy_array((arrayOopDesc*)src,  src_pos,
  1787   src->klass()->copy_array((arrayOopDesc*)src, src_pos,
  1788                                         (arrayOopDesc*)dest, dest_pos,
  1788                                         (arrayOopDesc*)dest, dest_pos,
  1789                                         length, thread);
  1789                                         length, thread);
  1790 }
  1790 }
  1791 JRT_END
  1791 JRT_END
  1792 
  1792 
  1889 
  1889 
  1890 void SharedRuntime::print_statistics() {
  1890 void SharedRuntime::print_statistics() {
  1891   ttyLocker ttyl;
  1891   ttyLocker ttyl;
  1892   if (xtty != NULL)  xtty->head("statistics type='SharedRuntime'");
  1892   if (xtty != NULL)  xtty->head("statistics type='SharedRuntime'");
  1893 
  1893 
  1894   if (_monitor_enter_ctr ) tty->print_cr("%5d monitor enter slow",  _monitor_enter_ctr);
  1894   if (_monitor_enter_ctr) tty->print_cr("%5d monitor enter slow",  _monitor_enter_ctr);
  1895   if (_monitor_exit_ctr  ) tty->print_cr("%5d monitor exit slow",   _monitor_exit_ctr);
  1895   if (_monitor_exit_ctr) tty->print_cr("%5d monitor exit slow",   _monitor_exit_ctr);
  1896   if (_throw_null_ctr) tty->print_cr("%5d implicit null throw", _throw_null_ctr);
  1896   if (_throw_null_ctr) tty->print_cr("%5d implicit null throw", _throw_null_ctr);
  1897 
  1897 
  1898   SharedRuntime::print_ic_miss_histogram();
  1898   SharedRuntime::print_ic_miss_histogram();
  1899 
  1899 
  1900   if (CountRemovableExceptions) {
  1900   if (CountRemovableExceptions) {
  1903       tty->print_cr("Removable exceptions: %d", _nof_removable_exceptions);
  1903       tty->print_cr("Removable exceptions: %d", _nof_removable_exceptions);
  1904     }
  1904     }
  1905   }
  1905   }
  1906 
  1906 
  1907   // Dump the JRT_ENTRY counters
  1907   // Dump the JRT_ENTRY counters
  1908   if( _new_instance_ctr ) tty->print_cr("%5d new instance requires GC", _new_instance_ctr);
  1908   if (_new_instance_ctr) tty->print_cr("%5d new instance requires GC", _new_instance_ctr);
  1909   if( _new_array_ctr ) tty->print_cr("%5d new array requires GC", _new_array_ctr);
  1909   if (_new_array_ctr) tty->print_cr("%5d new array requires GC", _new_array_ctr);
  1910   if( _multi1_ctr ) tty->print_cr("%5d multianewarray 1 dim", _multi1_ctr);
  1910   if (_multi1_ctr) tty->print_cr("%5d multianewarray 1 dim", _multi1_ctr);
  1911   if( _multi2_ctr ) tty->print_cr("%5d multianewarray 2 dim", _multi2_ctr);
  1911   if (_multi2_ctr) tty->print_cr("%5d multianewarray 2 dim", _multi2_ctr);
  1912   if( _multi3_ctr ) tty->print_cr("%5d multianewarray 3 dim", _multi3_ctr);
  1912   if (_multi3_ctr) tty->print_cr("%5d multianewarray 3 dim", _multi3_ctr);
  1913   if( _multi4_ctr ) tty->print_cr("%5d multianewarray 4 dim", _multi4_ctr);
  1913   if (_multi4_ctr) tty->print_cr("%5d multianewarray 4 dim", _multi4_ctr);
  1914   if( _multi5_ctr ) tty->print_cr("%5d multianewarray 5 dim", _multi5_ctr);
  1914   if (_multi5_ctr) tty->print_cr("%5d multianewarray 5 dim", _multi5_ctr);
  1915 
  1915 
  1916   tty->print_cr("%5d inline cache miss in compiled", _ic_miss_ctr );
  1916   tty->print_cr("%5d inline cache miss in compiled", _ic_miss_ctr);
  1917   tty->print_cr("%5d wrong method", _wrong_method_ctr );
  1917   tty->print_cr("%5d wrong method", _wrong_method_ctr);
  1918   tty->print_cr("%5d unresolved static call site", _resolve_static_ctr );
  1918   tty->print_cr("%5d unresolved static call site", _resolve_static_ctr);
  1919   tty->print_cr("%5d unresolved virtual call site", _resolve_virtual_ctr );
  1919   tty->print_cr("%5d unresolved virtual call site", _resolve_virtual_ctr);
  1920   tty->print_cr("%5d unresolved opt virtual call site", _resolve_opt_virtual_ctr );
  1920   tty->print_cr("%5d unresolved opt virtual call site", _resolve_opt_virtual_ctr);
  1921 
  1921 
  1922   if( _mon_enter_stub_ctr ) tty->print_cr("%5d monitor enter stub", _mon_enter_stub_ctr );
  1922   if (_mon_enter_stub_ctr) tty->print_cr("%5d monitor enter stub", _mon_enter_stub_ctr);
  1923   if( _mon_exit_stub_ctr ) tty->print_cr("%5d monitor exit stub", _mon_exit_stub_ctr );
  1923   if (_mon_exit_stub_ctr) tty->print_cr("%5d monitor exit stub", _mon_exit_stub_ctr);
  1924   if( _mon_enter_ctr ) tty->print_cr("%5d monitor enter slow", _mon_enter_ctr );
  1924   if (_mon_enter_ctr) tty->print_cr("%5d monitor enter slow", _mon_enter_ctr);
  1925   if( _mon_exit_ctr ) tty->print_cr("%5d monitor exit slow", _mon_exit_ctr );
  1925   if (_mon_exit_ctr) tty->print_cr("%5d monitor exit slow", _mon_exit_ctr);
  1926   if( _partial_subtype_ctr) tty->print_cr("%5d slow partial subtype", _partial_subtype_ctr );
  1926   if (_partial_subtype_ctr) tty->print_cr("%5d slow partial subtype", _partial_subtype_ctr);
  1927   if( _jbyte_array_copy_ctr ) tty->print_cr("%5d byte array copies", _jbyte_array_copy_ctr );
  1927   if (_jbyte_array_copy_ctr) tty->print_cr("%5d byte array copies", _jbyte_array_copy_ctr);
  1928   if( _jshort_array_copy_ctr ) tty->print_cr("%5d short array copies", _jshort_array_copy_ctr );
  1928   if (_jshort_array_copy_ctr) tty->print_cr("%5d short array copies", _jshort_array_copy_ctr);
  1929   if( _jint_array_copy_ctr ) tty->print_cr("%5d int array copies", _jint_array_copy_ctr );
  1929   if (_jint_array_copy_ctr) tty->print_cr("%5d int array copies", _jint_array_copy_ctr);
  1930   if( _jlong_array_copy_ctr ) tty->print_cr("%5d long array copies", _jlong_array_copy_ctr );
  1930   if (_jlong_array_copy_ctr) tty->print_cr("%5d long array copies", _jlong_array_copy_ctr);
  1931   if( _oop_array_copy_ctr ) tty->print_cr("%5d oop array copies", _oop_array_copy_ctr );
  1931   if (_oop_array_copy_ctr) tty->print_cr("%5d oop array copies", _oop_array_copy_ctr);
  1932   if( _checkcast_array_copy_ctr ) tty->print_cr("%5d checkcast array copies", _checkcast_array_copy_ctr );
  1932   if (_checkcast_array_copy_ctr) tty->print_cr("%5d checkcast array copies", _checkcast_array_copy_ctr);
  1933   if( _unsafe_array_copy_ctr ) tty->print_cr("%5d unsafe array copies", _unsafe_array_copy_ctr );
  1933   if (_unsafe_array_copy_ctr) tty->print_cr("%5d unsafe array copies", _unsafe_array_copy_ctr);
  1934   if( _generic_array_copy_ctr ) tty->print_cr("%5d generic array copies", _generic_array_copy_ctr );
  1934   if (_generic_array_copy_ctr) tty->print_cr("%5d generic array copies", _generic_array_copy_ctr);
  1935   if( _slow_array_copy_ctr ) tty->print_cr("%5d slow array copies", _slow_array_copy_ctr );
  1935   if (_slow_array_copy_ctr) tty->print_cr("%5d slow array copies", _slow_array_copy_ctr);
  1936   if( _find_handler_ctr ) tty->print_cr("%5d find exception handler", _find_handler_ctr );
  1936   if (_find_handler_ctr) tty->print_cr("%5d find exception handler", _find_handler_ctr);
  1937   if( _rethrow_ctr ) tty->print_cr("%5d rethrow handler", _rethrow_ctr );
  1937   if (_rethrow_ctr) tty->print_cr("%5d rethrow handler", _rethrow_ctr);
  1938 
  1938 
  1939   AdapterHandlerLibrary::print_statistics();
  1939   AdapterHandlerLibrary::print_statistics();
  1940 
  1940 
  1941   if (xtty != NULL)  xtty->tail("statistics");
  1941   if (xtty != NULL)  xtty->tail("statistics");
  1942 }
  1942 }
  1995 
  1995 
  1996  public:
  1996  public:
  1997   MethodArityHistogram() {
  1997   MethodArityHistogram() {
  1998     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
  1998     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
  1999     _max_arity = _max_size = 0;
  1999     _max_arity = _max_size = 0;
  2000     for (int i = 0; i < MAX_ARITY; i++) _arity_histogram[i] = _size_histogram [i] = 0;
  2000     for (int i = 0; i < MAX_ARITY; i++) _arity_histogram[i] = _size_histogram[i] = 0;
  2001     CodeCache::nmethods_do(add_method_to_histogram);
  2001     CodeCache::nmethods_do(add_method_to_histogram);
  2002     print_histogram();
  2002     print_histogram();
  2003   }
  2003   }
  2004 };
  2004 };
  2005 
  2005 
  2060 
  2060 
  2061   // Remap BasicTypes that are handled equivalently by the adapters.
  2061   // Remap BasicTypes that are handled equivalently by the adapters.
  2062   // These are correct for the current system but someday it might be
  2062   // These are correct for the current system but someday it might be
  2063   // necessary to make this mapping platform dependent.
  2063   // necessary to make this mapping platform dependent.
  2064   static int adapter_encoding(BasicType in) {
  2064   static int adapter_encoding(BasicType in) {
  2065     switch(in) {
  2065     switch (in) {
  2066       case T_BOOLEAN:
  2066       case T_BOOLEAN:
  2067       case T_BYTE:
  2067       case T_BYTE:
  2068       case T_SHORT:
  2068       case T_SHORT:
  2069       case T_CHAR:
  2069       case T_CHAR:
  2070         // There are all promoted to T_INT in the calling convention
  2070         // There are all promoted to T_INT in the calling convention
  2477       ttyLocker ttyl;
  2477       ttyLocker ttyl;
  2478       entry->print_adapter_on(tty);
  2478       entry->print_adapter_on(tty);
  2479       tty->print_cr("i2c argument handler #%d for: %s %s (%d bytes generated)",
  2479       tty->print_cr("i2c argument handler #%d for: %s %s (%d bytes generated)",
  2480                     _adapters->number_of_entries(), (method->is_static() ? "static" : "receiver"),
  2480                     _adapters->number_of_entries(), (method->is_static() ? "static" : "receiver"),
  2481                     method->signature()->as_C_string(), insts_size);
  2481                     method->signature()->as_C_string(), insts_size);
  2482       tty->print_cr("c2i argument handler starts at %p",entry->get_c2i_entry());
  2482       tty->print_cr("c2i argument handler starts at %p", entry->get_c2i_entry());
  2483       if (Verbose || PrintStubCode) {
  2483       if (Verbose || PrintStubCode) {
  2484         address first_pc = entry->base_address();
  2484         address first_pc = entry->base_address();
  2485         if (first_pc != NULL) {
  2485         if (first_pc != NULL) {
  2486           Disassembler::decode(first_pc, first_pc + insts_size);
  2486           Disassembler::decode(first_pc, first_pc + insts_size);
  2487           tty->cr();
  2487           tty->cr();
  2502                  sizeof(blob_id),
  2502                  sizeof(blob_id),
  2503                  "%s(%s)@" PTR_FORMAT,
  2503                  "%s(%s)@" PTR_FORMAT,
  2504                  new_adapter->name(),
  2504                  new_adapter->name(),
  2505                  fingerprint->as_string(),
  2505                  fingerprint->as_string(),
  2506                  new_adapter->content_begin());
  2506                  new_adapter->content_begin());
  2507     Forte::register_stub(blob_id, new_adapter->content_begin(),new_adapter->content_end());
  2507     Forte::register_stub(blob_id, new_adapter->content_begin(), new_adapter->content_end());
  2508 
  2508 
  2509     if (JvmtiExport::should_post_dynamic_code_generated()) {
  2509     if (JvmtiExport::should_post_dynamic_code_generated()) {
  2510       JvmtiExport::post_dynamic_code_generated(blob_id, new_adapter->content_begin(), new_adapter->content_end());
  2510       JvmtiExport::post_dynamic_code_generated(blob_id, new_adapter->content_begin(), new_adapter->content_end());
  2511     }
  2511     }
  2512   }
  2512   }
  2603       const int total_args_passed = method->size_of_parameters();
  2603       const int total_args_passed = method->size_of_parameters();
  2604 
  2604 
  2605       BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed);
  2605       BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed);
  2606       VMRegPair*   regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed);
  2606       VMRegPair*   regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed);
  2607       int i=0;
  2607       int i=0;
  2608       if( !method->is_static() )  // Pass in receiver first
  2608       if (!method->is_static())  // Pass in receiver first
  2609         sig_bt[i++] = T_OBJECT;
  2609         sig_bt[i++] = T_OBJECT;
  2610       SignatureStream ss(method->signature());
  2610       SignatureStream ss(method->signature());
  2611       for( ; !ss.at_return_type(); ss.next()) {
  2611       for (; !ss.at_return_type(); ss.next()) {
  2612         sig_bt[i++] = ss.type();  // Collect remaining bits of signature
  2612         sig_bt[i++] = ss.type();  // Collect remaining bits of signature
  2613         if( ss.type() == T_LONG || ss.type() == T_DOUBLE )
  2613         if (ss.type() == T_LONG || ss.type() == T_DOUBLE)
  2614           sig_bt[i++] = T_VOID;   // Longs & doubles take 2 Java slots
  2614           sig_bt[i++] = T_VOID;   // Longs & doubles take 2 Java slots
  2615       }
  2615       }
  2616       assert(i == total_args_passed, "");
  2616       assert(i == total_args_passed, "");
  2617       BasicType ret_type = ss.type();
  2617       BasicType ret_type = ss.type();
  2618 
  2618 
  2760         case T_CHAR:
  2760         case T_CHAR:
  2761         case T_BYTE:
  2761         case T_BYTE:
  2762         case T_SHORT:
  2762         case T_SHORT:
  2763         case T_INT:
  2763         case T_INT:
  2764           // Convert (bt) to (T_LONG,bt).
  2764           // Convert (bt) to (T_LONG,bt).
  2765           new_in_sig_bt[argcnt  ] = T_LONG;
  2765           new_in_sig_bt[argcnt] = T_LONG;
  2766           new_in_sig_bt[argcnt+1] = bt;
  2766           new_in_sig_bt[argcnt+1] = bt;
  2767           assert(reg.first()->is_valid() && !reg.second()->is_valid(), "");
  2767           assert(reg.first()->is_valid() && !reg.second()->is_valid(), "");
  2768           new_in_regs[argcnt  ].set2(reg.first());
  2768           new_in_regs[argcnt].set2(reg.first());
  2769           new_in_regs[argcnt+1].set_bad();
  2769           new_in_regs[argcnt+1].set_bad();
  2770           argcnt++;
  2770           argcnt++;
  2771           break;
  2771           break;
  2772         default:
  2772         default:
  2773           // No conversion needed.
  2773           // No conversion needed.
  2806   // ResourceObject, so do not put any ResourceMarks in here.
  2806   // ResourceObject, so do not put any ResourceMarks in here.
  2807   char *s = sig->as_C_string();
  2807   char *s = sig->as_C_string();
  2808   int len = (int)strlen(s);
  2808   int len = (int)strlen(s);
  2809   s++; len--;                   // Skip opening paren
  2809   s++; len--;                   // Skip opening paren
  2810   char *t = s+len;
  2810   char *t = s+len;
  2811   while( *(--t) != ')' ) ;      // Find close paren
  2811   while (*(--t) != ')');      // Find close paren
  2812 
  2812 
  2813   BasicType *sig_bt = NEW_RESOURCE_ARRAY( BasicType, 256 );
  2813   BasicType *sig_bt = NEW_RESOURCE_ARRAY(BasicType, 256);
  2814   VMRegPair *regs = NEW_RESOURCE_ARRAY( VMRegPair, 256 );
  2814   VMRegPair *regs = NEW_RESOURCE_ARRAY(VMRegPair, 256);
  2815   int cnt = 0;
  2815   int cnt = 0;
  2816   if (has_receiver) {
  2816   if (has_receiver) {
  2817     sig_bt[cnt++] = T_OBJECT; // Receiver is argument 0; not in signature
  2817     sig_bt[cnt++] = T_OBJECT; // Receiver is argument 0; not in signature
  2818   }
  2818   }
  2819 
  2819 
  2820   while( s < t ) {
  2820   while (s < t) {
  2821     switch( *s++ ) {            // Switch on signature character
  2821     switch (*s++) {            // Switch on signature character
  2822     case 'B': sig_bt[cnt++] = T_BYTE;    break;
  2822     case 'B': sig_bt[cnt++] = T_BYTE;    break;
  2823     case 'C': sig_bt[cnt++] = T_CHAR;    break;
  2823     case 'C': sig_bt[cnt++] = T_CHAR;    break;
  2824     case 'D': sig_bt[cnt++] = T_DOUBLE;  sig_bt[cnt++] = T_VOID; break;
  2824     case 'D': sig_bt[cnt++] = T_DOUBLE;  sig_bt[cnt++] = T_VOID; break;
  2825     case 'F': sig_bt[cnt++] = T_FLOAT;   break;
  2825     case 'F': sig_bt[cnt++] = T_FLOAT;   break;
  2826     case 'I': sig_bt[cnt++] = T_INT;     break;
  2826     case 'I': sig_bt[cnt++] = T_INT;     break;
  2827     case 'J': sig_bt[cnt++] = T_LONG;    sig_bt[cnt++] = T_VOID; break;
  2827     case 'J': sig_bt[cnt++] = T_LONG;    sig_bt[cnt++] = T_VOID; break;
  2828     case 'S': sig_bt[cnt++] = T_SHORT;   break;
  2828     case 'S': sig_bt[cnt++] = T_SHORT;   break;
  2829     case 'Z': sig_bt[cnt++] = T_BOOLEAN; break;
  2829     case 'Z': sig_bt[cnt++] = T_BOOLEAN; break;
  2830     case 'V': sig_bt[cnt++] = T_VOID;    break;
  2830     case 'V': sig_bt[cnt++] = T_VOID;    break;
  2831     case 'L':                   // Oop
  2831     case 'L':                   // Oop
  2832       while( *s++ != ';'  ) ;   // Skip signature
  2832       while (*s++ != ';');   // Skip signature
  2833       sig_bt[cnt++] = T_OBJECT;
  2833       sig_bt[cnt++] = T_OBJECT;
  2834       break;
  2834       break;
  2835     case '[': {                 // Array
  2835     case '[': {                 // Array
  2836       do {                      // Skip optional size
  2836       do {                      // Skip optional size
  2837         while( *s >= '0' && *s <= '9' ) s++;
  2837         while (*s >= '0' && *s <= '9') s++;
  2838       } while( *s++ == '[' );   // Nested arrays?
  2838       } while (*s++ == '[');   // Nested arrays?
  2839       // Skip element type
  2839       // Skip element type
  2840       if( s[-1] == 'L' )
  2840       if (s[-1] == 'L')
  2841         while( *s++ != ';'  ) ; // Skip signature
  2841         while (*s++ != ';'); // Skip signature
  2842       sig_bt[cnt++] = T_ARRAY;
  2842       sig_bt[cnt++] = T_ARRAY;
  2843       break;
  2843       break;
  2844     }
  2844     }
  2845     default : ShouldNotReachHere();
  2845     default : ShouldNotReachHere();
  2846     }
  2846     }
  2848 
  2848 
  2849   if (has_appendix) {
  2849   if (has_appendix) {
  2850     sig_bt[cnt++] = T_OBJECT;
  2850     sig_bt[cnt++] = T_OBJECT;
  2851   }
  2851   }
  2852 
  2852 
  2853   assert( cnt < 256, "grow table size" );
  2853   assert(cnt < 256, "grow table size");
  2854 
  2854 
  2855   int comp_args_on_stack;
  2855   int comp_args_on_stack;
  2856   comp_args_on_stack = java_calling_convention(sig_bt, regs, cnt, true);
  2856   comp_args_on_stack = java_calling_convention(sig_bt, regs, cnt, true);
  2857 
  2857 
  2858   // the calling convention doesn't count out_preserve_stack_slots so
  2858   // the calling convention doesn't count out_preserve_stack_slots so
  2859   // we must add that in to get "true" stack offsets.
  2859   // we must add that in to get "true" stack offsets.
  2860 
  2860 
  2861   if (comp_args_on_stack) {
  2861   if (comp_args_on_stack) {
  2862     for (int i = 0; i < cnt; i++) {
  2862     for (int i = 0; i < cnt; i++) {
  2863       VMReg reg1 = regs[i].first();
  2863       VMReg reg1 = regs[i].first();
  2864       if( reg1->is_stack()) {
  2864       if (reg1->is_stack()) {
  2865         // Yuck
  2865         // Yuck
  2866         reg1 = reg1->bias(out_preserve_stack_slots());
  2866         reg1 = reg1->bias(out_preserve_stack_slots());
  2867       }
  2867       }
  2868       VMReg reg2 = regs[i].second();
  2868       VMReg reg2 = regs[i].second();
  2869       if( reg2->is_stack()) {
  2869       if (reg2->is_stack()) {
  2870         // Yuck
  2870         // Yuck
  2871         reg2 = reg2->bias(out_preserve_stack_slots());
  2871         reg2 = reg2->bias(out_preserve_stack_slots());
  2872       }
  2872       }
  2873       regs[i].set_pair(reg2, reg1);
  2873       regs[i].set_pair(reg2, reg1);
  2874     }
  2874     }
  2902   // differently then this code could move to platform specific code or
  2902   // differently then this code could move to platform specific code or
  2903   // the code here could be modified to copy items one at a time using
  2903   // the code here could be modified to copy items one at a time using
  2904   // frame accessor methods and be platform independent.
  2904   // frame accessor methods and be platform independent.
  2905 
  2905 
  2906   frame fr = thread->last_frame();
  2906   frame fr = thread->last_frame();
  2907   assert( fr.is_interpreted_frame(), "" );
  2907   assert(fr.is_interpreted_frame(), "");
  2908   assert( fr.interpreter_frame_expression_stack_size()==0, "only handle empty stacks" );
  2908   assert(fr.interpreter_frame_expression_stack_size()==0, "only handle empty stacks");
  2909 
  2909 
  2910   // Figure out how many monitors are active.
  2910   // Figure out how many monitors are active.
  2911   int active_monitor_count = 0;
  2911   int active_monitor_count = 0;
  2912   for( BasicObjectLock *kptr = fr.interpreter_frame_monitor_end();
  2912   for (BasicObjectLock *kptr = fr.interpreter_frame_monitor_end();
  2913        kptr < fr.interpreter_frame_monitor_begin();
  2913        kptr < fr.interpreter_frame_monitor_begin();
  2914        kptr = fr.next_monitor_in_interpreter_frame(kptr) ) {
  2914        kptr = fr.next_monitor_in_interpreter_frame(kptr) ) {
  2915     if( kptr->obj() != NULL ) active_monitor_count++;
  2915     if (kptr->obj() != NULL) active_monitor_count++;
  2916   }
  2916   }
  2917 
  2917 
  2918   // QQQ we could place number of active monitors in the array so that compiled code
  2918   // QQQ we could place number of active monitors in the array so that compiled code
  2919   // could double check it.
  2919   // could double check it.
  2920 
  2920 
  2924   int buf_size_words = max_locals + active_monitor_count*2;
  2924   int buf_size_words = max_locals + active_monitor_count*2;
  2925   intptr_t *buf = NEW_C_HEAP_ARRAY(intptr_t,buf_size_words, mtCode);
  2925   intptr_t *buf = NEW_C_HEAP_ARRAY(intptr_t,buf_size_words, mtCode);
  2926 
  2926 
  2927   // Copy the locals.  Order is preserved so that loading of longs works.
  2927   // Copy the locals.  Order is preserved so that loading of longs works.
  2928   // Since there's no GC I can copy the oops blindly.
  2928   // Since there's no GC I can copy the oops blindly.
  2929   assert( sizeof(HeapWord)==sizeof(intptr_t), "fix this code");
  2929   assert(sizeof(HeapWord)==sizeof(intptr_t), "fix this code");
  2930   Copy::disjoint_words((HeapWord*)fr.interpreter_frame_local_at(max_locals-1),
  2930   Copy::disjoint_words((HeapWord*)fr.interpreter_frame_local_at(max_locals-1),
  2931                        (HeapWord*)&buf[0],
  2931                        (HeapWord*)&buf[0],
  2932                        max_locals);
  2932                        max_locals);
  2933 
  2933 
  2934   // Inflate locks.  Copy the displaced headers.  Be careful, there can be holes.
  2934   // Inflate locks.  Copy the displaced headers.  Be careful, there can be holes.
  2935   int i = max_locals;
  2935   int i = max_locals;
  2936   for( BasicObjectLock *kptr2 = fr.interpreter_frame_monitor_end();
  2936   for (BasicObjectLock *kptr2 = fr.interpreter_frame_monitor_end();
  2937        kptr2 < fr.interpreter_frame_monitor_begin();
  2937        kptr2 < fr.interpreter_frame_monitor_begin();
  2938        kptr2 = fr.next_monitor_in_interpreter_frame(kptr2) ) {
  2938        kptr2 = fr.next_monitor_in_interpreter_frame(kptr2) ) {
  2939     if( kptr2->obj() != NULL) {         // Avoid 'holes' in the monitor array
  2939     if (kptr2->obj() != NULL) {         // Avoid 'holes' in the monitor array
  2940       BasicLock *lock = kptr2->lock();
  2940       BasicLock *lock = kptr2->lock();
  2941       // Inflate so the displaced header becomes position-independent
  2941       // Inflate so the displaced header becomes position-independent
  2942       if (lock->displaced_header()->is_unlocked())
  2942       if (lock->displaced_header()->is_unlocked())
  2943         ObjectSynchronizer::inflate_helper(kptr2->obj());
  2943         ObjectSynchronizer::inflate_helper(kptr2->obj());
  2944       // Now the displaced header is free to move
  2944       // Now the displaced header is free to move
  2945       buf[i++] = (intptr_t)lock->displaced_header();
  2945       buf[i++] = (intptr_t)lock->displaced_header();
  2946       buf[i++] = cast_from_oop<intptr_t>(kptr2->obj());
  2946       buf[i++] = cast_from_oop<intptr_t>(kptr2->obj());
  2947     }
  2947     }
  2948   }
  2948   }
  2949   assert( i - max_locals == active_monitor_count*2, "found the expected number of monitors" );
  2949   assert(i - max_locals == active_monitor_count*2, "found the expected number of monitors");
  2950 
  2950 
  2951   return buf;
  2951   return buf;
  2952 JRT_END
  2952 JRT_END
  2953 
  2953 
  2954 JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) )
  2954 JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) )
  2955   FREE_C_HEAP_ARRAY(intptr_t,buf, mtCode);
  2955   FREE_C_HEAP_ARRAY(intptr_t, buf, mtCode);
  2956 JRT_END
  2956 JRT_END
  2957 
  2957 
  2958 bool AdapterHandlerLibrary::contains(CodeBlob* b) {
  2958 bool AdapterHandlerLibrary::contains(CodeBlob* b) {
  2959   AdapterHandlerTableIterator iter(_adapters);
  2959   AdapterHandlerTableIterator iter(_adapters);
  2960   while (iter.has_next()) {
  2960   while (iter.has_next()) {
  2961     AdapterHandlerEntry* a = iter.next();
  2961     AdapterHandlerEntry* a = iter.next();
  2962     if ( b == CodeCache::find_blob(a->get_i2c_entry()) ) return true;
  2962     if (b == CodeCache::find_blob(a->get_i2c_entry())) return true;
  2963   }
  2963   }
  2964   return false;
  2964   return false;
  2965 }
  2965 }
  2966 
  2966 
  2967 void AdapterHandlerLibrary::print_handler_on(outputStream* st, CodeBlob* b) {
  2967 void AdapterHandlerLibrary::print_handler_on(outputStream* st, CodeBlob* b) {