comparison src/share/vm/code/nmethod.cpp @ 8215:b89a97928e72

Implement weak reference semantics for HotSpotInstalledCode in the default method installation case. Add new boolean[] array as parameter to the code installation.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 11 Mar 2013 20:55:05 +0100
parents a357b7a3de5e
children 985a97ba083c
comparison
equal deleted inserted replaced
8205:9efef773f521 8215:b89a97928e72
488 _scavenge_root_state = 0; 488 _scavenge_root_state = 0;
489 _saved_nmethod_link = NULL; 489 _saved_nmethod_link = NULL;
490 _compiler = NULL; 490 _compiler = NULL;
491 #ifdef GRAAL 491 #ifdef GRAAL
492 _graal_installed_code = NULL; 492 _graal_installed_code = NULL;
493 _triggered_deoptimizations = NULL;
493 #endif 494 #endif
494 #ifdef HAVE_DTRACE_H 495 #ifdef HAVE_DTRACE_H
495 _trap_offset = 0; 496 _trap_offset = 0;
496 #endif // def HAVE_DTRACE_H 497 #endif // def HAVE_DTRACE_H
497 } 498 }
583 ImplicitExceptionTable* nul_chk_table, 584 ImplicitExceptionTable* nul_chk_table,
584 AbstractCompiler* compiler, 585 AbstractCompiler* compiler,
585 int comp_level, 586 int comp_level,
586 GrowableArray<jlong>* leaf_graph_ids 587 GrowableArray<jlong>* leaf_graph_ids
587 #ifdef GRAAL 588 #ifdef GRAAL
588 , Handle installed_code 589 , Handle installed_code,
590 Handle triggered_deoptimizations
589 #endif 591 #endif
590 ) 592 )
591 { 593 {
592 assert(debug_info->oop_recorder() == code_buffer->oop_recorder(), "shared OR"); 594 assert(debug_info->oop_recorder() == code_buffer->oop_recorder(), "shared OR");
593 code_buffer->finalize_oop_references(method); 595 code_buffer->finalize_oop_references(method);
611 nul_chk_table, 613 nul_chk_table,
612 compiler, 614 compiler,
613 comp_level, 615 comp_level,
614 leaf_graph_ids 616 leaf_graph_ids
615 #ifdef GRAAL 617 #ifdef GRAAL
616 , installed_code 618 , installed_code,
619 triggered_deoptimizations
617 #endif 620 #endif
618 ); 621 );
619 if (nm != NULL) { 622 if (nm != NULL) {
620 // To make dependency checking during class loading fast, record 623 // To make dependency checking during class loading fast, record
621 // the nmethod dependencies in the classes it is dependent on. 624 // the nmethod dependencies in the classes it is dependent on.
837 ImplicitExceptionTable* nul_chk_table, 840 ImplicitExceptionTable* nul_chk_table,
838 AbstractCompiler* compiler, 841 AbstractCompiler* compiler,
839 int comp_level, 842 int comp_level,
840 GrowableArray<jlong>* leaf_graph_ids 843 GrowableArray<jlong>* leaf_graph_ids
841 #ifdef GRAAL 844 #ifdef GRAAL
842 , Handle installed_code 845 , Handle installed_code,
846 Handle triggered_deoptimizations
843 #endif 847 #endif
844 ) 848 )
845 : CodeBlob("nmethod", code_buffer, sizeof(nmethod), 849 : CodeBlob("nmethod", code_buffer, sizeof(nmethod),
846 nmethod_size, offsets->value(CodeOffsets::Frame_Complete), frame_size, oop_maps), 850 nmethod_size, offsets->value(CodeOffsets::Frame_Complete), frame_size, oop_maps),
847 _native_receiver_sp_offset(in_ByteSize(-1)), 851 _native_receiver_sp_offset(in_ByteSize(-1)),
864 _consts_offset = content_offset() + code_buffer->total_offset_of(code_buffer->consts()); 868 _consts_offset = content_offset() + code_buffer->total_offset_of(code_buffer->consts());
865 _stub_offset = content_offset() + code_buffer->total_offset_of(code_buffer->stubs()); 869 _stub_offset = content_offset() + code_buffer->total_offset_of(code_buffer->stubs());
866 870
867 #ifdef GRAAL 871 #ifdef GRAAL
868 _graal_installed_code = installed_code(); 872 _graal_installed_code = installed_code();
873 _triggered_deoptimizations = (typeArrayOop)triggered_deoptimizations();
869 #endif 874 #endif
870 if (compiler->is_graal()) { 875 if (compiler->is_graal()) {
871 // Graal might not produce any stub sections 876 // Graal might not produce any stub sections
872 if (offsets->value(CodeOffsets::Exceptions) != -1) { 877 if (offsets->value(CodeOffsets::Exceptions) != -1) {
873 _exception_offset = code_offset() + offsets->value(CodeOffsets::Exceptions); 878 _exception_offset = code_offset() + offsets->value(CodeOffsets::Exceptions);
1683 unloading_occurred = true; 1688 unloading_occurred = true;
1684 } 1689 }
1685 1690
1686 #ifdef GRAAL 1691 #ifdef GRAAL
1687 // Follow Graal method 1692 // Follow Graal method
1688 if (_graal_installed_code != NULL && can_unload(is_alive, (oop*)&_graal_installed_code, unloading_occurred)) { 1693 if (_graal_installed_code != NULL) {
1689 return; 1694 if (HotSpotInstalledCode::isDefault(_graal_installed_code)) {
1695 if (!is_alive->do_object_b(_graal_installed_code)) {
1696 _graal_installed_code = NULL;
1697 }
1698 } else {
1699 if (can_unload(is_alive, (oop*)&_graal_installed_code, unloading_occurred)) {
1700 return;
1701 }
1702 }
1690 } 1703 }
1691 #endif 1704 #endif
1692 1705
1693 // Exception cache 1706 // Exception cache
1694 ExceptionCache* ec = exception_cache(); 1707 ExceptionCache* ec = exception_cache();
1908 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. 1921 // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump.
1909 // (See comment above.) 1922 // (See comment above.)
1910 } 1923 }
1911 1924
1912 #ifdef GRAAL 1925 #ifdef GRAAL
1913 if (_graal_installed_code != NULL) { 1926 if(_graal_installed_code != NULL) {
1914 f->do_oop((oop*) &_graal_installed_code); 1927 f->do_oop((oop*) &_graal_installed_code);
1928 }
1929 if (_triggered_deoptimizations != NULL) {
1930 f->do_oop((oop*) &_triggered_deoptimizations);
1915 } 1931 }
1916 #endif 1932 #endif
1917 1933
1918 RelocIterator iter(this, low_boundary); 1934 RelocIterator iter(this, low_boundary);
1919 1935