23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "classfile/javaClasses.hpp"
29 #include "compiler/compiler_globals.hpp"
30 #include "gc/shared/barrierSetAssembler.hpp"
31 #include "interpreter/bytecodeHistogram.hpp"
32 #include "interpreter/interpreter.hpp"
33 #include "interpreter/interpreterRuntime.hpp"
34 #include "interpreter/interp_masm.hpp"
35 #include "interpreter/templateInterpreterGenerator.hpp"
36 #include "interpreter/templateTable.hpp"
37 #include "interpreter/bytecodeTracer.hpp"
38 #include "memory/resourceArea.hpp"
39 #include "oops/arrayOop.hpp"
40 #include "oops/methodData.hpp"
41 #include "oops/method.hpp"
42 #include "oops/oop.inline.hpp"
43 #include "prims/jvmtiExport.hpp"
44 #include "prims/jvmtiThreadState.hpp"
45 #include "runtime/arguments.hpp"
46 #include "runtime/deoptimization.hpp"
47 #include "runtime/frame.inline.hpp"
48 #include "runtime/globals.hpp"
49 #include "runtime/jniHandles.hpp"
50 #include "runtime/sharedRuntime.hpp"
51 #include "runtime/stubRoutines.hpp"
52 #include "runtime/synchronizer.hpp"
53 #include "runtime/timer.hpp"
54 #include "runtime/vframeArray.hpp"
55 #include "utilities/debug.hpp"
56 #include "utilities/powerOfTwo.hpp"
57 #include <sys/types.h>
58
59 // Size of interpreter code. Increase if too small. Interpreter will
60 // fail with a guarantee ("not enough space for interpreter generation");
61 // if too small.
62 // Run with +PrintInterpreter to get the VM to print out the size.
418 __ lea(c_rarg2, Address((address)message));
419 } else {
420 __ mov(c_rarg2, NULL_WORD);
421 }
422 __ call_VM(r0,
423 CAST_FROM_FN_PTR(address, InterpreterRuntime::create_exception),
424 c_rarg1, c_rarg2);
425 }
426 // throw exception
427 __ b(address(Interpreter::throw_exception_entry()));
428 return entry;
429 }
430
431 address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) {
432 address entry = __ pc();
433
434 // Restore stack bottom in case i2c adjusted stack
435 __ ldr(esp, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
436 // and NULL it as marker that esp is now tos until next java call
437 __ str(zr, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
438 __ restore_bcp();
439 __ restore_locals();
440 __ restore_constant_pool_cache();
441 __ get_method(rmethod);
442
443 if (state == atos) {
444 Register obj = r0;
445 Register mdp = r1;
446 Register tmp = r2;
447 __ profile_return_type(mdp, obj, tmp);
448 }
449
450 // Pop N words from the stack
451 __ get_cache_and_index_at_bcp(r1, r2, 1, index_size);
452 __ ldr(r1, Address(r1, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
453 __ andr(r1, r1, ConstantPoolCacheEntry::parameter_size_mask);
454
455 __ add(esp, esp, r1, Assembler::LSL, 3);
456
457 // Restore machine SP
523 __ dispatch_next(state, step);
524 } else {
525 __ jump_to_entry(continuation);
526 }
527 return entry;
528 }
529
530 address TemplateInterpreterGenerator::generate_result_handler_for(
531 BasicType type) {
532 address entry = __ pc();
533 switch (type) {
534 case T_BOOLEAN: __ c2bool(r0); break;
535 case T_CHAR : __ uxth(r0, r0); break;
536 case T_BYTE : __ sxtb(r0, r0); break;
537 case T_SHORT : __ sxth(r0, r0); break;
538 case T_INT : __ uxtw(r0, r0); break; // FIXME: We almost certainly don't need this
539 case T_LONG : /* nothing to do */ break;
540 case T_VOID : /* nothing to do */ break;
541 case T_FLOAT : /* nothing to do */ break;
542 case T_DOUBLE : /* nothing to do */ break;
543 case T_OBJECT :
544 // retrieve result from frame
545 __ ldr(r0, Address(rfp, frame::interpreter_frame_oop_temp_offset*wordSize));
546 // and verify it
547 __ verify_oop(r0);
548 break;
549 default : ShouldNotReachHere();
550 }
551 __ ret(lr); // return from result handler
552 return entry;
553 }
554
555 address TemplateInterpreterGenerator::generate_safept_entry_for(
556 TosState state,
557 address runtime_entry) {
558 address entry = __ pc();
559 __ push(state);
560 __ push_cont_fastpath(rthread);
561 __ call_VM(noreg, runtime_entry);
562 __ pop_cont_fastpath(rthread);
|
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "classfile/javaClasses.hpp"
29 #include "compiler/compiler_globals.hpp"
30 #include "gc/shared/barrierSetAssembler.hpp"
31 #include "interpreter/bytecodeHistogram.hpp"
32 #include "interpreter/interpreter.hpp"
33 #include "interpreter/interpreterRuntime.hpp"
34 #include "interpreter/interp_masm.hpp"
35 #include "interpreter/templateInterpreterGenerator.hpp"
36 #include "interpreter/templateTable.hpp"
37 #include "interpreter/bytecodeTracer.hpp"
38 #include "memory/resourceArea.hpp"
39 #include "oops/arrayOop.hpp"
40 #include "oops/methodData.hpp"
41 #include "oops/method.hpp"
42 #include "oops/oop.inline.hpp"
43 #include "oops/inlineKlass.hpp"
44 #include "prims/jvmtiExport.hpp"
45 #include "prims/jvmtiThreadState.hpp"
46 #include "runtime/arguments.hpp"
47 #include "runtime/deoptimization.hpp"
48 #include "runtime/frame.inline.hpp"
49 #include "runtime/globals.hpp"
50 #include "runtime/jniHandles.hpp"
51 #include "runtime/sharedRuntime.hpp"
52 #include "runtime/stubRoutines.hpp"
53 #include "runtime/synchronizer.hpp"
54 #include "runtime/timer.hpp"
55 #include "runtime/vframeArray.hpp"
56 #include "utilities/debug.hpp"
57 #include "utilities/powerOfTwo.hpp"
58 #include <sys/types.h>
59
60 // Size of interpreter code. Increase if too small. Interpreter will
61 // fail with a guarantee ("not enough space for interpreter generation");
62 // if too small.
63 // Run with +PrintInterpreter to get the VM to print out the size.
419 __ lea(c_rarg2, Address((address)message));
420 } else {
421 __ mov(c_rarg2, NULL_WORD);
422 }
423 __ call_VM(r0,
424 CAST_FROM_FN_PTR(address, InterpreterRuntime::create_exception),
425 c_rarg1, c_rarg2);
426 }
427 // throw exception
428 __ b(address(Interpreter::throw_exception_entry()));
429 return entry;
430 }
431
432 address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) {
433 address entry = __ pc();
434
435 // Restore stack bottom in case i2c adjusted stack
436 __ ldr(esp, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
437 // and NULL it as marker that esp is now tos until next java call
438 __ str(zr, Address(rfp, frame::interpreter_frame_last_sp_offset * wordSize));
439
440 if (state == atos && InlineTypeReturnedAsFields) {
441 __ store_inline_type_fields_to_buf(NULL, true);
442 }
443
444 __ restore_bcp();
445 __ restore_locals();
446 __ restore_constant_pool_cache();
447 __ get_method(rmethod);
448
449 if (state == atos) {
450 Register obj = r0;
451 Register mdp = r1;
452 Register tmp = r2;
453 __ profile_return_type(mdp, obj, tmp);
454 }
455
456 // Pop N words from the stack
457 __ get_cache_and_index_at_bcp(r1, r2, 1, index_size);
458 __ ldr(r1, Address(r1, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
459 __ andr(r1, r1, ConstantPoolCacheEntry::parameter_size_mask);
460
461 __ add(esp, esp, r1, Assembler::LSL, 3);
462
463 // Restore machine SP
529 __ dispatch_next(state, step);
530 } else {
531 __ jump_to_entry(continuation);
532 }
533 return entry;
534 }
535
536 address TemplateInterpreterGenerator::generate_result_handler_for(
537 BasicType type) {
538 address entry = __ pc();
539 switch (type) {
540 case T_BOOLEAN: __ c2bool(r0); break;
541 case T_CHAR : __ uxth(r0, r0); break;
542 case T_BYTE : __ sxtb(r0, r0); break;
543 case T_SHORT : __ sxth(r0, r0); break;
544 case T_INT : __ uxtw(r0, r0); break; // FIXME: We almost certainly don't need this
545 case T_LONG : /* nothing to do */ break;
546 case T_VOID : /* nothing to do */ break;
547 case T_FLOAT : /* nothing to do */ break;
548 case T_DOUBLE : /* nothing to do */ break;
549 case T_PRIMITIVE_OBJECT: // fall through (value types are handled with oops)
550 case T_OBJECT :
551 // retrieve result from frame
552 __ ldr(r0, Address(rfp, frame::interpreter_frame_oop_temp_offset*wordSize));
553 // and verify it
554 __ verify_oop(r0);
555 break;
556 default : ShouldNotReachHere();
557 }
558 __ ret(lr); // return from result handler
559 return entry;
560 }
561
562 address TemplateInterpreterGenerator::generate_safept_entry_for(
563 TosState state,
564 address runtime_entry) {
565 address entry = __ pc();
566 __ push(state);
567 __ push_cont_fastpath(rthread);
568 __ call_VM(noreg, runtime_entry);
569 __ pop_cont_fastpath(rthread);
|