1 #ifdef USE_PRAGMA_IDENT_SRC
2 #pragma ident "@(#)interpreterRT_x86_32.cpp 1.58 07/09/17 09:26:03 JVM"
3 #endif
4 /*
5 * Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * This code is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 only, as
10 * published by the Free Software Foundation.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
24 * have any questions.
25 *
36 void InterpreterRuntime::SignatureHandlerGenerator::pass_int() {
37 move(offset(), jni_offset() + 1);
38 }
39
40 void InterpreterRuntime::SignatureHandlerGenerator::pass_long() {
41 move(offset(), jni_offset() + 2);
42 move(offset() + 1, jni_offset() + 1);
43 }
44
45 void InterpreterRuntime::SignatureHandlerGenerator::pass_object() {
46 box (offset(), jni_offset() + 1);
47 }
48
49 void InterpreterRuntime::SignatureHandlerGenerator::move(int from_offset, int to_offset) {
50 __ movl(temp(), Address(from(), Interpreter::local_offset_in_bytes(from_offset)));
51 __ movl(Address(to(), to_offset * wordSize), temp());
52 }
53
54
55 void InterpreterRuntime::SignatureHandlerGenerator::box(int from_offset, int to_offset) {
56 __ leal(temp(), Address(from(), Interpreter::local_offset_in_bytes(from_offset)));
57 __ cmpl(Address(from(), Interpreter::local_offset_in_bytes(from_offset)), 0); // do not use temp() to avoid AGI
58 Label L;
59 __ jcc(Assembler::notZero, L);
60 __ movl(temp(), 0);
61 __ bind(L);
62 __ movl(Address(to(), to_offset * wordSize), temp());
63 }
64
65
66 void InterpreterRuntime::SignatureHandlerGenerator::generate( uint64_t fingerprint) {
67 // generate code to handle arguments
68 iterate(fingerprint);
69 // return result handler
70 __ lea(rax,
71 ExternalAddress((address)Interpreter::result_handler(method()->result_type())));
72 // return
73 __ ret(0);
74 __ flush();
75 }
76
77
78 Register InterpreterRuntime::SignatureHandlerGenerator::from() { return rdi; }
79 Register InterpreterRuntime::SignatureHandlerGenerator::to() { return rsp; }
80 Register InterpreterRuntime::SignatureHandlerGenerator::temp() { return rcx; }
81
82
|
1 /*
2 * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
33 void InterpreterRuntime::SignatureHandlerGenerator::pass_int() {
34 move(offset(), jni_offset() + 1);
35 }
36
37 void InterpreterRuntime::SignatureHandlerGenerator::pass_long() {
38 move(offset(), jni_offset() + 2);
39 move(offset() + 1, jni_offset() + 1);
40 }
41
42 void InterpreterRuntime::SignatureHandlerGenerator::pass_object() {
43 box (offset(), jni_offset() + 1);
44 }
45
46 void InterpreterRuntime::SignatureHandlerGenerator::move(int from_offset, int to_offset) {
47 __ movl(temp(), Address(from(), Interpreter::local_offset_in_bytes(from_offset)));
48 __ movl(Address(to(), to_offset * wordSize), temp());
49 }
50
51
52 void InterpreterRuntime::SignatureHandlerGenerator::box(int from_offset, int to_offset) {
53 __ lea(temp(), Address(from(), Interpreter::local_offset_in_bytes(from_offset)));
54 __ cmpptr(Address(from(), Interpreter::local_offset_in_bytes(from_offset)), (int32_t)NULL_WORD); // do not use temp() to avoid AGI
55 Label L;
56 __ jcc(Assembler::notZero, L);
57 __ movptr(temp(), ((int32_t)NULL_WORD));
58 __ bind(L);
59 __ movptr(Address(to(), to_offset * wordSize), temp());
60 }
61
62
63 void InterpreterRuntime::SignatureHandlerGenerator::generate( uint64_t fingerprint) {
64 // generate code to handle arguments
65 iterate(fingerprint);
66 // return result handler
67 __ lea(rax,
68 ExternalAddress((address)Interpreter::result_handler(method()->result_type())));
69 // return
70 __ ret(0);
71 __ flush();
72 }
73
74
75 Register InterpreterRuntime::SignatureHandlerGenerator::from() { return rdi; }
76 Register InterpreterRuntime::SignatureHandlerGenerator::to() { return rsp; }
77 Register InterpreterRuntime::SignatureHandlerGenerator::temp() { return rcx; }
78
79
|