Mercurial > hg > truffle
comparison src/share/vm/code/nmethod.hpp @ 1563:1a5913bf5e19
6951083: oops and relocations should part of nmethod not CodeBlob
Summary: This moves the oops from Codeblob to nmethod.
Reviewed-by: kvn, never
author | twisti |
---|---|
date | Thu, 20 May 2010 06:34:23 -0700 |
parents | bfe29ec02863 |
children | e9ff18c4ace7 |
comparison
equal
deleted
inserted
replaced
1544:1a88d3c58e1d | 1563:1a5913bf5e19 |
---|---|
103 // A nmethod contains: | 103 // A nmethod contains: |
104 // - header (the nmethod structure) | 104 // - header (the nmethod structure) |
105 // [Relocation] | 105 // [Relocation] |
106 // - relocation information | 106 // - relocation information |
107 // - constant part (doubles, longs and floats used in nmethod) | 107 // - constant part (doubles, longs and floats used in nmethod) |
108 // - oop table | |
108 // [Code] | 109 // [Code] |
109 // - code body | 110 // - code body |
110 // - exception handler | 111 // - exception handler |
111 // - stub code | 112 // - stub code |
112 // [Debugging information] | 113 // [Debugging information] |
159 #ifdef HAVE_DTRACE_H | 160 #ifdef HAVE_DTRACE_H |
160 int _trap_offset; | 161 int _trap_offset; |
161 #endif // def HAVE_DTRACE_H | 162 #endif // def HAVE_DTRACE_H |
162 int _stub_offset; | 163 int _stub_offset; |
163 int _consts_offset; | 164 int _consts_offset; |
165 int _oops_offset; // offset to where embedded oop table begins (inside data) | |
164 int _scopes_data_offset; | 166 int _scopes_data_offset; |
165 int _scopes_pcs_offset; | 167 int _scopes_pcs_offset; |
166 int _dependencies_offset; | 168 int _dependencies_offset; |
167 int _handler_table_offset; | 169 int _handler_table_offset; |
168 int _nul_chk_table_offset; | 170 int _nul_chk_table_offset; |
345 address deopt_mh_handler_begin() const { return header_begin() + _deoptimize_mh_offset ; } | 347 address deopt_mh_handler_begin() const { return header_begin() + _deoptimize_mh_offset ; } |
346 address unwind_handler_begin () const { return _unwind_handler_offset != -1 ? (header_begin() + _unwind_handler_offset) : NULL; } | 348 address unwind_handler_begin () const { return _unwind_handler_offset != -1 ? (header_begin() + _unwind_handler_offset) : NULL; } |
347 address stub_begin () const { return header_begin() + _stub_offset ; } | 349 address stub_begin () const { return header_begin() + _stub_offset ; } |
348 address stub_end () const { return header_begin() + _consts_offset ; } | 350 address stub_end () const { return header_begin() + _consts_offset ; } |
349 address consts_begin () const { return header_begin() + _consts_offset ; } | 351 address consts_begin () const { return header_begin() + _consts_offset ; } |
350 address consts_end () const { return header_begin() + _scopes_data_offset ; } | 352 address consts_end () const { return header_begin() + _oops_offset ; } |
353 oop* oops_begin () const { return (oop*) (header_begin() + _oops_offset) ; } | |
354 oop* oops_end () const { return (oop*) (header_begin() + _scopes_data_offset) ; } | |
355 | |
351 address scopes_data_begin () const { return header_begin() + _scopes_data_offset ; } | 356 address scopes_data_begin () const { return header_begin() + _scopes_data_offset ; } |
352 address scopes_data_end () const { return header_begin() + _scopes_pcs_offset ; } | 357 address scopes_data_end () const { return header_begin() + _scopes_pcs_offset ; } |
353 PcDesc* scopes_pcs_begin () const { return (PcDesc*)(header_begin() + _scopes_pcs_offset ); } | 358 PcDesc* scopes_pcs_begin () const { return (PcDesc*)(header_begin() + _scopes_pcs_offset ); } |
354 PcDesc* scopes_pcs_end () const { return (PcDesc*)(header_begin() + _dependencies_offset) ; } | 359 PcDesc* scopes_pcs_end () const { return (PcDesc*)(header_begin() + _dependencies_offset) ; } |
355 address dependencies_begin () const { return header_begin() + _dependencies_offset ; } | 360 address dependencies_begin () const { return header_begin() + _dependencies_offset ; } |
357 address handler_table_begin () const { return header_begin() + _handler_table_offset ; } | 362 address handler_table_begin () const { return header_begin() + _handler_table_offset ; } |
358 address handler_table_end () const { return header_begin() + _nul_chk_table_offset ; } | 363 address handler_table_end () const { return header_begin() + _nul_chk_table_offset ; } |
359 address nul_chk_table_begin () const { return header_begin() + _nul_chk_table_offset ; } | 364 address nul_chk_table_begin () const { return header_begin() + _nul_chk_table_offset ; } |
360 address nul_chk_table_end () const { return header_begin() + _nmethod_end_offset ; } | 365 address nul_chk_table_end () const { return header_begin() + _nmethod_end_offset ; } |
361 | 366 |
362 int code_size () const { return code_end () - code_begin (); } | 367 // Sizes |
363 int stub_size () const { return stub_end () - stub_begin (); } | 368 int code_size () const { return code_end () - code_begin (); } |
364 int consts_size () const { return consts_end () - consts_begin (); } | 369 int stub_size () const { return stub_end () - stub_begin (); } |
365 int scopes_data_size () const { return scopes_data_end () - scopes_data_begin (); } | 370 int consts_size () const { return consts_end () - consts_begin (); } |
366 int scopes_pcs_size () const { return (intptr_t)scopes_pcs_end () - (intptr_t)scopes_pcs_begin (); } | 371 int oops_size () const { return (address) oops_end () - (address) oops_begin (); } |
367 int dependencies_size () const { return dependencies_end () - dependencies_begin (); } | 372 int scopes_data_size () const { return scopes_data_end () - scopes_data_begin (); } |
368 int handler_table_size() const { return handler_table_end() - handler_table_begin(); } | 373 int scopes_pcs_size () const { return (intptr_t) scopes_pcs_end () - (intptr_t) scopes_pcs_begin (); } |
369 int nul_chk_table_size() const { return nul_chk_table_end() - nul_chk_table_begin(); } | 374 int dependencies_size () const { return dependencies_end () - dependencies_begin (); } |
375 int handler_table_size() const { return handler_table_end() - handler_table_begin(); } | |
376 int nul_chk_table_size() const { return nul_chk_table_end() - nul_chk_table_begin(); } | |
370 | 377 |
371 int total_size () const; | 378 int total_size () const; |
372 | 379 |
380 // Containment | |
373 bool code_contains (address addr) const { return code_begin () <= addr && addr < code_end (); } | 381 bool code_contains (address addr) const { return code_begin () <= addr && addr < code_end (); } |
374 bool stub_contains (address addr) const { return stub_begin () <= addr && addr < stub_end (); } | 382 bool stub_contains (address addr) const { return stub_begin () <= addr && addr < stub_end (); } |
375 bool consts_contains (address addr) const { return consts_begin () <= addr && addr < consts_end (); } | 383 bool consts_contains (address addr) const { return consts_begin () <= addr && addr < consts_end (); } |
384 bool oops_contains (oop* addr) const { return oops_begin () <= addr && addr < oops_end (); } | |
376 bool scopes_data_contains (address addr) const { return scopes_data_begin () <= addr && addr < scopes_data_end (); } | 385 bool scopes_data_contains (address addr) const { return scopes_data_begin () <= addr && addr < scopes_data_end (); } |
377 bool scopes_pcs_contains (PcDesc* addr) const { return scopes_pcs_begin () <= addr && addr < scopes_pcs_end (); } | 386 bool scopes_pcs_contains (PcDesc* addr) const { return scopes_pcs_begin () <= addr && addr < scopes_pcs_end (); } |
378 bool handler_table_contains(address addr) const { return handler_table_begin() <= addr && addr < handler_table_end(); } | 387 bool handler_table_contains(address addr) const { return handler_table_begin() <= addr && addr < handler_table_end(); } |
379 bool nul_chk_table_contains(address addr) const { return nul_chk_table_begin() <= addr && addr < nul_chk_table_end(); } | 388 bool nul_chk_table_contains(address addr) const { return nul_chk_table_begin() <= addr && addr < nul_chk_table_end(); } |
380 | 389 |
428 | 437 |
429 int comp_level() const { return _comp_level; } | 438 int comp_level() const { return _comp_level; } |
430 | 439 |
431 int version() const { return flags.version; } | 440 int version() const { return flags.version; } |
432 void set_version(int v); | 441 void set_version(int v); |
442 | |
443 // Support for oops in scopes and relocs: | |
444 // Note: index 0 is reserved for null. | |
445 oop oop_at(int index) const { return index == 0 ? (oop) NULL: *oop_addr_at(index); } | |
446 oop* oop_addr_at(int index) const { // for GC | |
447 // relocation indexes are biased by 1 (because 0 is reserved) | |
448 assert(index > 0 && index <= oops_size(), "must be a valid non-zero index"); | |
449 return &oops_begin()[index - 1]; | |
450 } | |
451 | |
452 void copy_oops(GrowableArray<jobject>* oops); | |
453 | |
454 // Relocation support | |
455 private: | |
456 void fix_oop_relocations(address begin, address end, bool initialize_immediates); | |
457 inline void initialize_immediate_oop(oop* dest, jobject handle); | |
458 | |
459 public: | |
460 void fix_oop_relocations(address begin, address end) { fix_oop_relocations(begin, end, false); } | |
461 void fix_oop_relocations() { fix_oop_relocations(NULL, NULL, false); } | |
462 | |
463 bool is_at_poll_return(address pc); | |
464 bool is_at_poll_or_poll_return(address pc); | |
433 | 465 |
434 // Non-perm oop support | 466 // Non-perm oop support |
435 bool on_scavenge_root_list() const { return (_scavenge_root_state & 1) != 0; } | 467 bool on_scavenge_root_list() const { return (_scavenge_root_state & 1) != 0; } |
436 protected: | 468 protected: |
437 enum { npl_on_list = 0x01, npl_marked = 0x10 }; | 469 enum { npl_on_list = 0x01, npl_marked = 0x10 }; |
509 bool can_unload(BoolObjectClosure* is_alive, OopClosure* keep_alive, | 541 bool can_unload(BoolObjectClosure* is_alive, OopClosure* keep_alive, |
510 oop* root, bool unloading_occurred); | 542 oop* root, bool unloading_occurred); |
511 | 543 |
512 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, | 544 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, |
513 OopClosure* f); | 545 OopClosure* f); |
514 virtual void oops_do(OopClosure* f) { oops_do(f, false); } | 546 void oops_do(OopClosure* f) { oops_do(f, false); } |
515 void oops_do(OopClosure* f, bool do_strong_roots_only); | 547 void oops_do(OopClosure* f, bool do_strong_roots_only); |
516 bool detect_scavenge_root_oops(); | 548 bool detect_scavenge_root_oops(); |
517 void verify_scavenge_root_oops() PRODUCT_RETURN; | 549 void verify_scavenge_root_oops() PRODUCT_RETURN; |
518 | 550 |
519 bool test_set_oops_do_mark(); | 551 bool test_set_oops_do_mark(); |
520 static void oops_do_marking_prologue(); | 552 static void oops_do_marking_prologue(); |