comparison src/share/vm/code/nmethod.cpp @ 1762:0878d7bae69f

6961697: move nmethod constants section before instruction section Summary: This is a preparation for 6961690. Reviewed-by: kvn, never
author twisti
date Fri, 27 Aug 2010 01:51:27 -0700
parents 3e8fbc61cee8
children d5d065957597
comparison
equal deleted inserted replaced
1761:14b92b91f460 1762:0878d7bae69f
85 static 85 static
86 struct nmethod_stats_struct { 86 struct nmethod_stats_struct {
87 int nmethod_count; 87 int nmethod_count;
88 int total_size; 88 int total_size;
89 int relocation_size; 89 int relocation_size;
90 int consts_size;
90 int insts_size; 91 int insts_size;
91 int stub_size; 92 int stub_size;
92 int consts_size;
93 int scopes_data_size; 93 int scopes_data_size;
94 int scopes_pcs_size; 94 int scopes_pcs_size;
95 int dependencies_size; 95 int dependencies_size;
96 int handler_table_size; 96 int handler_table_size;
97 int nul_chk_table_size; 97 int nul_chk_table_size;
99 99
100 void note_nmethod(nmethod* nm) { 100 void note_nmethod(nmethod* nm) {
101 nmethod_count += 1; 101 nmethod_count += 1;
102 total_size += nm->size(); 102 total_size += nm->size();
103 relocation_size += nm->relocation_size(); 103 relocation_size += nm->relocation_size();
104 consts_size += nm->consts_size();
104 insts_size += nm->insts_size(); 105 insts_size += nm->insts_size();
105 stub_size += nm->stub_size(); 106 stub_size += nm->stub_size();
106 consts_size += nm->consts_size();
107 oops_size += nm->oops_size(); 107 oops_size += nm->oops_size();
108 scopes_data_size += nm->scopes_data_size(); 108 scopes_data_size += nm->scopes_data_size();
109 scopes_pcs_size += nm->scopes_pcs_size(); 109 scopes_pcs_size += nm->scopes_pcs_size();
110 dependencies_size += nm->dependencies_size(); 110 dependencies_size += nm->dependencies_size();
111 handler_table_size += nm->handler_table_size(); 111 handler_table_size += nm->handler_table_size();
114 void print_nmethod_stats() { 114 void print_nmethod_stats() {
115 if (nmethod_count == 0) return; 115 if (nmethod_count == 0) return;
116 tty->print_cr("Statistics for %d bytecoded nmethods:", nmethod_count); 116 tty->print_cr("Statistics for %d bytecoded nmethods:", nmethod_count);
117 if (total_size != 0) tty->print_cr(" total in heap = %d", total_size); 117 if (total_size != 0) tty->print_cr(" total in heap = %d", total_size);
118 if (relocation_size != 0) tty->print_cr(" relocation = %d", relocation_size); 118 if (relocation_size != 0) tty->print_cr(" relocation = %d", relocation_size);
119 if (consts_size != 0) tty->print_cr(" constants = %d", consts_size);
119 if (insts_size != 0) tty->print_cr(" main code = %d", insts_size); 120 if (insts_size != 0) tty->print_cr(" main code = %d", insts_size);
120 if (stub_size != 0) tty->print_cr(" stub code = %d", stub_size); 121 if (stub_size != 0) tty->print_cr(" stub code = %d", stub_size);
121 if (consts_size != 0) tty->print_cr(" constants = %d", consts_size);
122 if (oops_size != 0) tty->print_cr(" oops = %d", oops_size); 122 if (oops_size != 0) tty->print_cr(" oops = %d", oops_size);
123 if (scopes_data_size != 0) tty->print_cr(" scopes data = %d", scopes_data_size); 123 if (scopes_data_size != 0) tty->print_cr(" scopes data = %d", scopes_data_size);
124 if (scopes_pcs_size != 0) tty->print_cr(" scopes pcs = %d", scopes_pcs_size); 124 if (scopes_pcs_size != 0) tty->print_cr(" scopes pcs = %d", scopes_pcs_size);
125 if (dependencies_size != 0) tty->print_cr(" dependencies = %d", dependencies_size); 125 if (dependencies_size != 0) tty->print_cr(" dependencies = %d", dependencies_size);
126 if (handler_table_size != 0) tty->print_cr(" handler table = %d", handler_table_size); 126 if (handler_table_size != 0) tty->print_cr(" handler table = %d", handler_table_size);
402 //-------------end of code for ExceptionCache-------------- 402 //-------------end of code for ExceptionCache--------------
403 403
404 404
405 int nmethod::total_size() const { 405 int nmethod::total_size() const {
406 return 406 return
407 consts_size() +
407 insts_size() + 408 insts_size() +
408 stub_size() + 409 stub_size() +
409 consts_size() +
410 scopes_data_size() + 410 scopes_data_size() +
411 scopes_pcs_size() + 411 scopes_pcs_size() +
412 handler_table_size() + 412 handler_table_size() +
413 nul_chk_table_size(); 413 nul_chk_table_size();
414 } 414 }
787 _comp_level = comp_level; 787 _comp_level = comp_level;
788 _compiler = compiler; 788 _compiler = compiler;
789 _orig_pc_offset = orig_pc_offset; 789 _orig_pc_offset = orig_pc_offset;
790 790
791 // Section offsets 791 // Section offsets
792 _consts_offset = content_offset() + code_buffer->total_offset_of(code_buffer->consts()->start()); 792 _consts_offset = content_offset() + code_buffer->total_offset_of(code_buffer->consts());
793 _stub_offset = content_offset() + code_buffer->total_offset_of(code_buffer->stubs()->start()); 793 _stub_offset = content_offset() + code_buffer->total_offset_of(code_buffer->stubs());
794 794
795 // Exception handler and deopt handler are in the stub section 795 // Exception handler and deopt handler are in the stub section
796 _exception_offset = _stub_offset + offsets->value(CodeOffsets::Exceptions); 796 _exception_offset = _stub_offset + offsets->value(CodeOffsets::Exceptions);
797 _deoptimize_offset = _stub_offset + offsets->value(CodeOffsets::Deopt); 797 _deoptimize_offset = _stub_offset + offsets->value(CodeOffsets::Deopt);
798 _deoptimize_mh_offset = _stub_offset + offsets->value(CodeOffsets::DeoptMH); 798 if (has_method_handle_invokes()) {
799 _deoptimize_mh_offset = _stub_offset + offsets->value(CodeOffsets::DeoptMH);
800 } else {
801 _deoptimize_mh_offset = -1;
802 }
799 if (offsets->value(CodeOffsets::UnwindHandler) != -1) { 803 if (offsets->value(CodeOffsets::UnwindHandler) != -1) {
800 _unwind_handler_offset = code_offset() + offsets->value(CodeOffsets::UnwindHandler); 804 _unwind_handler_offset = code_offset() + offsets->value(CodeOffsets::UnwindHandler);
801 } else { 805 } else {
802 _unwind_handler_offset = -1; 806 _unwind_handler_offset = -1;
803 } 807 }
883 log_identity(xtty); 887 log_identity(xtty);
884 xtty->print(" entry='" INTPTR_FORMAT "' size='%d'", code_begin(), size()); 888 xtty->print(" entry='" INTPTR_FORMAT "' size='%d'", code_begin(), size());
885 xtty->print(" address='" INTPTR_FORMAT "'", (intptr_t) this); 889 xtty->print(" address='" INTPTR_FORMAT "'", (intptr_t) this);
886 890
887 LOG_OFFSET(xtty, relocation); 891 LOG_OFFSET(xtty, relocation);
892 LOG_OFFSET(xtty, consts);
888 LOG_OFFSET(xtty, insts); 893 LOG_OFFSET(xtty, insts);
889 LOG_OFFSET(xtty, stub); 894 LOG_OFFSET(xtty, stub);
890 LOG_OFFSET(xtty, consts);
891 LOG_OFFSET(xtty, scopes_data); 895 LOG_OFFSET(xtty, scopes_data);
892 LOG_OFFSET(xtty, scopes_pcs); 896 LOG_OFFSET(xtty, scopes_pcs);
893 LOG_OFFSET(xtty, dependencies); 897 LOG_OFFSET(xtty, dependencies);
894 LOG_OFFSET(xtty, handler_table); 898 LOG_OFFSET(xtty, handler_table);
895 LOG_OFFSET(xtty, nul_chk_table); 899 LOG_OFFSET(xtty, nul_chk_table);
2334 size()); 2338 size());
2335 if (relocation_size () > 0) tty->print_cr(" relocation [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", 2339 if (relocation_size () > 0) tty->print_cr(" relocation [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2336 relocation_begin(), 2340 relocation_begin(),
2337 relocation_end(), 2341 relocation_end(),
2338 relocation_size()); 2342 relocation_size());
2343 if (consts_size () > 0) tty->print_cr(" constants [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2344 consts_begin(),
2345 consts_end(),
2346 consts_size());
2339 if (insts_size () > 0) tty->print_cr(" main code [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", 2347 if (insts_size () > 0) tty->print_cr(" main code [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2340 insts_begin(), 2348 insts_begin(),
2341 insts_end(), 2349 insts_end(),
2342 insts_size()); 2350 insts_size());
2343 if (stub_size () > 0) tty->print_cr(" stub code [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", 2351 if (stub_size () > 0) tty->print_cr(" stub code [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2344 stub_begin(), 2352 stub_begin(),
2345 stub_end(), 2353 stub_end(),
2346 stub_size()); 2354 stub_size());
2347 if (consts_size () > 0) tty->print_cr(" constants [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2348 consts_begin(),
2349 consts_end(),
2350 consts_size());
2351 if (oops_size () > 0) tty->print_cr(" oops [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", 2355 if (oops_size () > 0) tty->print_cr(" oops [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2352 oops_begin(), 2356 oops_begin(),
2353 oops_end(), 2357 oops_end(),
2354 oops_size()); 2358 oops_size());
2355 if (scopes_data_size () > 0) tty->print_cr(" scopes data [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", 2359 if (scopes_data_size () > 0) tty->print_cr(" scopes data [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2370 handler_table_size()); 2374 handler_table_size());
2371 if (nul_chk_table_size() > 0) tty->print_cr(" nul chk table [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d", 2375 if (nul_chk_table_size() > 0) tty->print_cr(" nul chk table [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2372 nul_chk_table_begin(), 2376 nul_chk_table_begin(),
2373 nul_chk_table_end(), 2377 nul_chk_table_end(),
2374 nul_chk_table_size()); 2378 nul_chk_table_size());
2375 if (oops_size () > 0) tty->print_cr(" oops [" INTPTR_FORMAT "," INTPTR_FORMAT "] = %d",
2376 oops_begin(),
2377 oops_end(),
2378 oops_size());
2379 } 2379 }
2380 2380
2381 void nmethod::print_code() { 2381 void nmethod::print_code() {
2382 HandleMark hm; 2382 HandleMark hm;
2383 ResourceMark m; 2383 ResourceMark m;