Thu, 26 Jul 2018 16:04:06 +0800
Merge
aoqi@0 | 1 | /* |
poonam@9185 | 2 | * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. |
aoqi@0 | 8 | * |
aoqi@0 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 13 | * accompanied this code). |
aoqi@0 | 14 | * |
aoqi@0 | 15 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 18 | * |
aoqi@0 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 20 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 21 | * questions. |
aoqi@0 | 22 | * |
aoqi@0 | 23 | */ |
aoqi@0 | 24 | |
aoqi@0 | 25 | #ifndef SHARE_VM_CODE_CODEBLOB_HPP |
aoqi@0 | 26 | #define SHARE_VM_CODE_CODEBLOB_HPP |
aoqi@0 | 27 | |
aoqi@0 | 28 | #include "asm/codeBuffer.hpp" |
aoqi@0 | 29 | #include "compiler/oopMap.hpp" |
aoqi@0 | 30 | #include "runtime/frame.hpp" |
aoqi@0 | 31 | #include "runtime/handles.hpp" |
aoqi@0 | 32 | |
aoqi@0 | 33 | // CodeBlob - superclass for all entries in the CodeCache. |
aoqi@0 | 34 | // |
aoqi@0 | 35 | // Suptypes are: |
aoqi@0 | 36 | // nmethod : Compiled Java methods (include method that calls to native code) |
aoqi@0 | 37 | // RuntimeStub : Call to VM runtime methods |
aoqi@0 | 38 | // DeoptimizationBlob : Used for deoptimizatation |
aoqi@0 | 39 | // ExceptionBlob : Used for stack unrolling |
aoqi@0 | 40 | // SafepointBlob : Used to handle illegal instruction exceptions |
aoqi@0 | 41 | // |
aoqi@0 | 42 | // |
aoqi@0 | 43 | // Layout: |
aoqi@0 | 44 | // - header |
aoqi@0 | 45 | // - relocation |
aoqi@0 | 46 | // - content space |
aoqi@0 | 47 | // - instruction space |
aoqi@0 | 48 | // - data space |
aoqi@0 | 49 | class DeoptimizationBlob; |
aoqi@0 | 50 | |
aoqi@0 | 51 | class CodeBlob VALUE_OBJ_CLASS_SPEC { |
aoqi@0 | 52 | |
aoqi@0 | 53 | friend class VMStructs; |
aoqi@0 | 54 | |
aoqi@0 | 55 | private: |
aoqi@0 | 56 | const char* _name; |
aoqi@0 | 57 | int _size; // total size of CodeBlob in bytes |
aoqi@0 | 58 | int _header_size; // size of header (depends on subclass) |
aoqi@0 | 59 | int _relocation_size; // size of relocation |
aoqi@0 | 60 | int _content_offset; // offset to where content region begins (this includes consts, insts, stubs) |
aoqi@0 | 61 | int _code_offset; // offset to where instructions region begins (this includes insts, stubs) |
aoqi@0 | 62 | int _frame_complete_offset; // instruction offsets in [0.._frame_complete_offset) have |
aoqi@0 | 63 | // not finished setting up their frame. Beware of pc's in |
aoqi@0 | 64 | // that range. There is a similar range(s) on returns |
aoqi@0 | 65 | // which we don't detect. |
aoqi@0 | 66 | int _data_offset; // offset to where data region begins |
aoqi@0 | 67 | int _frame_size; // size of stack frame |
aoqi@0 | 68 | OopMapSet* _oop_maps; // OopMap for this CodeBlob |
aoqi@0 | 69 | CodeStrings _strings; |
aoqi@0 | 70 | |
aoqi@0 | 71 | public: |
aoqi@0 | 72 | // Returns the space needed for CodeBlob |
aoqi@0 | 73 | static unsigned int allocation_size(CodeBuffer* cb, int header_size); |
aoqi@0 | 74 | |
aoqi@0 | 75 | // Creation |
aoqi@0 | 76 | // a) simple CodeBlob |
aoqi@0 | 77 | // frame_complete is the offset from the beginning of the instructions |
aoqi@0 | 78 | // to where the frame setup (from stackwalk viewpoint) is complete. |
aoqi@0 | 79 | CodeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size); |
aoqi@0 | 80 | |
aoqi@0 | 81 | // b) full CodeBlob |
aoqi@0 | 82 | CodeBlob( |
aoqi@0 | 83 | const char* name, |
aoqi@0 | 84 | CodeBuffer* cb, |
aoqi@0 | 85 | int header_size, |
aoqi@0 | 86 | int size, |
aoqi@0 | 87 | int frame_complete, |
aoqi@0 | 88 | int frame_size, |
aoqi@0 | 89 | OopMapSet* oop_maps |
aoqi@0 | 90 | ); |
aoqi@0 | 91 | |
aoqi@0 | 92 | // Deletion |
aoqi@0 | 93 | void flush(); |
aoqi@0 | 94 | |
aoqi@0 | 95 | // Typing |
aoqi@0 | 96 | virtual bool is_buffer_blob() const { return false; } |
aoqi@0 | 97 | virtual bool is_nmethod() const { return false; } |
aoqi@0 | 98 | virtual bool is_runtime_stub() const { return false; } |
aoqi@0 | 99 | virtual bool is_deoptimization_stub() const { return false; } |
aoqi@0 | 100 | virtual bool is_uncommon_trap_stub() const { return false; } |
aoqi@0 | 101 | virtual bool is_exception_stub() const { return false; } |
aoqi@0 | 102 | virtual bool is_safepoint_stub() const { return false; } |
aoqi@0 | 103 | virtual bool is_adapter_blob() const { return false; } |
poonam@9185 | 104 | virtual bool is_vtable_blob() const { return false; } |
aoqi@0 | 105 | virtual bool is_method_handles_adapter_blob() const { return false; } |
aoqi@0 | 106 | |
aoqi@0 | 107 | virtual bool is_compiled_by_c2() const { return false; } |
aoqi@0 | 108 | virtual bool is_compiled_by_c1() const { return false; } |
aoqi@0 | 109 | |
aoqi@0 | 110 | // Casting |
aoqi@0 | 111 | nmethod* as_nmethod_or_null() { return is_nmethod() ? (nmethod*) this : NULL; } |
aoqi@0 | 112 | |
aoqi@0 | 113 | // Boundaries |
aoqi@0 | 114 | address header_begin() const { return (address) this; } |
aoqi@0 | 115 | address header_end() const { return ((address) this) + _header_size; }; |
aoqi@0 | 116 | relocInfo* relocation_begin() const { return (relocInfo*) header_end(); }; |
aoqi@0 | 117 | relocInfo* relocation_end() const { return (relocInfo*)(header_end() + _relocation_size); } |
aoqi@0 | 118 | address content_begin() const { return (address) header_begin() + _content_offset; } |
aoqi@0 | 119 | address content_end() const { return (address) header_begin() + _data_offset; } |
aoqi@0 | 120 | address code_begin() const { return (address) header_begin() + _code_offset; } |
aoqi@0 | 121 | address code_end() const { return (address) header_begin() + _data_offset; } |
aoqi@0 | 122 | address data_begin() const { return (address) header_begin() + _data_offset; } |
aoqi@0 | 123 | address data_end() const { return (address) header_begin() + _size; } |
aoqi@0 | 124 | |
aoqi@0 | 125 | // Offsets |
aoqi@0 | 126 | int relocation_offset() const { return _header_size; } |
aoqi@0 | 127 | int content_offset() const { return _content_offset; } |
aoqi@0 | 128 | int code_offset() const { return _code_offset; } |
aoqi@0 | 129 | int data_offset() const { return _data_offset; } |
aoqi@0 | 130 | |
aoqi@0 | 131 | // Sizes |
aoqi@0 | 132 | int size() const { return _size; } |
aoqi@0 | 133 | int header_size() const { return _header_size; } |
aoqi@0 | 134 | int relocation_size() const { return (address) relocation_end() - (address) relocation_begin(); } |
aoqi@0 | 135 | int content_size() const { return content_end() - content_begin(); } |
aoqi@0 | 136 | int code_size() const { return code_end() - code_begin(); } |
aoqi@0 | 137 | int data_size() const { return data_end() - data_begin(); } |
aoqi@0 | 138 | |
aoqi@0 | 139 | // Containment |
aoqi@0 | 140 | bool blob_contains(address addr) const { return header_begin() <= addr && addr < data_end(); } |
aoqi@0 | 141 | bool relocation_contains(relocInfo* addr) const{ return relocation_begin() <= addr && addr < relocation_end(); } |
aoqi@0 | 142 | bool content_contains(address addr) const { return content_begin() <= addr && addr < content_end(); } |
aoqi@0 | 143 | bool code_contains(address addr) const { return code_begin() <= addr && addr < code_end(); } |
aoqi@0 | 144 | bool data_contains(address addr) const { return data_begin() <= addr && addr < data_end(); } |
aoqi@0 | 145 | bool contains(address addr) const { return content_contains(addr); } |
aoqi@0 | 146 | bool is_frame_complete_at(address addr) const { return code_contains(addr) && |
aoqi@0 | 147 | addr >= code_begin() + _frame_complete_offset; } |
aoqi@0 | 148 | |
aoqi@0 | 149 | // CodeCache support: really only used by the nmethods, but in order to get |
aoqi@0 | 150 | // asserts and certain bookkeeping to work in the CodeCache they are defined |
aoqi@0 | 151 | // virtual here. |
aoqi@0 | 152 | virtual bool is_zombie() const { return false; } |
aoqi@0 | 153 | virtual bool is_locked_by_vm() const { return false; } |
aoqi@0 | 154 | |
aoqi@0 | 155 | virtual bool is_unloaded() const { return false; } |
aoqi@0 | 156 | virtual bool is_not_entrant() const { return false; } |
aoqi@0 | 157 | |
aoqi@0 | 158 | // GC support |
aoqi@0 | 159 | virtual bool is_alive() const = 0; |
aoqi@0 | 160 | |
aoqi@0 | 161 | // OopMap for frame |
aoqi@0 | 162 | OopMapSet* oop_maps() const { return _oop_maps; } |
aoqi@0 | 163 | void set_oop_maps(OopMapSet* p); |
aoqi@0 | 164 | OopMap* oop_map_for_return_address(address return_address); |
aoqi@0 | 165 | virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { ShouldNotReachHere(); } |
aoqi@0 | 166 | |
aoqi@0 | 167 | // Frame support |
aoqi@0 | 168 | int frame_size() const { return _frame_size; } |
aoqi@0 | 169 | void set_frame_size(int size) { _frame_size = size; } |
aoqi@0 | 170 | |
aoqi@0 | 171 | // Returns true, if the next frame is responsible for GC'ing oops passed as arguments |
aoqi@0 | 172 | virtual bool caller_must_gc_arguments(JavaThread* thread) const { return false; } |
aoqi@0 | 173 | |
aoqi@0 | 174 | // Naming |
aoqi@0 | 175 | const char* name() const { return _name; } |
aoqi@0 | 176 | void set_name(const char* name) { _name = name; } |
aoqi@0 | 177 | |
aoqi@0 | 178 | // Debugging |
aoqi@0 | 179 | virtual void verify(); |
aoqi@0 | 180 | void print() const { print_on(tty); } |
aoqi@0 | 181 | virtual void print_on(outputStream* st) const; |
aoqi@0 | 182 | virtual void print_value_on(outputStream* st) const; |
aoqi@0 | 183 | |
aoqi@0 | 184 | // Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService. |
aoqi@0 | 185 | static void trace_new_stub(CodeBlob* blob, const char* name1, const char* name2 = ""); |
aoqi@0 | 186 | |
aoqi@0 | 187 | // Print the comment associated with offset on stream, if there is one |
aoqi@0 | 188 | virtual void print_block_comment(outputStream* stream, address block_begin) const { |
aoqi@0 | 189 | intptr_t offset = (intptr_t)(block_begin - code_begin()); |
aoqi@0 | 190 | _strings.print_block_comment(stream, offset); |
aoqi@0 | 191 | } |
aoqi@0 | 192 | |
aoqi@0 | 193 | // Transfer ownership of comments to this CodeBlob |
aoqi@0 | 194 | void set_strings(CodeStrings& strings) { |
aoqi@0 | 195 | _strings.assign(strings); |
aoqi@0 | 196 | } |
aoqi@0 | 197 | }; |
aoqi@0 | 198 | |
aoqi@0 | 199 | |
aoqi@0 | 200 | //---------------------------------------------------------------------------------------------------- |
aoqi@0 | 201 | // BufferBlob: used to hold non-relocatable machine code such as the interpreter, stubroutines, etc. |
aoqi@0 | 202 | |
aoqi@0 | 203 | class BufferBlob: public CodeBlob { |
aoqi@0 | 204 | friend class VMStructs; |
aoqi@0 | 205 | friend class AdapterBlob; |
poonam@9185 | 206 | friend class VtableBlob; |
aoqi@0 | 207 | friend class MethodHandlesAdapterBlob; |
aoqi@0 | 208 | |
aoqi@0 | 209 | private: |
aoqi@0 | 210 | // Creation support |
aoqi@0 | 211 | BufferBlob(const char* name, int size); |
aoqi@0 | 212 | BufferBlob(const char* name, int size, CodeBuffer* cb); |
aoqi@0 | 213 | |
aoqi@0 | 214 | void* operator new(size_t s, unsigned size, bool is_critical = false) throw(); |
aoqi@0 | 215 | |
aoqi@0 | 216 | public: |
aoqi@0 | 217 | // Creation |
aoqi@0 | 218 | static BufferBlob* create(const char* name, int buffer_size); |
aoqi@0 | 219 | static BufferBlob* create(const char* name, CodeBuffer* cb); |
aoqi@0 | 220 | |
aoqi@0 | 221 | static void free(BufferBlob* buf); |
aoqi@0 | 222 | |
aoqi@0 | 223 | // Typing |
aoqi@0 | 224 | virtual bool is_buffer_blob() const { return true; } |
aoqi@0 | 225 | |
aoqi@0 | 226 | // GC/Verification support |
aoqi@0 | 227 | void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ } |
aoqi@0 | 228 | bool is_alive() const { return true; } |
aoqi@0 | 229 | |
aoqi@0 | 230 | void verify(); |
aoqi@0 | 231 | void print_on(outputStream* st) const; |
aoqi@0 | 232 | void print_value_on(outputStream* st) const; |
aoqi@0 | 233 | }; |
aoqi@0 | 234 | |
aoqi@0 | 235 | |
aoqi@0 | 236 | //---------------------------------------------------------------------------------------------------- |
aoqi@0 | 237 | // AdapterBlob: used to hold C2I/I2C adapters |
aoqi@0 | 238 | |
aoqi@0 | 239 | class AdapterBlob: public BufferBlob { |
aoqi@0 | 240 | private: |
aoqi@0 | 241 | AdapterBlob(int size, CodeBuffer* cb); |
aoqi@0 | 242 | |
aoqi@0 | 243 | public: |
aoqi@0 | 244 | // Creation |
aoqi@0 | 245 | static AdapterBlob* create(CodeBuffer* cb); |
aoqi@0 | 246 | |
aoqi@0 | 247 | // Typing |
aoqi@0 | 248 | virtual bool is_adapter_blob() const { return true; } |
aoqi@0 | 249 | }; |
aoqi@0 | 250 | |
poonam@9185 | 251 | //--------------------------------------------------------------------------------------------------- |
poonam@9185 | 252 | class VtableBlob: public BufferBlob { |
poonam@9185 | 253 | private: |
poonam@9185 | 254 | VtableBlob(const char*, int); |
poonam@9185 | 255 | |
poonam@9185 | 256 | public: |
poonam@9185 | 257 | // Creation |
poonam@9185 | 258 | static VtableBlob* create(const char* name, int buffer_size); |
poonam@9185 | 259 | |
poonam@9185 | 260 | // Typing |
poonam@9185 | 261 | virtual bool is_vtable_blob() const { return true; } |
poonam@9185 | 262 | }; |
aoqi@0 | 263 | |
aoqi@0 | 264 | //---------------------------------------------------------------------------------------------------- |
aoqi@0 | 265 | // MethodHandlesAdapterBlob: used to hold MethodHandles adapters |
aoqi@0 | 266 | |
aoqi@0 | 267 | class MethodHandlesAdapterBlob: public BufferBlob { |
aoqi@0 | 268 | private: |
aoqi@0 | 269 | MethodHandlesAdapterBlob(int size) : BufferBlob("MethodHandles adapters", size) {} |
aoqi@0 | 270 | |
aoqi@0 | 271 | public: |
aoqi@0 | 272 | // Creation |
aoqi@0 | 273 | static MethodHandlesAdapterBlob* create(int buffer_size); |
aoqi@0 | 274 | |
aoqi@0 | 275 | // Typing |
aoqi@0 | 276 | virtual bool is_method_handles_adapter_blob() const { return true; } |
aoqi@0 | 277 | }; |
aoqi@0 | 278 | |
aoqi@0 | 279 | |
aoqi@0 | 280 | //---------------------------------------------------------------------------------------------------- |
aoqi@0 | 281 | // RuntimeStub: describes stubs used by compiled code to call a (static) C++ runtime routine |
aoqi@0 | 282 | |
aoqi@0 | 283 | class RuntimeStub: public CodeBlob { |
aoqi@0 | 284 | friend class VMStructs; |
aoqi@0 | 285 | private: |
aoqi@0 | 286 | bool _caller_must_gc_arguments; |
aoqi@0 | 287 | |
aoqi@0 | 288 | // Creation support |
aoqi@0 | 289 | RuntimeStub( |
aoqi@0 | 290 | const char* name, |
aoqi@0 | 291 | CodeBuffer* cb, |
aoqi@0 | 292 | int size, |
aoqi@0 | 293 | int frame_complete, |
aoqi@0 | 294 | int frame_size, |
aoqi@0 | 295 | OopMapSet* oop_maps, |
aoqi@0 | 296 | bool caller_must_gc_arguments |
aoqi@0 | 297 | ); |
aoqi@0 | 298 | |
aoqi@0 | 299 | void* operator new(size_t s, unsigned size) throw(); |
aoqi@0 | 300 | |
aoqi@0 | 301 | public: |
aoqi@0 | 302 | // Creation |
aoqi@0 | 303 | static RuntimeStub* new_runtime_stub( |
aoqi@0 | 304 | const char* stub_name, |
aoqi@0 | 305 | CodeBuffer* cb, |
aoqi@0 | 306 | int frame_complete, |
aoqi@0 | 307 | int frame_size, |
aoqi@0 | 308 | OopMapSet* oop_maps, |
aoqi@0 | 309 | bool caller_must_gc_arguments |
aoqi@0 | 310 | ); |
aoqi@0 | 311 | |
aoqi@0 | 312 | // Typing |
aoqi@0 | 313 | bool is_runtime_stub() const { return true; } |
aoqi@0 | 314 | |
aoqi@0 | 315 | // GC support |
aoqi@0 | 316 | bool caller_must_gc_arguments(JavaThread* thread) const { return _caller_must_gc_arguments; } |
aoqi@0 | 317 | |
aoqi@0 | 318 | address entry_point() { return code_begin(); } |
aoqi@0 | 319 | |
aoqi@0 | 320 | // GC/Verification support |
aoqi@0 | 321 | void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ } |
aoqi@0 | 322 | bool is_alive() const { return true; } |
aoqi@0 | 323 | |
aoqi@0 | 324 | void verify(); |
aoqi@0 | 325 | void print_on(outputStream* st) const; |
aoqi@0 | 326 | void print_value_on(outputStream* st) const; |
aoqi@0 | 327 | }; |
aoqi@0 | 328 | |
aoqi@0 | 329 | |
aoqi@0 | 330 | //---------------------------------------------------------------------------------------------------- |
aoqi@0 | 331 | // Super-class for all blobs that exist in only one instance. Implements default behaviour. |
aoqi@0 | 332 | |
aoqi@0 | 333 | class SingletonBlob: public CodeBlob { |
aoqi@0 | 334 | friend class VMStructs; |
aoqi@0 | 335 | |
aoqi@0 | 336 | protected: |
aoqi@0 | 337 | void* operator new(size_t s, unsigned size) throw(); |
aoqi@0 | 338 | |
aoqi@0 | 339 | public: |
aoqi@0 | 340 | SingletonBlob( |
aoqi@0 | 341 | const char* name, |
aoqi@0 | 342 | CodeBuffer* cb, |
aoqi@0 | 343 | int header_size, |
aoqi@0 | 344 | int size, |
aoqi@0 | 345 | int frame_size, |
aoqi@0 | 346 | OopMapSet* oop_maps |
aoqi@0 | 347 | ) |
aoqi@0 | 348 | : CodeBlob(name, cb, header_size, size, CodeOffsets::frame_never_safe, frame_size, oop_maps) |
aoqi@0 | 349 | {}; |
aoqi@0 | 350 | |
aoqi@0 | 351 | address entry_point() { return code_begin(); } |
aoqi@0 | 352 | |
aoqi@0 | 353 | bool is_alive() const { return true; } |
aoqi@0 | 354 | |
aoqi@0 | 355 | void verify(); // does nothing |
aoqi@0 | 356 | void print_on(outputStream* st) const; |
aoqi@0 | 357 | void print_value_on(outputStream* st) const; |
aoqi@0 | 358 | }; |
aoqi@0 | 359 | |
aoqi@0 | 360 | |
aoqi@0 | 361 | //---------------------------------------------------------------------------------------------------- |
aoqi@0 | 362 | // DeoptimizationBlob |
aoqi@0 | 363 | |
aoqi@0 | 364 | class DeoptimizationBlob: public SingletonBlob { |
aoqi@0 | 365 | friend class VMStructs; |
aoqi@0 | 366 | private: |
aoqi@0 | 367 | int _unpack_offset; |
aoqi@0 | 368 | int _unpack_with_exception; |
aoqi@0 | 369 | int _unpack_with_reexecution; |
aoqi@0 | 370 | |
aoqi@0 | 371 | int _unpack_with_exception_in_tls; |
aoqi@0 | 372 | |
aoqi@0 | 373 | // Creation support |
aoqi@0 | 374 | DeoptimizationBlob( |
aoqi@0 | 375 | CodeBuffer* cb, |
aoqi@0 | 376 | int size, |
aoqi@0 | 377 | OopMapSet* oop_maps, |
aoqi@0 | 378 | int unpack_offset, |
aoqi@0 | 379 | int unpack_with_exception_offset, |
aoqi@0 | 380 | int unpack_with_reexecution_offset, |
aoqi@0 | 381 | int frame_size |
aoqi@0 | 382 | ); |
aoqi@0 | 383 | |
aoqi@0 | 384 | public: |
aoqi@0 | 385 | // Creation |
aoqi@0 | 386 | static DeoptimizationBlob* create( |
aoqi@0 | 387 | CodeBuffer* cb, |
aoqi@0 | 388 | OopMapSet* oop_maps, |
aoqi@0 | 389 | int unpack_offset, |
aoqi@0 | 390 | int unpack_with_exception_offset, |
aoqi@0 | 391 | int unpack_with_reexecution_offset, |
aoqi@0 | 392 | int frame_size |
aoqi@0 | 393 | ); |
aoqi@0 | 394 | |
aoqi@0 | 395 | // Typing |
aoqi@0 | 396 | bool is_deoptimization_stub() const { return true; } |
aoqi@0 | 397 | bool exception_address_is_unpack_entry(address pc) const { |
aoqi@0 | 398 | address unpack_pc = unpack(); |
aoqi@0 | 399 | return (pc == unpack_pc || (pc + frame::pc_return_offset) == unpack_pc); |
aoqi@0 | 400 | } |
aoqi@0 | 401 | |
aoqi@0 | 402 | |
aoqi@0 | 403 | |
aoqi@0 | 404 | |
aoqi@0 | 405 | // GC for args |
aoqi@0 | 406 | void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ } |
aoqi@0 | 407 | |
aoqi@0 | 408 | // Printing |
aoqi@0 | 409 | void print_value_on(outputStream* st) const; |
aoqi@0 | 410 | |
aoqi@0 | 411 | address unpack() const { return code_begin() + _unpack_offset; } |
aoqi@0 | 412 | address unpack_with_exception() const { return code_begin() + _unpack_with_exception; } |
aoqi@0 | 413 | address unpack_with_reexecution() const { return code_begin() + _unpack_with_reexecution; } |
aoqi@0 | 414 | |
aoqi@0 | 415 | // Alternate entry point for C1 where the exception and issuing pc |
aoqi@0 | 416 | // are in JavaThread::_exception_oop and JavaThread::_exception_pc |
aoqi@0 | 417 | // instead of being in registers. This is needed because C1 doesn't |
aoqi@0 | 418 | // model exception paths in a way that keeps these registers free so |
aoqi@0 | 419 | // there may be live values in those registers during deopt. |
aoqi@0 | 420 | void set_unpack_with_exception_in_tls_offset(int offset) { |
aoqi@0 | 421 | _unpack_with_exception_in_tls = offset; |
aoqi@0 | 422 | assert(code_contains(code_begin() + _unpack_with_exception_in_tls), "must be PC inside codeblob"); |
aoqi@0 | 423 | } |
aoqi@0 | 424 | address unpack_with_exception_in_tls() const { return code_begin() + _unpack_with_exception_in_tls; } |
aoqi@0 | 425 | }; |
aoqi@0 | 426 | |
aoqi@0 | 427 | |
aoqi@0 | 428 | //---------------------------------------------------------------------------------------------------- |
aoqi@0 | 429 | // UncommonTrapBlob (currently only used by Compiler 2) |
aoqi@0 | 430 | |
aoqi@0 | 431 | #ifdef COMPILER2 |
aoqi@0 | 432 | |
aoqi@0 | 433 | class UncommonTrapBlob: public SingletonBlob { |
aoqi@0 | 434 | friend class VMStructs; |
aoqi@0 | 435 | private: |
aoqi@0 | 436 | // Creation support |
aoqi@0 | 437 | UncommonTrapBlob( |
aoqi@0 | 438 | CodeBuffer* cb, |
aoqi@0 | 439 | int size, |
aoqi@0 | 440 | OopMapSet* oop_maps, |
aoqi@0 | 441 | int frame_size |
aoqi@0 | 442 | ); |
aoqi@0 | 443 | |
aoqi@0 | 444 | public: |
aoqi@0 | 445 | // Creation |
aoqi@0 | 446 | static UncommonTrapBlob* create( |
aoqi@0 | 447 | CodeBuffer* cb, |
aoqi@0 | 448 | OopMapSet* oop_maps, |
aoqi@0 | 449 | int frame_size |
aoqi@0 | 450 | ); |
aoqi@0 | 451 | |
aoqi@0 | 452 | // GC for args |
aoqi@0 | 453 | void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ } |
aoqi@0 | 454 | |
aoqi@0 | 455 | // Typing |
aoqi@0 | 456 | bool is_uncommon_trap_stub() const { return true; } |
aoqi@0 | 457 | }; |
aoqi@0 | 458 | |
aoqi@0 | 459 | |
aoqi@0 | 460 | //---------------------------------------------------------------------------------------------------- |
aoqi@0 | 461 | // ExceptionBlob: used for exception unwinding in compiled code (currently only used by Compiler 2) |
aoqi@0 | 462 | |
aoqi@0 | 463 | class ExceptionBlob: public SingletonBlob { |
aoqi@0 | 464 | friend class VMStructs; |
aoqi@0 | 465 | private: |
aoqi@0 | 466 | // Creation support |
aoqi@0 | 467 | ExceptionBlob( |
aoqi@0 | 468 | CodeBuffer* cb, |
aoqi@0 | 469 | int size, |
aoqi@0 | 470 | OopMapSet* oop_maps, |
aoqi@0 | 471 | int frame_size |
aoqi@0 | 472 | ); |
aoqi@0 | 473 | |
aoqi@0 | 474 | public: |
aoqi@0 | 475 | // Creation |
aoqi@0 | 476 | static ExceptionBlob* create( |
aoqi@0 | 477 | CodeBuffer* cb, |
aoqi@0 | 478 | OopMapSet* oop_maps, |
aoqi@0 | 479 | int frame_size |
aoqi@0 | 480 | ); |
aoqi@0 | 481 | |
aoqi@0 | 482 | // GC for args |
aoqi@0 | 483 | void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ } |
aoqi@0 | 484 | |
aoqi@0 | 485 | // Typing |
aoqi@0 | 486 | bool is_exception_stub() const { return true; } |
aoqi@0 | 487 | }; |
aoqi@0 | 488 | #endif // COMPILER2 |
aoqi@0 | 489 | |
aoqi@0 | 490 | |
aoqi@0 | 491 | //---------------------------------------------------------------------------------------------------- |
aoqi@0 | 492 | // SafepointBlob: handles illegal_instruction exceptions during a safepoint |
aoqi@0 | 493 | |
aoqi@0 | 494 | class SafepointBlob: public SingletonBlob { |
aoqi@0 | 495 | friend class VMStructs; |
aoqi@0 | 496 | private: |
aoqi@0 | 497 | // Creation support |
aoqi@0 | 498 | SafepointBlob( |
aoqi@0 | 499 | CodeBuffer* cb, |
aoqi@0 | 500 | int size, |
aoqi@0 | 501 | OopMapSet* oop_maps, |
aoqi@0 | 502 | int frame_size |
aoqi@0 | 503 | ); |
aoqi@0 | 504 | |
aoqi@0 | 505 | public: |
aoqi@0 | 506 | // Creation |
aoqi@0 | 507 | static SafepointBlob* create( |
aoqi@0 | 508 | CodeBuffer* cb, |
aoqi@0 | 509 | OopMapSet* oop_maps, |
aoqi@0 | 510 | int frame_size |
aoqi@0 | 511 | ); |
aoqi@0 | 512 | |
aoqi@0 | 513 | // GC for args |
aoqi@0 | 514 | void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ } |
aoqi@0 | 515 | |
aoqi@0 | 516 | // Typing |
aoqi@0 | 517 | bool is_safepoint_stub() const { return true; } |
aoqi@0 | 518 | }; |
aoqi@0 | 519 | |
aoqi@0 | 520 | #endif // SHARE_VM_CODE_CODEBLOB_HPP |