< prev index next >

src/share/vm/code/nmethod.cpp

Print this page




 547       + round_to(debug_info->data_size()       , oopSize);
 548 
 549     nm = new (nmethod_size, comp_level)
 550     nmethod(method(), nmethod_size, compile_id, entry_bci, offsets,
 551             orig_pc_offset, debug_info, dependencies, code_buffer, frame_size,
 552             oop_maps,
 553             handler_table,
 554             nul_chk_table,
 555             compiler,
 556             comp_level);
 557 
 558     if (nm != NULL) {
 559       // To make dependency checking during class loading fast, record
 560       // the nmethod dependencies in the classes it is dependent on.
 561       // This allows the dependency checking code to simply walk the
 562       // class hierarchy above the loaded class, checking only nmethods
 563       // which are dependent on those classes.  The slow way is to
 564       // check every nmethod for dependencies which makes it linear in
 565       // the number of methods compiled.  For applications with a lot
 566       // classes the slow way is too slow.
 567       for (Dependencies::DepStream deps(nm); deps.next(); ) {

 568         if (deps.type() == Dependencies::call_site_target_value) {
 569           // CallSite dependencies are managed on per-CallSite instance basis.
 570           oop call_site = deps.argument_oop(0);
 571           MethodHandles::add_dependent_nmethod(call_site, nm);
 572         } else {
 573           Klass* klass = deps.context_type();
 574           if (klass == NULL) {
 575             continue;  // ignore things like evol_method
 576           }
 577           // record this nmethod as dependent on this klass
 578           InstanceKlass::cast(klass)->add_dependent_nmethod(nm);
 579         }
 580       }


 581       NOT_PRODUCT(nmethod_stats.note_nmethod(nm));
 582       if (PrintAssembly || CompilerOracle::has_option_string(method, "PrintAssembly")) {
 583         Disassembler::decode(nm);
 584       }
 585     }
 586   }
 587   // Do verification and logging outside CodeCache_lock.
 588   if (nm != NULL) {
 589     // Safepoints in nmethod::verify aren't allowed because nm hasn't been installed yet.
 590     DEBUG_ONLY(nm->verify();)
 591     nm->log_new_nmethod();
 592   }
 593   return nm;
 594 }
 595 
 596 
 597 // For native wrappers
 598 nmethod::nmethod(
 599   Method* method,
 600   int nmethod_size,




 547       + round_to(debug_info->data_size()       , oopSize);
 548 
 549     nm = new (nmethod_size, comp_level)
 550     nmethod(method(), nmethod_size, compile_id, entry_bci, offsets,
 551             orig_pc_offset, debug_info, dependencies, code_buffer, frame_size,
 552             oop_maps,
 553             handler_table,
 554             nul_chk_table,
 555             compiler,
 556             comp_level);
 557 
 558     if (nm != NULL) {
 559       // To make dependency checking during class loading fast, record
 560       // the nmethod dependencies in the classes it is dependent on.
 561       // This allows the dependency checking code to simply walk the
 562       // class hierarchy above the loaded class, checking only nmethods
 563       // which are dependent on those classes.  The slow way is to
 564       // check every nmethod for dependencies which makes it linear in
 565       // the number of methods compiled.  For applications with a lot
 566       // classes the slow way is too slow.
 567       int total = 0;
 568       for (Dependencies::DepStream deps(nm); deps.next(); total++) {
 569         if (deps.type() == Dependencies::call_site_target_value) {
 570           // CallSite dependencies are managed on per-CallSite instance basis.
 571           oop call_site = deps.argument_oop(0);
 572           MethodHandles::add_dependent_nmethod(call_site, nm);
 573         } else {
 574           Klass* klass = deps.context_type();
 575           if (klass == NULL) {
 576             continue;  // ignore things like evol_method
 577           }
 578           // record this nmethod as dependent on this klass
 579           InstanceKlass::cast(klass)->add_dependent_nmethod(nm);
 580         }
 581       }
 582       Dependencies::_perf_dependencies_total_count->inc(total);
 583 
 584       NOT_PRODUCT(nmethod_stats.note_nmethod(nm));
 585       if (PrintAssembly || CompilerOracle::has_option_string(method, "PrintAssembly")) {
 586         Disassembler::decode(nm);
 587       }
 588     }
 589   }
 590   // Do verification and logging outside CodeCache_lock.
 591   if (nm != NULL) {
 592     // Safepoints in nmethod::verify aren't allowed because nm hasn't been installed yet.
 593     DEBUG_ONLY(nm->verify();)
 594     nm->log_new_nmethod();
 595   }
 596   return nm;
 597 }
 598 
 599 
 600 // For native wrappers
 601 nmethod::nmethod(
 602   Method* method,
 603   int nmethod_size,


< prev index next >