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 367 int frame_size 368 ); 369 370 public: 371 // Creation 372 static DeoptimizationBlob* create( 373 CodeBuffer* cb, 374 OopMapSet* oop_maps, 375 int unpack_offset, 376 int unpack_with_exception_offset, 377 int unpack_with_reexecution_offset, 378 int frame_size 379 ); 380 381 // Typing 382 bool is_deoptimization_stub() const { return true; } 383 bool exception_address_is_unpack_entry(address pc) const { 384 address unpack_pc = unpack(); 385 return (pc == unpack_pc || (pc + frame::pc_return_offset) == unpack_pc); 386 } 387 388 389 390 391 // GC for args 392 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ } 393 394 // Printing 395 void print_value_on(outputStream* st) const; 396 397 address unpack() const { return code_begin() + _unpack_offset; } 398 address unpack_with_exception() const { return code_begin() + _unpack_with_exception; } 399 address unpack_with_reexecution() const { return code_begin() + _unpack_with_reexecution; } 400 401 // Alternate entry point for C1 where the exception and issuing pc 402 // are in JavaThread::_exception_oop and JavaThread::_exception_pc 403 // instead of being in registers. This is needed because C1 doesn't 404 // model exception paths in a way that keeps these registers free so 405 // there may be live values in those registers during deopt. 406 void set_unpack_with_exception_in_tls_offset(int offset) { 407 _unpack_with_exception_in_tls = offset; 408 assert(code_contains(code_begin() + _unpack_with_exception_in_tls), "must be PC inside codeblob"); 409 } | 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, // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods) 38 MethodProfiled = 1, // Execution level 2 and 3 (profiled) nmethods 39 NonMethod = 2, // Non-methods like Buffers, Adapters and Runtime Stubs 40 All = 3, // All types (No code cache segmentation) 41 NumTypes = 4 // Number of CodeBlobTypes 42 }; 43 }; 44 45 // CodeBlob - superclass for all entries in the CodeCache. 46 // 47 // Suptypes are: 48 // nmethod : Compiled Java methods (include method that calls to native code) 49 // RuntimeStub : Call to VM runtime methods 50 // DeoptimizationBlob : Used for deoptimizatation 51 // ExceptionBlob : Used for stack unrolling 52 // SafepointBlob : Used to handle illegal instruction exceptions 53 // 54 // 55 // Layout: 56 // - header 57 // - relocation 58 // - content space 59 // - instruction space 60 // - data space 61 class DeoptimizationBlob; 62 63 class CodeBlob VALUE_OBJ_CLASS_SPEC { 64 379 int frame_size 380 ); 381 382 public: 383 // Creation 384 static DeoptimizationBlob* create( 385 CodeBuffer* cb, 386 OopMapSet* oop_maps, 387 int unpack_offset, 388 int unpack_with_exception_offset, 389 int unpack_with_reexecution_offset, 390 int frame_size 391 ); 392 393 // Typing 394 bool is_deoptimization_stub() const { return true; } 395 bool exception_address_is_unpack_entry(address pc) const { 396 address unpack_pc = unpack(); 397 return (pc == unpack_pc || (pc + frame::pc_return_offset) == unpack_pc); 398 } 399 400 // GC for args 401 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ } 402 403 // Printing 404 void print_value_on(outputStream* st) const; 405 406 address unpack() const { return code_begin() + _unpack_offset; } 407 address unpack_with_exception() const { return code_begin() + _unpack_with_exception; } 408 address unpack_with_reexecution() const { return code_begin() + _unpack_with_reexecution; } 409 410 // Alternate entry point for C1 where the exception and issuing pc 411 // are in JavaThread::_exception_oop and JavaThread::_exception_pc 412 // instead of being in registers. This is needed because C1 doesn't 413 // model exception paths in a way that keeps these registers free so 414 // there may be live values in those registers during deopt. 415 void set_unpack_with_exception_in_tls_offset(int offset) { 416 _unpack_with_exception_in_tls = offset; 417 assert(code_contains(code_begin() + _unpack_with_exception_in_tls), "must be PC inside codeblob"); 418 } |