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