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 }; 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 377 int frame_size 378 ); 379 380 public: 381 // Creation 382 static DeoptimizationBlob* create( 383 CodeBuffer* cb, 384 OopMapSet* oop_maps, 385 int unpack_offset, 386 int unpack_with_exception_offset, 387 int unpack_with_reexecution_offset, 388 int frame_size 389 ); 390 391 // Typing 392 bool is_deoptimization_stub() const { return true; } 393 bool exception_address_is_unpack_entry(address pc) const { 394 address unpack_pc = unpack(); 395 return (pc == unpack_pc || (pc + frame::pc_return_offset) == unpack_pc); 396 } 397 398 // GC for args 399 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ } 400 401 // Printing 402 void print_value_on(outputStream* st) const; 403 404 address unpack() const { return code_begin() + _unpack_offset; } 405 address unpack_with_exception() const { return code_begin() + _unpack_with_exception; } 406 address unpack_with_reexecution() const { return code_begin() + _unpack_with_reexecution; } 407 408 // Alternate entry point for C1 where the exception and issuing pc 409 // are in JavaThread::_exception_oop and JavaThread::_exception_pc 410 // instead of being in registers. This is needed because C1 doesn't 411 // model exception paths in a way that keeps these registers free so 412 // there may be live values in those registers during deopt. 413 void set_unpack_with_exception_in_tls_offset(int offset) { 414 _unpack_with_exception_in_tls = offset; 415 assert(code_contains(code_begin() + _unpack_with_exception_in_tls), "must be PC inside codeblob"); 416 } |