1 /*
2  * Copyright (c) 2013, Red Hat Inc.
3  * Copyright (c) 2010, 2012, Oracle and/or its affiliates.
4  * All rights reserved.
5  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6  *
7  * This code is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License version 2 only, as
9  * published by the Free Software Foundation.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  *
25  */
26 
27 // Platform-specific definitions for method handles.
28 // These definitions are inlined into class MethodHandles.
29 
30 // Adapters
31 enum /* platform_dependent_constants */ {
32   adapter_code_size = 32000 DEBUG_ONLY(+ 120000)
33 };
34 
35 public:
36 
37   static void load_klass_from_Class(MacroAssembler* _masm, Register klass_reg);
38 
39   static void verify_klass(MacroAssembler* _masm,
40                            Register obj, SystemDictionary::WKID klass_id,
41                            const char* error_message = "wrong klass") NOT_DEBUG_RETURN;
42 
verify_method_handle(MacroAssembler * _masm,Register mh_reg)43   static void verify_method_handle(MacroAssembler* _masm, Register mh_reg) {
44     verify_klass(_masm, mh_reg, SystemDictionary::WK_KLASS_ENUM_NAME(java_lang_invoke_MethodHandle),
45                  "reference is a MH");
46   }
47 
48   static void verify_ref_kind(MacroAssembler* _masm, int ref_kind, Register member_reg, Register temp) NOT_DEBUG_RETURN;
49 
50   // Similar to InterpreterMacroAssembler::jump_from_interpreted.
51   // Takes care of special dispatch from single stepping too.
52   static void jump_from_method_handle(MacroAssembler* _masm, Register method, Register temp,
53                                       bool for_compiler_entry);
54 
55   static void jump_to_lambda_form(MacroAssembler* _masm,
56                                   Register recv, Register method_temp,
57                                   Register temp2,
58                                   bool for_compiler_entry);
59 
saved_last_sp_register()60   static Register saved_last_sp_register() {
61     // Should be in sharedRuntime, not here.
62     return noreg;
63   }
64