comparison src/cpu/x86/vm/templateInterpreter_x86_64.cpp @ 9025:ff5a32117e02

Implement fast invocation of installed code (direct tail call to the target machine code address).
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 12 Apr 2013 01:53:52 +0200
parents b9a918201d47
children c6a1ffc707ff
comparison
equal deleted inserted replaced
9024:2b840ae76df1 9025:ff5a32117e02
871 // If G1 is not enabled then attempt to go through the accessor entry point 871 // If G1 is not enabled then attempt to go through the accessor entry point
872 // Reference.get is an accessor 872 // Reference.get is an accessor
873 return generate_accessor_entry(); 873 return generate_accessor_entry();
874 } 874 }
875 875
876 // Interpreter stub for calling a compiled method with 3 object arguments
877 address InterpreterGenerator::generate_execute_compiled_method_entry() {
878 address entry_point = __ pc();
879
880 // Pick up the return address
881 __ movptr(rax, Address(rsp, 0));
882
883 // Must preserve original SP for loading incoming arguments because
884 // we need to align the outgoing SP for compiled code.
885 __ movptr(r11, rsp);
886
887 // Ensure compiled code always sees stack at proper alignment
888 __ andptr(rsp, -16);
889
890 // push the return address and misalign the stack that youngest frame always sees
891 // as far as the placement of the call instruction
892 __ push(rax);
893
894 __ movq(j_rarg0, Address(r11, Interpreter::stackElementSize*5));
895 __ movq(j_rarg1, Address(r11, Interpreter::stackElementSize*4));
896 __ movq(j_rarg2, Address(r11, Interpreter::stackElementSize*3));
897 __ movq(j_rarg3, Address(r11, Interpreter::stackElementSize));
898 __ jmp(Address(j_rarg3, nmethod::verified_entry_point_offset()));
899 return entry_point;
900 }
876 901
877 // Interpreter stub for calling a native method. (asm interpreter) 902 // Interpreter stub for calling a native method. (asm interpreter)
878 // This sets up a somewhat different looking stack for calling the 903 // This sets up a somewhat different looking stack for calling the
879 // native method than the typical interpreter frame setup. 904 // native method than the typical interpreter frame setup.
880 address InterpreterGenerator::generate_native_entry(bool synchronized) { 905 address InterpreterGenerator::generate_native_entry(bool synchronized) {
1559 address entry_point = NULL; 1584 address entry_point = NULL;
1560 1585
1561 switch (kind) { 1586 switch (kind) {
1562 case Interpreter::zerolocals : break; 1587 case Interpreter::zerolocals : break;
1563 case Interpreter::zerolocals_synchronized: synchronized = true; break; 1588 case Interpreter::zerolocals_synchronized: synchronized = true; break;
1589 case Interpreter::execute_compiled_method: entry_point = ((InterpreterGenerator*)this)->generate_execute_compiled_method_entry(); break;
1564 case Interpreter::native : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(false); break; 1590 case Interpreter::native : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(false); break;
1565 case Interpreter::native_synchronized : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(true); break; 1591 case Interpreter::native_synchronized : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(true); break;
1566 case Interpreter::empty : entry_point = ((InterpreterGenerator*)this)->generate_empty_entry(); break; 1592 case Interpreter::empty : entry_point = ((InterpreterGenerator*)this)->generate_empty_entry(); break;
1567 case Interpreter::accessor : entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry(); break; 1593 case Interpreter::accessor : entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry(); break;
1568 case Interpreter::abstract : entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry(); break; 1594 case Interpreter::abstract : entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry(); break;