Thu, 16 Jun 2011 13:46:55 -0700
7055355: JSR 292: crash while throwing WrongMethodTypeException
Reviewed-by: jrose, twisti, bdelsart
never@1445 | 1 | /* |
stefank@2314 | 2 | * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. |
never@1445 | 3 | * Copyright 2007 Red Hat, Inc. |
never@1445 | 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
never@1445 | 5 | * |
never@1445 | 6 | * This code is free software; you can redistribute it and/or modify it |
never@1445 | 7 | * under the terms of the GNU General Public License version 2 only, as |
never@1445 | 8 | * published by the Free Software Foundation. |
never@1445 | 9 | * |
never@1445 | 10 | * This code is distributed in the hope that it will be useful, but WITHOUT |
never@1445 | 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
never@1445 | 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
never@1445 | 13 | * version 2 for more details (a copy is included in the LICENSE file that |
never@1445 | 14 | * accompanied this code). |
never@1445 | 15 | * |
never@1445 | 16 | * You should have received a copy of the GNU General Public License version |
never@1445 | 17 | * 2 along with this work; if not, write to the Free Software Foundation, |
never@1445 | 18 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
never@1445 | 19 | * |
trims@1907 | 20 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 21 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 22 | * questions. |
never@1445 | 23 | * |
never@1445 | 24 | */ |
never@1445 | 25 | |
stefank@2314 | 26 | #ifndef CPU_ZERO_VM_NATIVEINST_ZERO_HPP |
stefank@2314 | 27 | #define CPU_ZERO_VM_NATIVEINST_ZERO_HPP |
stefank@2314 | 28 | |
stefank@2314 | 29 | #include "asm/assembler.hpp" |
stefank@2314 | 30 | #include "memory/allocation.hpp" |
stefank@2314 | 31 | #include "runtime/icache.hpp" |
stefank@2314 | 32 | #include "runtime/os.hpp" |
stefank@2314 | 33 | #include "utilities/top.hpp" |
stefank@2314 | 34 | |
never@1445 | 35 | // We have interfaces for the following instructions: |
never@1445 | 36 | // - NativeInstruction |
never@1445 | 37 | // - - NativeCall |
never@1445 | 38 | // - - NativeMovConstReg |
never@1445 | 39 | // - - NativeMovConstRegPatching |
never@1445 | 40 | // - - NativeJump |
never@1445 | 41 | // - - NativeIllegalOpCode |
never@1445 | 42 | // - - NativeReturn |
never@1445 | 43 | // - - NativeReturnX (return with argument) |
never@1445 | 44 | // - - NativePushConst |
never@1445 | 45 | // - - NativeTstRegMem |
never@1445 | 46 | |
never@1445 | 47 | // The base class for different kinds of native instruction abstractions. |
never@1445 | 48 | // Provides the primitive operations to manipulate code relative to this. |
never@1445 | 49 | |
never@1445 | 50 | class NativeInstruction VALUE_OBJ_CLASS_SPEC { |
never@1445 | 51 | public: |
never@1445 | 52 | bool is_jump() { |
never@1445 | 53 | ShouldNotCallThis(); |
never@1445 | 54 | } |
never@1445 | 55 | |
never@1445 | 56 | bool is_safepoint_poll() { |
never@1445 | 57 | ShouldNotCallThis(); |
never@1445 | 58 | } |
never@1445 | 59 | }; |
never@1445 | 60 | |
never@1445 | 61 | inline NativeInstruction* nativeInstruction_at(address address) { |
never@1445 | 62 | ShouldNotCallThis(); |
never@1445 | 63 | } |
never@1445 | 64 | |
never@1445 | 65 | class NativeCall : public NativeInstruction { |
never@1445 | 66 | public: |
never@1445 | 67 | enum zero_specific_constants { |
never@1445 | 68 | instruction_size = 0 // not used within the interpreter |
never@1445 | 69 | }; |
never@1445 | 70 | |
never@1445 | 71 | address instruction_address() const { |
never@1445 | 72 | ShouldNotCallThis(); |
never@1445 | 73 | } |
never@1445 | 74 | |
never@1445 | 75 | address next_instruction_address() const { |
never@1445 | 76 | ShouldNotCallThis(); |
never@1445 | 77 | } |
never@1445 | 78 | |
never@1445 | 79 | address return_address() const { |
never@1445 | 80 | ShouldNotCallThis(); |
never@1445 | 81 | } |
never@1445 | 82 | |
never@1445 | 83 | address destination() const { |
never@1445 | 84 | ShouldNotCallThis(); |
never@1445 | 85 | } |
never@1445 | 86 | |
never@1445 | 87 | void set_destination_mt_safe(address dest) { |
never@1445 | 88 | ShouldNotCallThis(); |
never@1445 | 89 | } |
never@1445 | 90 | |
never@1445 | 91 | void verify_alignment() { |
never@1445 | 92 | ShouldNotCallThis(); |
never@1445 | 93 | } |
never@1445 | 94 | |
never@1445 | 95 | void verify() { |
never@1445 | 96 | ShouldNotCallThis(); |
never@1445 | 97 | } |
never@1445 | 98 | |
never@1445 | 99 | static bool is_call_before(address return_address) { |
never@1445 | 100 | ShouldNotCallThis(); |
never@1445 | 101 | } |
never@1445 | 102 | }; |
never@1445 | 103 | |
never@1445 | 104 | inline NativeCall* nativeCall_before(address return_address) { |
never@1445 | 105 | ShouldNotCallThis(); |
never@1445 | 106 | } |
never@1445 | 107 | |
never@1445 | 108 | inline NativeCall* nativeCall_at(address address) { |
never@1445 | 109 | ShouldNotCallThis(); |
never@1445 | 110 | } |
never@1445 | 111 | |
never@1445 | 112 | class NativeMovConstReg : public NativeInstruction { |
never@1445 | 113 | public: |
never@1445 | 114 | address next_instruction_address() const { |
never@1445 | 115 | ShouldNotCallThis(); |
never@1445 | 116 | } |
never@1445 | 117 | |
never@1445 | 118 | intptr_t data() const { |
never@1445 | 119 | ShouldNotCallThis(); |
never@1445 | 120 | } |
never@1445 | 121 | |
never@1445 | 122 | void set_data(intptr_t x) { |
never@1445 | 123 | ShouldNotCallThis(); |
never@1445 | 124 | } |
never@1445 | 125 | }; |
never@1445 | 126 | |
never@1445 | 127 | inline NativeMovConstReg* nativeMovConstReg_at(address address) { |
never@1445 | 128 | ShouldNotCallThis(); |
never@1445 | 129 | } |
never@1445 | 130 | |
never@1445 | 131 | class NativeMovRegMem : public NativeInstruction { |
never@1445 | 132 | public: |
never@1445 | 133 | int offset() const { |
never@1445 | 134 | ShouldNotCallThis(); |
never@1445 | 135 | } |
never@1445 | 136 | |
never@1445 | 137 | void set_offset(intptr_t x) { |
never@1445 | 138 | ShouldNotCallThis(); |
never@1445 | 139 | } |
never@1445 | 140 | |
never@1445 | 141 | void add_offset_in_bytes(int add_offset) { |
never@1445 | 142 | ShouldNotCallThis(); |
never@1445 | 143 | } |
never@1445 | 144 | }; |
never@1445 | 145 | |
never@1445 | 146 | inline NativeMovRegMem* nativeMovRegMem_at(address address) { |
never@1445 | 147 | ShouldNotCallThis(); |
never@1445 | 148 | } |
never@1445 | 149 | |
never@1445 | 150 | class NativeJump : public NativeInstruction { |
never@1445 | 151 | public: |
never@1445 | 152 | enum zero_specific_constants { |
never@1445 | 153 | instruction_size = 0 // not used within the interpreter |
never@1445 | 154 | }; |
never@1445 | 155 | |
never@1445 | 156 | address jump_destination() const { |
never@1445 | 157 | ShouldNotCallThis(); |
never@1445 | 158 | } |
never@1445 | 159 | |
never@1445 | 160 | void set_jump_destination(address dest) { |
never@1445 | 161 | ShouldNotCallThis(); |
never@1445 | 162 | } |
never@1445 | 163 | |
never@1445 | 164 | static void check_verified_entry_alignment(address entry, |
never@1445 | 165 | address verified_entry) { |
never@1445 | 166 | } |
never@1445 | 167 | |
never@1445 | 168 | static void patch_verified_entry(address entry, |
never@1445 | 169 | address verified_entry, |
never@1445 | 170 | address dest); |
never@1445 | 171 | }; |
never@1445 | 172 | |
never@1445 | 173 | inline NativeJump* nativeJump_at(address address) { |
never@1445 | 174 | ShouldNotCallThis(); |
never@1445 | 175 | } |
never@1445 | 176 | |
never@1445 | 177 | class NativeGeneralJump : public NativeInstruction { |
never@1445 | 178 | public: |
never@1445 | 179 | address jump_destination() const { |
never@1445 | 180 | ShouldNotCallThis(); |
never@1445 | 181 | } |
never@1445 | 182 | |
never@1445 | 183 | static void insert_unconditional(address code_pos, address entry) { |
never@1445 | 184 | ShouldNotCallThis(); |
never@1445 | 185 | } |
never@1445 | 186 | |
never@1445 | 187 | static void replace_mt_safe(address instr_addr, address code_buffer) { |
never@1445 | 188 | ShouldNotCallThis(); |
never@1445 | 189 | } |
never@1445 | 190 | }; |
never@1445 | 191 | |
never@1445 | 192 | inline NativeGeneralJump* nativeGeneralJump_at(address address) { |
never@1445 | 193 | ShouldNotCallThis(); |
never@1445 | 194 | } |
stefank@2314 | 195 | |
stefank@2314 | 196 | #endif // CPU_ZERO_VM_NATIVEINST_ZERO_HPP |