Mercurial > hg > graal-jvmci-8
comparison src/share/vm/code/nmethod.hpp @ 1200:ba263cfb7611
6917766: JSR 292 needs its own deopt handler
Summary: We need to introduce a new MH deopt handler so we can easily determine if the deopt happened at a MH call site or not.
Reviewed-by: never, jrose
author | twisti |
---|---|
date | Fri, 29 Jan 2010 12:13:05 +0100 |
parents | 4e6abf09f540 |
children | 24128c2ffa87 |
comparison
equal
deleted
inserted
replaced
1199:0e14bd797dad | 1200:ba263cfb7611 |
---|---|
1 /* | 1 /* |
2 * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. | 2 * Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
143 | 143 |
144 AbstractCompiler* _compiler; // The compiler which compiled this nmethod | 144 AbstractCompiler* _compiler; // The compiler which compiled this nmethod |
145 | 145 |
146 // Offsets for different nmethod parts | 146 // Offsets for different nmethod parts |
147 int _exception_offset; | 147 int _exception_offset; |
148 // All deoptee's will resume execution at this location described by this offset | 148 // All deoptee's will resume execution at this location described by |
149 // this offset. | |
149 int _deoptimize_offset; | 150 int _deoptimize_offset; |
151 // All deoptee's at a MethodHandle call site will resume execution | |
152 // at this location described by this offset. | |
153 int _deoptimize_mh_offset; | |
150 #ifdef HAVE_DTRACE_H | 154 #ifdef HAVE_DTRACE_H |
151 int _trap_offset; | 155 int _trap_offset; |
152 #endif // def HAVE_DTRACE_H | 156 #endif // def HAVE_DTRACE_H |
153 int _stub_offset; | 157 int _stub_offset; |
154 int _consts_offset; | 158 int _consts_offset; |
327 | 331 |
328 bool is_compiled_by_c1() const; | 332 bool is_compiled_by_c1() const; |
329 bool is_compiled_by_c2() const; | 333 bool is_compiled_by_c2() const; |
330 | 334 |
331 // boundaries for different parts | 335 // boundaries for different parts |
332 address code_begin () const { return _entry_point; } | 336 address code_begin () const { return _entry_point; } |
333 address code_end () const { return header_begin() + _stub_offset ; } | 337 address code_end () const { return header_begin() + _stub_offset ; } |
334 address exception_begin () const { return header_begin() + _exception_offset ; } | 338 address exception_begin () const { return header_begin() + _exception_offset ; } |
335 address deopt_handler_begin() const { return header_begin() + _deoptimize_offset ; } | 339 address deopt_handler_begin () const { return header_begin() + _deoptimize_offset ; } |
336 address stub_begin () const { return header_begin() + _stub_offset ; } | 340 address deopt_mh_handler_begin() const { return header_begin() + _deoptimize_mh_offset ; } |
337 address stub_end () const { return header_begin() + _consts_offset ; } | 341 address stub_begin () const { return header_begin() + _stub_offset ; } |
338 address consts_begin () const { return header_begin() + _consts_offset ; } | 342 address stub_end () const { return header_begin() + _consts_offset ; } |
339 address consts_end () const { return header_begin() + _scopes_data_offset ; } | 343 address consts_begin () const { return header_begin() + _consts_offset ; } |
340 address scopes_data_begin () const { return header_begin() + _scopes_data_offset ; } | 344 address consts_end () const { return header_begin() + _scopes_data_offset ; } |
341 address scopes_data_end () const { return header_begin() + _scopes_pcs_offset ; } | 345 address scopes_data_begin () const { return header_begin() + _scopes_data_offset ; } |
342 PcDesc* scopes_pcs_begin () const { return (PcDesc*)(header_begin() + _scopes_pcs_offset ); } | 346 address scopes_data_end () const { return header_begin() + _scopes_pcs_offset ; } |
343 PcDesc* scopes_pcs_end () const { return (PcDesc*)(header_begin() + _dependencies_offset); } | 347 PcDesc* scopes_pcs_begin () const { return (PcDesc*)(header_begin() + _scopes_pcs_offset ); } |
344 address dependencies_begin () const { return header_begin() + _dependencies_offset ; } | 348 PcDesc* scopes_pcs_end () const { return (PcDesc*)(header_begin() + _dependencies_offset) ; } |
345 address dependencies_end () const { return header_begin() + _handler_table_offset ; } | 349 address dependencies_begin () const { return header_begin() + _dependencies_offset ; } |
346 address handler_table_begin() const { return header_begin() + _handler_table_offset ; } | 350 address dependencies_end () const { return header_begin() + _handler_table_offset ; } |
347 address handler_table_end () const { return header_begin() + _nul_chk_table_offset ; } | 351 address handler_table_begin () const { return header_begin() + _handler_table_offset ; } |
348 address nul_chk_table_begin() const { return header_begin() + _nul_chk_table_offset ; } | 352 address handler_table_end () const { return header_begin() + _nul_chk_table_offset ; } |
349 address nul_chk_table_end () const { return header_begin() + _nmethod_end_offset ; } | 353 address nul_chk_table_begin () const { return header_begin() + _nul_chk_table_offset ; } |
354 address nul_chk_table_end () const { return header_begin() + _nmethod_end_offset ; } | |
350 | 355 |
351 int code_size () const { return code_end () - code_begin (); } | 356 int code_size () const { return code_end () - code_begin (); } |
352 int stub_size () const { return stub_end () - stub_begin (); } | 357 int stub_size () const { return stub_end () - stub_begin (); } |
353 int consts_size () const { return consts_end () - consts_begin (); } | 358 int consts_size () const { return consts_end () - consts_begin (); } |
354 int scopes_data_size () const { return scopes_data_end () - scopes_data_begin (); } | 359 int scopes_data_size () const { return scopes_data_end () - scopes_data_begin (); } |
513 ScopeDesc* scope_desc_at(address pc); | 518 ScopeDesc* scope_desc_at(address pc); |
514 | 519 |
515 private: | 520 private: |
516 ScopeDesc* scope_desc_in(address begin, address end); | 521 ScopeDesc* scope_desc_in(address begin, address end); |
517 | 522 |
518 address* orig_pc_addr(const frame* fr ) { return (address*) ((address)fr->unextended_sp() + _orig_pc_offset); } | 523 address* orig_pc_addr(const frame* fr) { return (address*) ((address)fr->unextended_sp() + _orig_pc_offset); } |
519 | 524 |
520 PcDesc* find_pc_desc_internal(address pc, bool approximate); | 525 PcDesc* find_pc_desc_internal(address pc, bool approximate); |
521 | 526 |
522 PcDesc* find_pc_desc(address pc, bool approximate) { | 527 PcDesc* find_pc_desc(address pc, bool approximate) { |
523 PcDesc* desc = _pc_desc_cache.last_pc_desc(); | 528 PcDesc* desc = _pc_desc_cache.last_pc_desc(); |
536 public: | 541 public: |
537 // copying of debugging information | 542 // copying of debugging information |
538 void copy_scopes_pcs(PcDesc* pcs, int count); | 543 void copy_scopes_pcs(PcDesc* pcs, int count); |
539 void copy_scopes_data(address buffer, int size); | 544 void copy_scopes_data(address buffer, int size); |
540 | 545 |
541 // deopt | 546 // Deopt |
542 // return true is the pc is one would expect if the frame is being deopted. | 547 // Return true is the PC is one would expect if the frame is being deopted. |
543 bool is_deopt_pc(address pc); | 548 bool is_deopt_pc (address pc) { return is_deopt_entry(pc) || is_deopt_mh_entry(pc); } |
549 bool is_deopt_entry (address pc) { return pc == deopt_handler_begin(); } | |
550 bool is_deopt_mh_entry(address pc) { return pc == deopt_mh_handler_begin(); } | |
544 // Accessor/mutator for the original pc of a frame before a frame was deopted. | 551 // Accessor/mutator for the original pc of a frame before a frame was deopted. |
545 address get_original_pc(const frame* fr) { return *orig_pc_addr(fr); } | 552 address get_original_pc(const frame* fr) { return *orig_pc_addr(fr); } |
546 void set_original_pc(const frame* fr, address pc) { *orig_pc_addr(fr) = pc; } | 553 void set_original_pc(const frame* fr, address pc) { *orig_pc_addr(fr) = pc; } |
554 | |
555 static address get_deopt_original_pc(const frame* fr); | |
547 | 556 |
548 // MethodHandle | 557 // MethodHandle |
549 bool is_method_handle_return(address return_pc); | 558 bool is_method_handle_return(address return_pc); |
550 | 559 |
551 // jvmti support: | 560 // jvmti support: |