comparison src/cpu/x86/vm/templateInterpreter_x86_32.cpp @ 748:e5b0439ef4ae

6655638: dynamic languages need method handles Summary: initial implementation, with known omissions (x86/64, sparc, compiler optim., c-oops, C++ interp.) Reviewed-by: kvn, twisti, never
author jrose
date Wed, 08 Apr 2009 10:56:49 -0700
parents 7bb995fbd3c0
children be93aad57795
comparison
equal deleted inserted replaced
7:41d6f6bc0773 8:4ef425da11f9
89 CAST_FROM_FN_PTR(address, 89 CAST_FROM_FN_PTR(address,
90 InterpreterRuntime::throw_ClassCastException), 90 InterpreterRuntime::throw_ClassCastException),
91 rax); 91 rax);
92 return entry; 92 return entry;
93 } 93 }
94
95 // Arguments are: required type at TOS+8, failing object (or NULL) at TOS+4.
96 // pc at TOS (just for debugging)
97 address TemplateInterpreterGenerator::generate_WrongMethodType_handler() {
98 address entry = __ pc();
99
100 __ pop(rbx); // actual failing object is at TOS
101 __ pop(rax); // required type is at TOS+4
102
103 __ verify_oop(rbx);
104 __ verify_oop(rax);
105
106 // Various method handle types use interpreter registers as temps.
107 __ restore_bcp();
108 __ restore_locals();
109
110 // Expression stack must be empty before entering the VM for an exception.
111 __ empty_expression_stack();
112 __ empty_FPU_stack();
113 __ call_VM(noreg,
114 CAST_FROM_FN_PTR(address,
115 InterpreterRuntime::throw_WrongMethodTypeException),
116 // pass required type, failing object (or NULL)
117 rax, rbx);
118 return entry;
119 }
120
94 121
95 address TemplateInterpreterGenerator::generate_exception_handler_common(const char* name, const char* message, bool pass_oop) { 122 address TemplateInterpreterGenerator::generate_exception_handler_common(const char* name, const char* message, bool pass_oop) {
96 assert(!pass_oop || message == NULL, "either oop or message but not both"); 123 assert(!pass_oop || message == NULL, "either oop or message but not both");
97 address entry = __ pc(); 124 address entry = __ pc();
98 if (pass_oop) { 125 if (pass_oop) {
1368 case Interpreter::native : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(false); break; 1395 case Interpreter::native : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(false); break;
1369 case Interpreter::native_synchronized : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(true); break; 1396 case Interpreter::native_synchronized : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(true); break;
1370 case Interpreter::empty : entry_point = ((InterpreterGenerator*)this)->generate_empty_entry(); break; 1397 case Interpreter::empty : entry_point = ((InterpreterGenerator*)this)->generate_empty_entry(); break;
1371 case Interpreter::accessor : entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry(); break; 1398 case Interpreter::accessor : entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry(); break;
1372 case Interpreter::abstract : entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry(); break; 1399 case Interpreter::abstract : entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry(); break;
1400 case Interpreter::method_handle : entry_point = ((InterpreterGenerator*)this)->generate_method_handle_entry(); break;
1373 1401
1374 case Interpreter::java_lang_math_sin : // fall thru 1402 case Interpreter::java_lang_math_sin : // fall thru
1375 case Interpreter::java_lang_math_cos : // fall thru 1403 case Interpreter::java_lang_math_cos : // fall thru
1376 case Interpreter::java_lang_math_tan : // fall thru 1404 case Interpreter::java_lang_math_tan : // fall thru
1377 case Interpreter::java_lang_math_abs : // fall thru 1405 case Interpreter::java_lang_math_abs : // fall thru
1398 1426
1399 // total overhead size: entry_size + (saved rbp, thru expr stack bottom). 1427 // total overhead size: entry_size + (saved rbp, thru expr stack bottom).
1400 // be sure to change this if you add/subtract anything to/from the overhead area 1428 // be sure to change this if you add/subtract anything to/from the overhead area
1401 const int overhead_size = -frame::interpreter_frame_initial_sp_offset; 1429 const int overhead_size = -frame::interpreter_frame_initial_sp_offset;
1402 1430
1403 const int method_stack = (method->max_locals() + method->max_stack()) * 1431 const int extra_stack = methodOopDesc::extra_stack_entries();
1432 const int method_stack = (method->max_locals() + method->max_stack() + extra_stack) *
1404 Interpreter::stackElementWords(); 1433 Interpreter::stackElementWords();
1405 return overhead_size + method_stack + stub_code; 1434 return overhead_size + method_stack + stub_code;
1406 } 1435 }
1407 1436
1408 // asm based interpreter deoptimization helpers 1437 // asm based interpreter deoptimization helpers