360 // if this thread changed the state of the nmethod or false if
361 // another thread performed the transition.
362 bool make_not_entrant() {
363 assert(!method()->is_method_handle_intrinsic(), "Cannot make MH intrinsic not entrant");
364 return make_not_entrant_or_zombie(not_entrant);
365 }
366 bool make_not_used() { return make_not_entrant(); }
367 bool make_zombie() { return make_not_entrant_or_zombie(zombie); }
368
369 // used by jvmti to track if the unload event has been reported
370 bool unload_reported() { return _unload_reported; }
371 void set_unload_reported() { _unload_reported = true; }
372
373 int get_state() const {
374 return _state;
375 }
376
377 void make_unloaded();
378
379 bool has_dependencies() { return dependencies_size() != 0; }
380 void flush_dependencies(bool delete_immediately);
381 bool has_flushed_dependencies() { return _has_flushed_dependencies; }
382 void set_has_flushed_dependencies() {
383 assert(!has_flushed_dependencies(), "should only happen once");
384 _has_flushed_dependencies = 1;
385 }
386
387 int comp_level() const { return _comp_level; }
388
389 void unlink_from_method(bool acquire_lock);
390
391 // Support for oops in scopes and relocs:
392 // Note: index 0 is reserved for null.
393 oop oop_at(int index) const;
394 oop* oop_addr_at(int index) const { // for GC
395 // relocation indexes are biased by 1 (because 0 is reserved)
396 assert(index > 0 && index <= oops_count(), "must be a valid non-zero index");
397 assert(!_oops_are_stale, "oops are stale");
398 return &oops_begin()[index - 1];
399 }
488 address* orig_pc_addr(const frame* fr);
489
490 public:
491 // copying of debugging information
492 void copy_scopes_pcs(PcDesc* pcs, int count);
493 void copy_scopes_data(address buffer, int size);
494
495 // Accessor/mutator for the original pc of a frame before a frame was deopted.
496 address get_original_pc(const frame* fr) { return *orig_pc_addr(fr); }
497 void set_original_pc(const frame* fr, address pc) { *orig_pc_addr(fr) = pc; }
498
499 // jvmti support:
500 void post_compiled_method_load_event();
501 jmethodID get_and_cache_jmethod_id();
502
503 // verify operations
504 void verify();
505 void verify_scopes();
506 void verify_interrupt_point(address interrupt_point);
507
508 // printing support
509 void print() const;
510 void print_relocations() PRODUCT_RETURN;
511 void print_pcs() PRODUCT_RETURN;
512 void print_scopes() PRODUCT_RETURN;
513 void print_dependencies() PRODUCT_RETURN;
514 void print_value_on(outputStream* st) const PRODUCT_RETURN;
515 void print_calls(outputStream* st) PRODUCT_RETURN;
516 void print_handler_table() PRODUCT_RETURN;
517 void print_nul_chk_table() PRODUCT_RETURN;
518 void print_recorded_oops() PRODUCT_RETURN;
519 void print_recorded_metadata() PRODUCT_RETURN;
520
521 void maybe_print_nmethod(DirectiveSet* directive);
522 void print_nmethod(bool print_code);
523
524 // need to re-define this from CodeBlob else the overload hides it
525 virtual void print_on(outputStream* st) const { CodeBlob::print_on(st); }
526 void print_on(outputStream* st, const char* msg) const;
527
528 // Logging
529 void log_identity(xmlStream* log) const;
530 void log_new_nmethod() const;
531 void log_state_change() const;
532
533 // Prints block-level comments, including nmethod specific block labels:
534 virtual void print_block_comment(outputStream* stream, address block_begin) const {
535 print_nmethod_labels(stream, block_begin);
536 CodeBlob::print_block_comment(stream, block_begin);
537 }
538 void print_nmethod_labels(outputStream* stream, address block_begin) const;
539
540 // Prints a comment for one native instruction (reloc info, pc desc)
541 void print_code_comment_on(outputStream* st, int column, address begin, address end);
542 static void print_statistics() PRODUCT_RETURN;
543
544 // Compiler task identification. Note that all OSR methods
545 // are numbered in an independent sequence if CICountOSR is true,
546 // and native method wrappers are also numbered independently if
547 // CICountNative is true.
548 virtual int compile_id() const { return _compile_id; }
549 const char* compile_kind() const;
550
551 // tells if any of this method's dependencies have been invalidated
552 // (this is expensive!)
553 static void check_all_dependencies(DepChange& changes);
554
555 // tells if this compiled method is dependent on the given changes,
556 // and the changes have invalidated it
557 bool check_dependency_on(DepChange& changes);
558
559 // Fast breakpoint support. Tells if this compiled method is
560 // dependent on the given method. Returns true if this nmethod
561 // corresponds to the given method as well.
562 virtual bool is_dependent_on_method(Method* dependee);
|
360 // if this thread changed the state of the nmethod or false if
361 // another thread performed the transition.
362 bool make_not_entrant() {
363 assert(!method()->is_method_handle_intrinsic(), "Cannot make MH intrinsic not entrant");
364 return make_not_entrant_or_zombie(not_entrant);
365 }
366 bool make_not_used() { return make_not_entrant(); }
367 bool make_zombie() { return make_not_entrant_or_zombie(zombie); }
368
369 // used by jvmti to track if the unload event has been reported
370 bool unload_reported() { return _unload_reported; }
371 void set_unload_reported() { _unload_reported = true; }
372
373 int get_state() const {
374 return _state;
375 }
376
377 void make_unloaded();
378
379 bool has_dependencies() { return dependencies_size() != 0; }
380 void print_dependencies() PRODUCT_RETURN;
381 void flush_dependencies(bool delete_immediately);
382 bool has_flushed_dependencies() { return _has_flushed_dependencies; }
383 void set_has_flushed_dependencies() {
384 assert(!has_flushed_dependencies(), "should only happen once");
385 _has_flushed_dependencies = 1;
386 }
387
388 int comp_level() const { return _comp_level; }
389
390 void unlink_from_method(bool acquire_lock);
391
392 // Support for oops in scopes and relocs:
393 // Note: index 0 is reserved for null.
394 oop oop_at(int index) const;
395 oop* oop_addr_at(int index) const { // for GC
396 // relocation indexes are biased by 1 (because 0 is reserved)
397 assert(index > 0 && index <= oops_count(), "must be a valid non-zero index");
398 assert(!_oops_are_stale, "oops are stale");
399 return &oops_begin()[index - 1];
400 }
489 address* orig_pc_addr(const frame* fr);
490
491 public:
492 // copying of debugging information
493 void copy_scopes_pcs(PcDesc* pcs, int count);
494 void copy_scopes_data(address buffer, int size);
495
496 // Accessor/mutator for the original pc of a frame before a frame was deopted.
497 address get_original_pc(const frame* fr) { return *orig_pc_addr(fr); }
498 void set_original_pc(const frame* fr, address pc) { *orig_pc_addr(fr) = pc; }
499
500 // jvmti support:
501 void post_compiled_method_load_event();
502 jmethodID get_and_cache_jmethod_id();
503
504 // verify operations
505 void verify();
506 void verify_scopes();
507 void verify_interrupt_point(address interrupt_point);
508
509 // Disassemble this nmethod with additional debug information, e.g. information about blocks.
510 void decode2(outputStream* st) const;
511 void print_constant_pool(outputStream* st);
512
513 // Avoid hiding of parent's 'decode(outputStream*)' method.
514 void decode(outputStream* st) const { decode2(st); } // just delegate here.
515
516 // printing support
517 void print() const;
518 void print(outputStream* st) const;
519 void print_code();
520
521 #if defined(SUPPORT_DATA_STRUCTS)
522 // print output in opt build for disassembler library
523 void print_relocations() PRODUCT_RETURN;
524 void print_pcs() { print_pcs_on(tty); }
525 void print_pcs_on(outputStream* st);
526 void print_scopes() { print_scopes_on(tty); }
527 void print_scopes_on(outputStream* st) PRODUCT_RETURN;
528 void print_value_on(outputStream* st) const;
529 void print_handler_table();
530 void print_nul_chk_table();
531 void print_recorded_oops();
532 void print_recorded_metadata();
533
534 void print_oops(outputStream* st); // oops from the underlying CodeBlob.
535 void print_metadata(outputStream* st); // metadata in metadata pool.
536 #else
537 // void print_pcs() PRODUCT_RETURN;
538 void print_pcs() { return; }
539 #endif
540
541 void print_calls(outputStream* st) PRODUCT_RETURN;
542 static void print_statistics() PRODUCT_RETURN;
543
544 void maybe_print_nmethod(DirectiveSet* directive);
545 void print_nmethod(bool print_code);
546
547 // need to re-define this from CodeBlob else the overload hides it
548 virtual void print_on(outputStream* st) const { CodeBlob::print_on(st); }
549 void print_on(outputStream* st, const char* msg) const;
550
551 // Logging
552 void log_identity(xmlStream* log) const;
553 void log_new_nmethod() const;
554 void log_state_change() const;
555
556 // Prints block-level comments, including nmethod specific block labels:
557 virtual void print_block_comment(outputStream* stream, address block_begin) const {
558 #if defined(SUPPORT_ASSEMBLY) || defined(SUPPORT_ABSTRACT_ASSEMBLY)
559 print_nmethod_labels(stream, block_begin);
560 CodeBlob::print_block_comment(stream, block_begin);
561 #endif
562 }
563 bool has_block_comment(address block_begin) {
564 return CodeBlob::has_block_comment(block_begin);
565 }
566 void print_nmethod_labels(outputStream* stream, address block_begin, bool print_section_labels=true) const;
567 const char* nmethod_section_label(address pos) const;
568
569 // returns whether this nmethod has code comments.
570 bool has_code_comment(address begin, address end);
571 // Prints a comment for one native instruction (reloc info, pc desc)
572 void print_code_comment_on(outputStream* st, int column, address begin, address end);
573
574 // Compiler task identification. Note that all OSR methods
575 // are numbered in an independent sequence if CICountOSR is true,
576 // and native method wrappers are also numbered independently if
577 // CICountNative is true.
578 virtual int compile_id() const { return _compile_id; }
579 const char* compile_kind() const;
580
581 // tells if any of this method's dependencies have been invalidated
582 // (this is expensive!)
583 static void check_all_dependencies(DepChange& changes);
584
585 // tells if this compiled method is dependent on the given changes,
586 // and the changes have invalidated it
587 bool check_dependency_on(DepChange& changes);
588
589 // Fast breakpoint support. Tells if this compiled method is
590 // dependent on the given method. Returns true if this nmethod
591 // corresponds to the given method as well.
592 virtual bool is_dependent_on_method(Method* dependee);
|