Mon, 28 Feb 2011 06:07:12 -0800
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
Reviewed-by: never, bdelsart
duke@435 | 1 | /* |
stefank@2314 | 2 | * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #ifndef SHARE_VM_CODE_PCDESC_HPP |
stefank@2314 | 26 | #define SHARE_VM_CODE_PCDESC_HPP |
stefank@2314 | 27 | |
stefank@2314 | 28 | #include "memory/allocation.hpp" |
stefank@2314 | 29 | |
duke@435 | 30 | // PcDescs map a physical PC (given as offset from start of nmethod) to |
duke@435 | 31 | // the corresponding source scope and byte code index. |
duke@435 | 32 | |
duke@435 | 33 | class nmethod; |
duke@435 | 34 | |
duke@435 | 35 | class PcDesc VALUE_OBJ_CLASS_SPEC { |
duke@435 | 36 | friend class VMStructs; |
duke@435 | 37 | private: |
duke@435 | 38 | int _pc_offset; // offset from start of nmethod |
duke@435 | 39 | int _scope_decode_offset; // offset for scope in nmethod |
duke@435 | 40 | int _obj_decode_offset; |
duke@435 | 41 | |
cfang@1366 | 42 | union PcDescFlags { |
cfang@1366 | 43 | int word; |
cfang@1366 | 44 | struct { |
cfang@1366 | 45 | unsigned int reexecute: 1; |
twisti@1570 | 46 | unsigned int is_method_handle_invoke: 1; |
kvn@1688 | 47 | unsigned int return_oop: 1; |
cfang@1366 | 48 | } bits; |
never@1449 | 49 | bool operator ==(const PcDescFlags& other) { return word == other.word; } |
cfang@1366 | 50 | } _flags; |
cfang@1366 | 51 | |
duke@435 | 52 | public: |
duke@435 | 53 | int pc_offset() const { return _pc_offset; } |
duke@435 | 54 | int scope_decode_offset() const { return _scope_decode_offset; } |
duke@435 | 55 | int obj_decode_offset() const { return _obj_decode_offset; } |
duke@435 | 56 | |
duke@435 | 57 | void set_pc_offset(int x) { _pc_offset = x; } |
duke@435 | 58 | void set_scope_decode_offset(int x) { _scope_decode_offset = x; } |
duke@435 | 59 | void set_obj_decode_offset(int x) { _obj_decode_offset = x; } |
duke@435 | 60 | |
duke@435 | 61 | // Constructor (only used for static in nmethod.cpp) |
duke@435 | 62 | // Also used by ScopeDesc::sender()] |
duke@435 | 63 | PcDesc(int pc_offset, int scope_decode_offset, int obj_decode_offset); |
duke@435 | 64 | |
duke@435 | 65 | enum { |
duke@435 | 66 | // upper and lower exclusive limits real offsets: |
duke@435 | 67 | lower_offset_limit = -1, |
duke@435 | 68 | upper_offset_limit = (unsigned int)-1 >> 1 |
duke@435 | 69 | }; |
duke@435 | 70 | |
cfang@1366 | 71 | // Flags |
cfang@1366 | 72 | bool should_reexecute() const { return _flags.bits.reexecute; } |
cfang@1366 | 73 | void set_should_reexecute(bool z) { _flags.bits.reexecute = z; } |
cfang@1366 | 74 | |
never@1449 | 75 | // Does pd refer to the same information as pd? |
never@1449 | 76 | bool is_same_info(const PcDesc* pd) { |
never@1449 | 77 | return _scope_decode_offset == pd->_scope_decode_offset && |
never@1449 | 78 | _obj_decode_offset == pd->_obj_decode_offset && |
never@1449 | 79 | _flags == pd->_flags; |
never@1449 | 80 | } |
never@1449 | 81 | |
twisti@1570 | 82 | bool is_method_handle_invoke() const { return _flags.bits.is_method_handle_invoke; } |
twisti@1570 | 83 | void set_is_method_handle_invoke(bool z) { _flags.bits.is_method_handle_invoke = z; } |
twisti@1570 | 84 | |
kvn@1688 | 85 | bool return_oop() const { return _flags.bits.return_oop; } |
kvn@1688 | 86 | void set_return_oop(bool z) { _flags.bits.return_oop = z; } |
kvn@1688 | 87 | |
duke@435 | 88 | // Returns the real pc |
duke@435 | 89 | address real_pc(const nmethod* code) const; |
duke@435 | 90 | |
duke@435 | 91 | void print(nmethod* code); |
duke@435 | 92 | bool verify(nmethod* code); |
duke@435 | 93 | }; |
stefank@2314 | 94 | |
stefank@2314 | 95 | #endif // SHARE_VM_CODE_PCDESC_HPP |