13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_VM_CODE_CODEBLOB_HPP 26 #define SHARE_VM_CODE_CODEBLOB_HPP 27 28 #include "asm/codeBuffer.hpp" 29 #include "compiler/oopMap.hpp" 30 #include "runtime/frame.hpp" 31 #include "runtime/handles.hpp" 32 33 // CodeBlob - superclass for all entries in the CodeCache. 34 // 35 // Suptypes are: 36 // nmethod : Compiled Java methods (include method that calls to native code) 37 // RuntimeStub : Call to VM runtime methods 38 // DeoptimizationBlob : Used for deoptimizatation 39 // ExceptionBlob : Used for stack unrolling 40 // SafepointBlob : Used to handle illegal instruction exceptions 41 // 42 // 43 // Layout: 44 // - header 45 // - relocation 46 // - content space 47 // - instruction space 48 // - data space 49 class DeoptimizationBlob; 50 51 class CodeBlob VALUE_OBJ_CLASS_SPEC { 52 368 int frame_size 369 ); 370 371 public: 372 // Creation 373 static DeoptimizationBlob* create( 374 CodeBuffer* cb, 375 OopMapSet* oop_maps, 376 int unpack_offset, 377 int unpack_with_exception_offset, 378 int unpack_with_reexecution_offset, 379 int frame_size 380 ); 381 382 // Typing 383 bool is_deoptimization_stub() const { return true; } 384 bool exception_address_is_unpack_entry(address pc) const { 385 address unpack_pc = unpack(); 386 return (pc == unpack_pc || (pc + frame::pc_return_offset) == unpack_pc); 387 } 388 389 390 391 392 // GC for args 393 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ } 394 395 // Printing 396 void print_value_on(outputStream* st) const; 397 398 address unpack() const { return code_begin() + _unpack_offset; } 399 address unpack_with_exception() const { return code_begin() + _unpack_with_exception; } 400 address unpack_with_reexecution() const { return code_begin() + _unpack_with_reexecution; } 401 402 // Alternate entry point for C1 where the exception and issuing pc 403 // are in JavaThread::_exception_oop and JavaThread::_exception_pc 404 // instead of being in registers. This is needed because C1 doesn't 405 // model exception paths in a way that keeps these registers free so 406 // there may be live values in those registers during deopt. 407 void set_unpack_with_exception_in_tls_offset(int offset) { 408 _unpack_with_exception_in_tls = offset; 409 assert(code_contains(code_begin() + _unpack_with_exception_in_tls), "must be PC inside codeblob"); 410 } | 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_VM_CODE_CODEBLOB_HPP 26 #define SHARE_VM_CODE_CODEBLOB_HPP 27 28 #include "asm/codeBuffer.hpp" 29 #include "compiler/oopMap.hpp" 30 #include "runtime/frame.hpp" 31 #include "runtime/handles.hpp" 32 33 // CodeBlob Types 34 // Used in the CodeCache to assign CodeBlobs to different CodeHeaps 35 struct CodeBlobType { 36 enum { 37 MethodNonProfiled = 0, // Tier 1 and tier 4 (non-profiled) nmethods (including native nmethods) 38 MethodProfiled = 1, // Tier 2 and Tier 3 (profiled) nmethods 39 NonMethod = 2 // Non-methods like Buffers, Adapters and Runtime Stubs 40 }; 41 }; 42 43 // CodeBlob - superclass for all entries in the CodeCache. 44 // 45 // Suptypes are: 46 // nmethod : Compiled Java methods (include method that calls to native code) 47 // RuntimeStub : Call to VM runtime methods 48 // DeoptimizationBlob : Used for deoptimizatation 49 // ExceptionBlob : Used for stack unrolling 50 // SafepointBlob : Used to handle illegal instruction exceptions 51 // 52 // 53 // Layout: 54 // - header 55 // - relocation 56 // - content space 57 // - instruction space 58 // - data space 59 class DeoptimizationBlob; 60 61 class CodeBlob VALUE_OBJ_CLASS_SPEC { 62 378 int frame_size 379 ); 380 381 public: 382 // Creation 383 static DeoptimizationBlob* create( 384 CodeBuffer* cb, 385 OopMapSet* oop_maps, 386 int unpack_offset, 387 int unpack_with_exception_offset, 388 int unpack_with_reexecution_offset, 389 int frame_size 390 ); 391 392 // Typing 393 bool is_deoptimization_stub() const { return true; } 394 bool exception_address_is_unpack_entry(address pc) const { 395 address unpack_pc = unpack(); 396 return (pc == unpack_pc || (pc + frame::pc_return_offset) == unpack_pc); 397 } 398 399 // GC for args 400 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ } 401 402 // Printing 403 void print_value_on(outputStream* st) const; 404 405 address unpack() const { return code_begin() + _unpack_offset; } 406 address unpack_with_exception() const { return code_begin() + _unpack_with_exception; } 407 address unpack_with_reexecution() const { return code_begin() + _unpack_with_reexecution; } 408 409 // Alternate entry point for C1 where the exception and issuing pc 410 // are in JavaThread::_exception_oop and JavaThread::_exception_pc 411 // instead of being in registers. This is needed because C1 doesn't 412 // model exception paths in a way that keeps these registers free so 413 // there may be live values in those registers during deopt. 414 void set_unpack_with_exception_in_tls_offset(int offset) { 415 _unpack_with_exception_in_tls = offset; 416 assert(code_contains(code_begin() + _unpack_with_exception_in_tls), "must be PC inside codeblob"); 417 } |