Mercurial > hg > graal-jvmci-8
comparison src/share/vm/code/nmethod.hpp @ 1204:18a389214829
6921352: 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 | Mon, 01 Feb 2010 19:29:46 +0100 |
parents | 5f24d0319e54 |
children | 9f5b60a14736 |
comparison
equal
deleted
inserted
replaced
1203:844a9d73ec22 | 1204:18a389214829 |
---|---|
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. |
146 | 146 |
147 AbstractCompiler* _compiler; // The compiler which compiled this nmethod | 147 AbstractCompiler* _compiler; // The compiler which compiled this nmethod |
148 | 148 |
149 // Offsets for different nmethod parts | 149 // Offsets for different nmethod parts |
150 int _exception_offset; | 150 int _exception_offset; |
151 // All deoptee's will resume execution at this location described by this offset | 151 // All deoptee's will resume execution at this location described by |
152 // this offset. | |
152 int _deoptimize_offset; | 153 int _deoptimize_offset; |
154 // All deoptee's at a MethodHandle call site will resume execution | |
155 // at this location described by this offset. | |
156 int _deoptimize_mh_offset; | |
153 #ifdef HAVE_DTRACE_H | 157 #ifdef HAVE_DTRACE_H |
154 int _trap_offset; | 158 int _trap_offset; |
155 #endif // def HAVE_DTRACE_H | 159 #endif // def HAVE_DTRACE_H |
156 int _stub_offset; | 160 int _stub_offset; |
157 int _consts_offset; | 161 int _consts_offset; |
330 | 334 |
331 bool is_compiled_by_c1() const; | 335 bool is_compiled_by_c1() const; |
332 bool is_compiled_by_c2() const; | 336 bool is_compiled_by_c2() const; |
333 | 337 |
334 // boundaries for different parts | 338 // boundaries for different parts |
335 address code_begin () const { return _entry_point; } | 339 address code_begin () const { return _entry_point; } |
336 address code_end () const { return header_begin() + _stub_offset ; } | 340 address code_end () const { return header_begin() + _stub_offset ; } |
337 address exception_begin () const { return header_begin() + _exception_offset ; } | 341 address exception_begin () const { return header_begin() + _exception_offset ; } |
338 address deopt_handler_begin() const { return header_begin() + _deoptimize_offset ; } | 342 address deopt_handler_begin () const { return header_begin() + _deoptimize_offset ; } |
339 address stub_begin () const { return header_begin() + _stub_offset ; } | 343 address deopt_mh_handler_begin() const { return header_begin() + _deoptimize_mh_offset ; } |
340 address stub_end () const { return header_begin() + _consts_offset ; } | 344 address stub_begin () const { return header_begin() + _stub_offset ; } |
341 address consts_begin () const { return header_begin() + _consts_offset ; } | 345 address stub_end () const { return header_begin() + _consts_offset ; } |
342 address consts_end () const { return header_begin() + _scopes_data_offset ; } | 346 address consts_begin () const { return header_begin() + _consts_offset ; } |
343 address scopes_data_begin () const { return header_begin() + _scopes_data_offset ; } | 347 address consts_end () const { return header_begin() + _scopes_data_offset ; } |
344 address scopes_data_end () const { return header_begin() + _scopes_pcs_offset ; } | 348 address scopes_data_begin () const { return header_begin() + _scopes_data_offset ; } |
345 PcDesc* scopes_pcs_begin () const { return (PcDesc*)(header_begin() + _scopes_pcs_offset ); } | 349 address scopes_data_end () const { return header_begin() + _scopes_pcs_offset ; } |
346 PcDesc* scopes_pcs_end () const { return (PcDesc*)(header_begin() + _dependencies_offset); } | 350 PcDesc* scopes_pcs_begin () const { return (PcDesc*)(header_begin() + _scopes_pcs_offset ); } |
347 address dependencies_begin () const { return header_begin() + _dependencies_offset ; } | 351 PcDesc* scopes_pcs_end () const { return (PcDesc*)(header_begin() + _dependencies_offset) ; } |
348 address dependencies_end () const { return header_begin() + _handler_table_offset ; } | 352 address dependencies_begin () const { return header_begin() + _dependencies_offset ; } |
349 address handler_table_begin() const { return header_begin() + _handler_table_offset ; } | 353 address dependencies_end () const { return header_begin() + _handler_table_offset ; } |
350 address handler_table_end () const { return header_begin() + _nul_chk_table_offset ; } | 354 address handler_table_begin () const { return header_begin() + _handler_table_offset ; } |
351 address nul_chk_table_begin() const { return header_begin() + _nul_chk_table_offset ; } | 355 address handler_table_end () const { return header_begin() + _nul_chk_table_offset ; } |
352 address nul_chk_table_end () const { return header_begin() + _nmethod_end_offset ; } | 356 address nul_chk_table_begin () const { return header_begin() + _nul_chk_table_offset ; } |
357 address nul_chk_table_end () const { return header_begin() + _nmethod_end_offset ; } | |
353 | 358 |
354 int code_size () const { return code_end () - code_begin (); } | 359 int code_size () const { return code_end () - code_begin (); } |
355 int stub_size () const { return stub_end () - stub_begin (); } | 360 int stub_size () const { return stub_end () - stub_begin (); } |
356 int consts_size () const { return consts_end () - consts_begin (); } | 361 int consts_size () const { return consts_end () - consts_begin (); } |
357 int scopes_data_size () const { return scopes_data_end () - scopes_data_begin (); } | 362 int scopes_data_size () const { return scopes_data_end () - scopes_data_begin (); } |
522 ScopeDesc* scope_desc_at(address pc); | 527 ScopeDesc* scope_desc_at(address pc); |
523 | 528 |
524 private: | 529 private: |
525 ScopeDesc* scope_desc_in(address begin, address end); | 530 ScopeDesc* scope_desc_in(address begin, address end); |
526 | 531 |
527 address* orig_pc_addr(const frame* fr ) { return (address*) ((address)fr->unextended_sp() + _orig_pc_offset); } | 532 address* orig_pc_addr(const frame* fr) { return (address*) ((address)fr->unextended_sp() + _orig_pc_offset); } |
528 | 533 |
529 PcDesc* find_pc_desc_internal(address pc, bool approximate); | 534 PcDesc* find_pc_desc_internal(address pc, bool approximate); |
530 | 535 |
531 PcDesc* find_pc_desc(address pc, bool approximate) { | 536 PcDesc* find_pc_desc(address pc, bool approximate) { |
532 PcDesc* desc = _pc_desc_cache.last_pc_desc(); | 537 PcDesc* desc = _pc_desc_cache.last_pc_desc(); |
545 public: | 550 public: |
546 // copying of debugging information | 551 // copying of debugging information |
547 void copy_scopes_pcs(PcDesc* pcs, int count); | 552 void copy_scopes_pcs(PcDesc* pcs, int count); |
548 void copy_scopes_data(address buffer, int size); | 553 void copy_scopes_data(address buffer, int size); |
549 | 554 |
550 // deopt | 555 // Deopt |
551 // return true is the pc is one would expect if the frame is being deopted. | 556 // Return true is the PC is one would expect if the frame is being deopted. |
552 bool is_deopt_pc(address pc); | 557 bool is_deopt_pc (address pc) { return is_deopt_entry(pc) || is_deopt_mh_entry(pc); } |
558 bool is_deopt_entry (address pc) { return pc == deopt_handler_begin(); } | |
559 bool is_deopt_mh_entry(address pc) { return pc == deopt_mh_handler_begin(); } | |
553 // Accessor/mutator for the original pc of a frame before a frame was deopted. | 560 // Accessor/mutator for the original pc of a frame before a frame was deopted. |
554 address get_original_pc(const frame* fr) { return *orig_pc_addr(fr); } | 561 address get_original_pc(const frame* fr) { return *orig_pc_addr(fr); } |
555 void set_original_pc(const frame* fr, address pc) { *orig_pc_addr(fr) = pc; } | 562 void set_original_pc(const frame* fr, address pc) { *orig_pc_addr(fr) = pc; } |
563 | |
564 static address get_deopt_original_pc(const frame* fr); | |
556 | 565 |
557 // MethodHandle | 566 // MethodHandle |
558 bool is_method_handle_return(address return_pc); | 567 bool is_method_handle_return(address return_pc); |
559 | 568 |
560 // jvmti support: | 569 // jvmti support: |