307 // if we get to the next instruction via an exception 308 // 309 // n.b. adding this instruction here affects the calculation of 310 // whether or not a routine returns to the call stub (used when 311 // doing stack walks) since the normal test is to check the return 312 // pc against the address saved below. so we may need to allow for 313 // this extra instruction in the check. 314 315 if (NotifySimulator) { 316 __ notify(Assembler::method_reentry); 317 } 318 // save current address for use by exception handling code 319 320 return_address = __ pc(); 321 322 // store result depending on type (everything that is not 323 // T_OBJECT, T_VALUETYPE, T_LONG, T_FLOAT or T_DOUBLE is treated as T_INT) 324 // n.b. this assumes Java returns an integral result in r0 325 // and a floating result in j_farg0 326 __ ldr(j_rarg2, result); 327 Label is_long, is_float, is_double, exit; 328 __ ldr(j_rarg1, result_type); 329 __ cmp(j_rarg1, (u1)T_OBJECT); 330 __ br(Assembler::EQ, is_long); 331 __ cmp(j_rarg1, (u1)T_VALUETYPE); 332 __ br(Assembler::EQ, is_long); 333 __ cmp(j_rarg1, (u1)T_LONG); 334 __ br(Assembler::EQ, is_long); 335 __ cmp(j_rarg1, (u1)T_FLOAT); 336 __ br(Assembler::EQ, is_float); 337 __ cmp(j_rarg1, (u1)T_DOUBLE); 338 __ br(Assembler::EQ, is_double); 339 340 // handle T_INT case 341 __ strw(r0, Address(j_rarg2)); 342 343 __ BIND(exit); 344 345 // pop parameters 346 __ sub(esp, rfp, -sp_after_call_off * wordSize); 347 348 #ifdef ASSERT 349 // verify that threads correspond 350 { 351 Label L, S; 352 __ ldr(rscratch1, thread); 373 __ ldp(r22, r21, r22_save); 374 __ ldp(r20, r19, r20_save); 375 376 __ ldp(c_rarg0, c_rarg1, call_wrapper); 377 __ ldrw(c_rarg2, result_type); 378 __ ldr(c_rarg3, method); 379 __ ldp(c_rarg4, c_rarg5, entry_point); 380 __ ldp(c_rarg6, c_rarg7, parameter_size); 381 382 #ifndef PRODUCT 383 // tell the simulator we are about to end Java execution 384 if (NotifySimulator) { 385 __ notify(Assembler::method_exit); 386 } 387 #endif 388 // leave frame and return to caller 389 __ leave(); 390 __ ret(lr); 391 392 // handle return types different from T_INT 393 394 __ BIND(is_long); 395 __ str(r0, Address(j_rarg2, 0)); 396 __ br(Assembler::AL, exit); 397 398 __ BIND(is_float); 399 __ strs(j_farg0, Address(j_rarg2, 0)); 400 __ br(Assembler::AL, exit); 401 402 __ BIND(is_double); 403 __ strd(j_farg0, Address(j_rarg2, 0)); 404 __ br(Assembler::AL, exit); 405 406 return start; 407 } 408 409 // Return point for a Java call if there's an exception thrown in 410 // Java code. The exception is caught and transformed into a 411 // pending exception stored in JavaThread that can be tested from 412 // within the VM. | 307 // if we get to the next instruction via an exception 308 // 309 // n.b. adding this instruction here affects the calculation of 310 // whether or not a routine returns to the call stub (used when 311 // doing stack walks) since the normal test is to check the return 312 // pc against the address saved below. so we may need to allow for 313 // this extra instruction in the check. 314 315 if (NotifySimulator) { 316 __ notify(Assembler::method_reentry); 317 } 318 // save current address for use by exception handling code 319 320 return_address = __ pc(); 321 322 // store result depending on type (everything that is not 323 // T_OBJECT, T_VALUETYPE, T_LONG, T_FLOAT or T_DOUBLE is treated as T_INT) 324 // n.b. this assumes Java returns an integral result in r0 325 // and a floating result in j_farg0 326 __ ldr(j_rarg2, result); 327 Label is_long, is_float, is_double, is_value, exit; 328 __ ldr(j_rarg1, result_type); 329 __ cmp(j_rarg1, (u1)T_OBJECT); 330 __ br(Assembler::EQ, is_long); 331 __ cmp(j_rarg1, (u1)T_VALUETYPE); 332 __ br(Assembler::EQ, is_value); 333 __ cmp(j_rarg1, (u1)T_LONG); 334 __ br(Assembler::EQ, is_long); 335 __ cmp(j_rarg1, (u1)T_FLOAT); 336 __ br(Assembler::EQ, is_float); 337 __ cmp(j_rarg1, (u1)T_DOUBLE); 338 __ br(Assembler::EQ, is_double); 339 340 // handle T_INT case 341 __ strw(r0, Address(j_rarg2)); 342 343 __ BIND(exit); 344 345 // pop parameters 346 __ sub(esp, rfp, -sp_after_call_off * wordSize); 347 348 #ifdef ASSERT 349 // verify that threads correspond 350 { 351 Label L, S; 352 __ ldr(rscratch1, thread); 373 __ ldp(r22, r21, r22_save); 374 __ ldp(r20, r19, r20_save); 375 376 __ ldp(c_rarg0, c_rarg1, call_wrapper); 377 __ ldrw(c_rarg2, result_type); 378 __ ldr(c_rarg3, method); 379 __ ldp(c_rarg4, c_rarg5, entry_point); 380 __ ldp(c_rarg6, c_rarg7, parameter_size); 381 382 #ifndef PRODUCT 383 // tell the simulator we are about to end Java execution 384 if (NotifySimulator) { 385 __ notify(Assembler::method_exit); 386 } 387 #endif 388 // leave frame and return to caller 389 __ leave(); 390 __ ret(lr); 391 392 // handle return types different from T_INT 393 __ BIND(is_value); 394 if (ValueTypeReturnedAsFields) { 395 // Check for flattened return value 396 __ cbz(r0, is_long); 397 // Initialize pre-allocated buffer 398 __ mov(r1, r0); 399 __ andr(r1, r1, -2); 400 __ ldr(r1, Address(r1, InstanceKlass::adr_valueklass_fixed_block_offset())); 401 __ ldr(r1, Address(r1, ValueKlass::pack_handler_offset())); 402 __ ldr(r0, Address(j_rarg2, 0)); 403 __ blr(r1); 404 __ b(exit); 405 } 406 407 __ BIND(is_long); 408 __ str(r0, Address(j_rarg2, 0)); 409 __ br(Assembler::AL, exit); 410 411 __ BIND(is_float); 412 __ strs(j_farg0, Address(j_rarg2, 0)); 413 __ br(Assembler::AL, exit); 414 415 __ BIND(is_double); 416 __ strd(j_farg0, Address(j_rarg2, 0)); 417 __ br(Assembler::AL, exit); 418 419 return start; 420 } 421 422 // Return point for a Java call if there's an exception thrown in 423 // Java code. The exception is caught and transformed into a 424 // pending exception stored in JavaThread that can be tested from 425 // within the VM. |