never@2895: /* bdelsart@3445: * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. never@2895: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. never@2895: * never@2895: * This code is free software; you can redistribute it and/or modify it never@2895: * under the terms of the GNU General Public License version 2 only, as never@2895: * published by the Free Software Foundation. never@2895: * never@2895: * This code is distributed in the hope that it will be useful, but WITHOUT never@2895: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or never@2895: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License never@2895: * version 2 for more details (a copy is included in the LICENSE file that never@2895: * accompanied this code). never@2895: * never@2895: * You should have received a copy of the GNU General Public License version never@2895: * 2 along with this work; if not, write to the Free Software Foundation, never@2895: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. never@2895: * never@2895: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA never@2895: * or visit www.oracle.com if you need additional information or have any never@2895: * questions. never@2895: * never@2895: */ never@2895: never@2895: // Platform-specific definitions for method handles. never@2895: // These definitions are inlined into class MethodHandles. never@2895: never@2950: // Adapters never@2950: enum /* platform_dependent_constants */ { twisti@3969: adapter_code_size = NOT_LP64(16000 DEBUG_ONLY(+ 25000)) LP64_ONLY(32000 DEBUG_ONLY(+ 150000)) never@2895: }; never@2895: never@2895: // Additional helper methods for MethodHandles code generation: never@2895: public: never@2895: static void load_klass_from_Class(MacroAssembler* _masm, Register klass_reg); never@2895: never@2895: static void verify_klass(MacroAssembler* _masm, coleenp@4037: Register obj, SystemDictionary::WKID klass_id, never@2895: const char* error_message = "wrong klass") NOT_DEBUG_RETURN; never@2895: never@2895: static void verify_method_handle(MacroAssembler* _masm, Register mh_reg) { coleenp@4037: verify_klass(_masm, mh_reg, SystemDictionary::WK_KLASS_ENUM_NAME(java_lang_invoke_MethodHandle), never@2895: "reference is a MH"); never@2895: } never@2895: twisti@3969: static void verify_ref_kind(MacroAssembler* _masm, int ref_kind, Register member_reg, Register temp) NOT_DEBUG_RETURN; twisti@3969: never@3005: // Similar to InterpreterMacroAssembler::jump_from_interpreted. never@3005: // Takes care of special dispatch from single stepping too. twisti@3969: static void jump_from_method_handle(MacroAssembler* _masm, Register method, Register temp, twisti@3969: bool for_compiler_entry); twisti@3969: twisti@3969: static void jump_to_lambda_form(MacroAssembler* _masm, twisti@3969: Register recv, Register method_temp, twisti@3969: Register temp2, twisti@3969: bool for_compiler_entry); never@3005: never@2895: static void trace_method_handle(MacroAssembler* _masm, const char* adaptername) PRODUCT_RETURN; never@2895: never@2895: static Register saved_last_sp_register() { never@2895: // Should be in sharedRuntime, not here. never@2895: return LP64_ONLY(r13) NOT_LP64(rsi); never@2895: }