97 assert(regname->is_reg(), "sanity check"); 98 // Only the GPRs get handled this way 99 if( !regname->is_Register()) 100 return NULL; 101 102 // don't talk about bad registers 103 if ((bad_mask & ((LocationValidType)1 << regname->value())) != 0) { 104 return NULL; 105 } 106 107 // Convert to a GPR 108 Register reg; 109 int second_word = 0; 110 // 32-bit registers for in, out and local 111 if (!regname->is_concrete()) { 112 // HMM ought to return NULL for any non-concrete (odd) vmreg 113 // this all tied up in the fact we put out double oopMaps for 114 // register locations. When that is fixed we'd will return NULL 115 // (or assert here). 116 reg = regname->prev()->as_Register(); 117 #ifdef _LP64 118 second_word = sizeof(jint); 119 #else 120 return NULL; 121 #endif // _LP64 122 } else { 123 reg = regname->as_Register(); 124 } 125 if (reg->is_out()) { 126 assert(_younger_window != NULL, "Younger window should be available"); 127 return second_word + (address)&_younger_window[reg->after_save()->sp_offset_in_saved_window()]; 128 } 129 if (reg->is_local() || reg->is_in()) { 130 assert(_window != NULL, "Window should be available"); 131 return second_word + (address)&_window[reg->sp_offset_in_saved_window()]; 132 } 133 // Only the window'd GPRs get handled this way; not the globals. 134 return NULL; 135 } 136 137 138 #ifdef ASSERT 139 void RegisterMap::check_location_valid() { 140 register_map_init(); 141 assert((_location_valid[0] & bad_mask) == 0, "cannot have special locations for SP,FP,TLS,etc."); 315 // We've validated the potential sender that would be created 316 317 return true; 318 319 } 320 321 // Must be native-compiled frame. Since sender will try and use fp to find 322 // linkages it must be safe 323 324 if (!fp_safe) return false; 325 326 // could try and do some more potential verification of native frame if we could think of some... 327 328 return true; 329 } 330 331 // constructors 332 333 // Construct an unpatchable, deficient frame 334 void frame::init(intptr_t* sp, address pc, CodeBlob* cb) { 335 #ifdef _LP64 336 assert( (((intptr_t)sp & (wordSize-1)) == 0), "frame constructor passed an invalid sp"); 337 #endif 338 _sp = sp; 339 _younger_sp = NULL; 340 _pc = pc; 341 _cb = cb; 342 _sp_adjustment_by_callee = 0; 343 assert(pc == NULL && cb == NULL || pc != NULL, "can't have a cb and no pc!"); 344 if (_cb == NULL && _pc != NULL ) { 345 _cb = CodeCache::find_blob(_pc); 346 } 347 _deopt_state = unknown; 348 } 349 350 frame::frame(intptr_t* sp, unpatchable_t, address pc, CodeBlob* cb) { 351 init(sp, pc, cb); 352 } 353 354 frame::frame(intptr_t* sp, intptr_t* younger_sp, bool younger_frame_is_interpreted) : 355 _sp(sp), 356 _younger_sp(younger_sp), 357 _deopt_state(unknown), 676 int index = (Interpreter::expr_offset_in_bytes(offset)/wordSize); 677 678 intptr_t* LSP = (intptr_t*) sp()[Lentry_args->sp_offset_in_saved_window()]; 679 return &LSP[index+1]; 680 } 681 682 683 BasicType frame::interpreter_frame_result(oop* oop_result, jvalue* value_result) { 684 assert(is_interpreted_frame(), "interpreted frame expected"); 685 Method* method = interpreter_frame_method(); 686 BasicType type = method->result_type(); 687 688 if (method->is_native()) { 689 // Prior to notifying the runtime of the method_exit the possible result 690 // value is saved to l_scratch and d_scratch. 691 692 intptr_t* l_scratch = fp() + interpreter_frame_l_scratch_fp_offset; 693 intptr_t* d_scratch = fp() + interpreter_frame_d_scratch_fp_offset; 694 695 address l_addr = (address)l_scratch; 696 #ifdef _LP64 697 // On 64-bit the result for 1/8/16/32-bit result types is in the other 698 // word half 699 l_addr += wordSize/2; 700 #endif 701 702 switch (type) { 703 case T_OBJECT: 704 case T_ARRAY: { 705 oop obj = cast_to_oop(at(interpreter_frame_oop_temp_offset)); 706 assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check"); 707 *oop_result = obj; 708 break; 709 } 710 711 case T_BOOLEAN : { jint* p = (jint*)l_addr; value_result->z = (jboolean)((*p) & 0x1); break; } 712 case T_BYTE : { jint* p = (jint*)l_addr; value_result->b = (jbyte)((*p) & 0xff); break; } 713 case T_CHAR : { jint* p = (jint*)l_addr; value_result->c = (jchar)((*p) & 0xffff); break; } 714 case T_SHORT : { jint* p = (jint*)l_addr; value_result->s = (jshort)((*p) & 0xffff); break; } 715 case T_INT : value_result->i = *(jint*)l_addr; break; 716 case T_LONG : value_result->j = *(jlong*)l_scratch; break; 717 case T_FLOAT : value_result->f = *(jfloat*)d_scratch; break; 718 case T_DOUBLE : value_result->d = *(jdouble*)d_scratch; break; 719 case T_VOID : /* Nothing to do */ break; 720 default : ShouldNotReachHere(); | 97 assert(regname->is_reg(), "sanity check"); 98 // Only the GPRs get handled this way 99 if( !regname->is_Register()) 100 return NULL; 101 102 // don't talk about bad registers 103 if ((bad_mask & ((LocationValidType)1 << regname->value())) != 0) { 104 return NULL; 105 } 106 107 // Convert to a GPR 108 Register reg; 109 int second_word = 0; 110 // 32-bit registers for in, out and local 111 if (!regname->is_concrete()) { 112 // HMM ought to return NULL for any non-concrete (odd) vmreg 113 // this all tied up in the fact we put out double oopMaps for 114 // register locations. When that is fixed we'd will return NULL 115 // (or assert here). 116 reg = regname->prev()->as_Register(); 117 second_word = sizeof(jint); 118 } else { 119 reg = regname->as_Register(); 120 } 121 if (reg->is_out()) { 122 assert(_younger_window != NULL, "Younger window should be available"); 123 return second_word + (address)&_younger_window[reg->after_save()->sp_offset_in_saved_window()]; 124 } 125 if (reg->is_local() || reg->is_in()) { 126 assert(_window != NULL, "Window should be available"); 127 return second_word + (address)&_window[reg->sp_offset_in_saved_window()]; 128 } 129 // Only the window'd GPRs get handled this way; not the globals. 130 return NULL; 131 } 132 133 134 #ifdef ASSERT 135 void RegisterMap::check_location_valid() { 136 register_map_init(); 137 assert((_location_valid[0] & bad_mask) == 0, "cannot have special locations for SP,FP,TLS,etc."); 311 // We've validated the potential sender that would be created 312 313 return true; 314 315 } 316 317 // Must be native-compiled frame. Since sender will try and use fp to find 318 // linkages it must be safe 319 320 if (!fp_safe) return false; 321 322 // could try and do some more potential verification of native frame if we could think of some... 323 324 return true; 325 } 326 327 // constructors 328 329 // Construct an unpatchable, deficient frame 330 void frame::init(intptr_t* sp, address pc, CodeBlob* cb) { 331 assert( (((intptr_t)sp & (wordSize-1)) == 0), "frame constructor passed an invalid sp"); 332 _sp = sp; 333 _younger_sp = NULL; 334 _pc = pc; 335 _cb = cb; 336 _sp_adjustment_by_callee = 0; 337 assert(pc == NULL && cb == NULL || pc != NULL, "can't have a cb and no pc!"); 338 if (_cb == NULL && _pc != NULL ) { 339 _cb = CodeCache::find_blob(_pc); 340 } 341 _deopt_state = unknown; 342 } 343 344 frame::frame(intptr_t* sp, unpatchable_t, address pc, CodeBlob* cb) { 345 init(sp, pc, cb); 346 } 347 348 frame::frame(intptr_t* sp, intptr_t* younger_sp, bool younger_frame_is_interpreted) : 349 _sp(sp), 350 _younger_sp(younger_sp), 351 _deopt_state(unknown), 670 int index = (Interpreter::expr_offset_in_bytes(offset)/wordSize); 671 672 intptr_t* LSP = (intptr_t*) sp()[Lentry_args->sp_offset_in_saved_window()]; 673 return &LSP[index+1]; 674 } 675 676 677 BasicType frame::interpreter_frame_result(oop* oop_result, jvalue* value_result) { 678 assert(is_interpreted_frame(), "interpreted frame expected"); 679 Method* method = interpreter_frame_method(); 680 BasicType type = method->result_type(); 681 682 if (method->is_native()) { 683 // Prior to notifying the runtime of the method_exit the possible result 684 // value is saved to l_scratch and d_scratch. 685 686 intptr_t* l_scratch = fp() + interpreter_frame_l_scratch_fp_offset; 687 intptr_t* d_scratch = fp() + interpreter_frame_d_scratch_fp_offset; 688 689 address l_addr = (address)l_scratch; 690 // On 64-bit the result for 1/8/16/32-bit result types is in the other 691 // word half 692 l_addr += wordSize/2; 693 694 switch (type) { 695 case T_OBJECT: 696 case T_ARRAY: { 697 oop obj = cast_to_oop(at(interpreter_frame_oop_temp_offset)); 698 assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check"); 699 *oop_result = obj; 700 break; 701 } 702 703 case T_BOOLEAN : { jint* p = (jint*)l_addr; value_result->z = (jboolean)((*p) & 0x1); break; } 704 case T_BYTE : { jint* p = (jint*)l_addr; value_result->b = (jbyte)((*p) & 0xff); break; } 705 case T_CHAR : { jint* p = (jint*)l_addr; value_result->c = (jchar)((*p) & 0xffff); break; } 706 case T_SHORT : { jint* p = (jint*)l_addr; value_result->s = (jshort)((*p) & 0xffff); break; } 707 case T_INT : value_result->i = *(jint*)l_addr; break; 708 case T_LONG : value_result->j = *(jlong*)l_scratch; break; 709 case T_FLOAT : value_result->f = *(jfloat*)d_scratch; break; 710 case T_DOUBLE : value_result->d = *(jdouble*)d_scratch; break; 711 case T_VOID : /* Nothing to do */ break; 712 default : ShouldNotReachHere(); |