comparison src/cpu/x86/vm/templateInterpreter_x86_64.cpp @ 710: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 819880572f09
children be93aad57795
comparison
equal deleted inserted replaced
709:1d037ecd7960 710:e5b0439ef4ae
1 /* 1 /*
2 * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
95 __ call_VM(noreg, 95 __ call_VM(noreg,
96 CAST_FROM_FN_PTR(address, 96 CAST_FROM_FN_PTR(address,
97 InterpreterRuntime:: 97 InterpreterRuntime::
98 throw_ClassCastException), 98 throw_ClassCastException),
99 c_rarg1); 99 c_rarg1);
100 return entry;
101 }
102
103 // Arguments are: required type in rarg1, failing object (or NULL) in rarg2
104 address TemplateInterpreterGenerator::generate_WrongMethodType_handler() {
105 address entry = __ pc();
106
107 __ pop(c_rarg2); // failing object is at TOS
108 __ pop(c_rarg1); // required type is at TOS+8
109
110 // expression stack must be empty before entering the VM if an
111 // exception happened
112 __ empty_expression_stack();
113
114 __ call_VM(noreg,
115 CAST_FROM_FN_PTR(address,
116 InterpreterRuntime::
117 throw_WrongMethodTypeException),
118 // pass required type, failing object (or NULL)
119 c_rarg1, c_rarg2);
100 return entry; 120 return entry;
101 } 121 }
102 122
103 address TemplateInterpreterGenerator::generate_exception_handler_common( 123 address TemplateInterpreterGenerator::generate_exception_handler_common(
104 const char* name, const char* message, bool pass_oop) { 124 const char* name, const char* message, bool pass_oop) {
1391 case Interpreter::native : entry_point = ((InterpreterGenerator*) this)->generate_native_entry(false); break; 1411 case Interpreter::native : entry_point = ((InterpreterGenerator*) this)->generate_native_entry(false); break;
1392 case Interpreter::native_synchronized : entry_point = ((InterpreterGenerator*) this)->generate_native_entry(true); break; 1412 case Interpreter::native_synchronized : entry_point = ((InterpreterGenerator*) this)->generate_native_entry(true); break;
1393 case Interpreter::empty : entry_point = ((InterpreterGenerator*) this)->generate_empty_entry(); break; 1413 case Interpreter::empty : entry_point = ((InterpreterGenerator*) this)->generate_empty_entry(); break;
1394 case Interpreter::accessor : entry_point = ((InterpreterGenerator*) this)->generate_accessor_entry(); break; 1414 case Interpreter::accessor : entry_point = ((InterpreterGenerator*) this)->generate_accessor_entry(); break;
1395 case Interpreter::abstract : entry_point = ((InterpreterGenerator*) this)->generate_abstract_entry(); break; 1415 case Interpreter::abstract : entry_point = ((InterpreterGenerator*) this)->generate_abstract_entry(); break;
1416 case Interpreter::method_handle : entry_point = ((InterpreterGenerator*) this)->generate_method_handle_entry();break;
1396 1417
1397 case Interpreter::java_lang_math_sin : // fall thru 1418 case Interpreter::java_lang_math_sin : // fall thru
1398 case Interpreter::java_lang_math_cos : // fall thru 1419 case Interpreter::java_lang_math_cos : // fall thru
1399 case Interpreter::java_lang_math_tan : // fall thru 1420 case Interpreter::java_lang_math_tan : // fall thru
1400 case Interpreter::java_lang_math_abs : // fall thru 1421 case Interpreter::java_lang_math_abs : // fall thru
1421 // to/from the overhead area 1442 // to/from the overhead area
1422 const int overhead_size = 1443 const int overhead_size =
1423 -(frame::interpreter_frame_initial_sp_offset) + entry_size; 1444 -(frame::interpreter_frame_initial_sp_offset) + entry_size;
1424 1445
1425 const int stub_code = frame::entry_frame_after_call_words; 1446 const int stub_code = frame::entry_frame_after_call_words;
1426 const int method_stack = (method->max_locals() + method->max_stack()) * 1447 const int extra_stack = methodOopDesc::extra_stack_entries();
1448 const int method_stack = (method->max_locals() + method->max_stack() + extra_stack) *
1427 Interpreter::stackElementWords(); 1449 Interpreter::stackElementWords();
1428 return (overhead_size + method_stack + stub_code); 1450 return (overhead_size + method_stack + stub_code);
1429 } 1451 }
1430 1452
1431 int AbstractInterpreter::layout_activation(methodOop method, 1453 int AbstractInterpreter::layout_activation(methodOop method,