1 /* 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 3 * Copyright 2012, 2013 SAP AG. All rights reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 * 93 Register r = jni_arg.is_register() ? jni_arg.as_register() : R11_scratch1; 94 95 // The handle for a receiver will never be null. 96 bool do_NULL_check = offset() != 0 || is_static(); 97 98 Label do_null; 99 if (do_NULL_check) { 100 __ ld(R0, locals_j_arg_at(offset())); 101 __ cmpdi(CCR0, R0, 0); 102 __ li(r, 0); 103 __ beq(CCR0, do_null); 104 } 105 __ addir(r, locals_j_arg_at(offset())); 106 __ bind(do_null); 107 if (DEBUG_ONLY(true ||) !jni_arg.is_register()) { 108 __ std(r, sp_c_arg_at(jni_arg.number())); 109 } 110 } 111 112 void InterpreterRuntime::SignatureHandlerGenerator::generate(uint64_t fingerprint) { 113 #if !defined(ABI_ELFv2) 114 // Emit fd for current codebuffer. Needs patching! 115 __ emit_fd(); 116 #endif 117 118 // Generate code to handle arguments. 119 iterate(fingerprint); 120 121 // Return the result handler. 122 __ load_const(R3_RET, AbstractInterpreter::result_handler(method()->result_type())); 123 __ blr(); 124 125 __ flush(); 126 } 127 128 #undef __ 129 130 // Implementation of SignatureHandlerLibrary 131 132 void SignatureHandlerLibrary::pd_set_handler(address handler) { 133 #if !defined(ABI_ELFv2) 134 // patch fd here. 135 FunctionDescriptor* fd = (FunctionDescriptor*) handler; 136 | 1 /* 2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. 3 * Copyright 2012, 2015 SAP AG. All rights reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 * 93 Register r = jni_arg.is_register() ? jni_arg.as_register() : R11_scratch1; 94 95 // The handle for a receiver will never be null. 96 bool do_NULL_check = offset() != 0 || is_static(); 97 98 Label do_null; 99 if (do_NULL_check) { 100 __ ld(R0, locals_j_arg_at(offset())); 101 __ cmpdi(CCR0, R0, 0); 102 __ li(r, 0); 103 __ beq(CCR0, do_null); 104 } 105 __ addir(r, locals_j_arg_at(offset())); 106 __ bind(do_null); 107 if (DEBUG_ONLY(true ||) !jni_arg.is_register()) { 108 __ std(r, sp_c_arg_at(jni_arg.number())); 109 } 110 } 111 112 void InterpreterRuntime::SignatureHandlerGenerator::generate(uint64_t fingerprint) { 113 // Emit fd for current codebuffer. Needs patching! 114 __ emit_fd(); 115 116 // Generate code to handle arguments. 117 iterate(fingerprint); 118 119 // Return the result handler. 120 __ load_const(R3_RET, AbstractInterpreter::result_handler(method()->result_type())); 121 __ blr(); 122 123 __ flush(); 124 } 125 126 #undef __ 127 128 // Implementation of SignatureHandlerLibrary 129 130 void SignatureHandlerLibrary::pd_set_handler(address handler) { 131 #if !defined(ABI_ELFv2) 132 // patch fd here. 133 FunctionDescriptor* fd = (FunctionDescriptor*) handler; 134 |