author | stefank |
Tue, 23 Nov 2010 13:22:55 -0800 | |
changeset 7397 | 5b173b4ca846 |
parent 6176 | 4d9030fe341f |
child 13728 | 882756847a04 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5419
diff
changeset
|
2 |
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5419
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5419
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5419
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "interpreter/interpreter.hpp" |
|
27 |
#include "interpreter/interpreterRuntime.hpp" |
|
28 |
#include "memory/allocation.inline.hpp" |
|
29 |
#include "memory/universe.inline.hpp" |
|
30 |
#include "oops/methodOop.hpp" |
|
31 |
#include "oops/oop.inline.hpp" |
|
32 |
#include "runtime/handles.inline.hpp" |
|
33 |
#include "runtime/icache.hpp" |
|
34 |
#include "runtime/interfaceSupport.hpp" |
|
35 |
#include "runtime/signature.hpp" |
|
1 | 36 |
|
37 |
||
38 |
#define __ _masm-> |
|
39 |
||
40 |
||
41 |
// Implementation of SignatureHandlerGenerator |
|
42 |
void InterpreterRuntime::SignatureHandlerGenerator::pass_int() { |
|
43 |
move(offset(), jni_offset() + 1); |
|
44 |
} |
|
45 |
||
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
46 |
void InterpreterRuntime::SignatureHandlerGenerator::pass_float() { |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
47 |
move(offset(), jni_offset() + 1); |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
48 |
} |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
49 |
|
1 | 50 |
void InterpreterRuntime::SignatureHandlerGenerator::pass_long() { |
51 |
move(offset(), jni_offset() + 2); |
|
52 |
move(offset() + 1, jni_offset() + 1); |
|
53 |
} |
|
54 |
||
55 |
void InterpreterRuntime::SignatureHandlerGenerator::pass_object() { |
|
56 |
box (offset(), jni_offset() + 1); |
|
57 |
} |
|
58 |
||
59 |
void InterpreterRuntime::SignatureHandlerGenerator::move(int from_offset, int to_offset) { |
|
60 |
__ movl(temp(), Address(from(), Interpreter::local_offset_in_bytes(from_offset))); |
|
61 |
__ movl(Address(to(), to_offset * wordSize), temp()); |
|
62 |
} |
|
63 |
||
64 |
||
65 |
void InterpreterRuntime::SignatureHandlerGenerator::box(int from_offset, int to_offset) { |
|
1066 | 66 |
__ lea(temp(), Address(from(), Interpreter::local_offset_in_bytes(from_offset))); |
67 |
__ cmpptr(Address(from(), Interpreter::local_offset_in_bytes(from_offset)), (int32_t)NULL_WORD); // do not use temp() to avoid AGI |
|
1 | 68 |
Label L; |
69 |
__ jcc(Assembler::notZero, L); |
|
1888
bbf498fb4354
6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents:
1217
diff
changeset
|
70 |
__ movptr(temp(), NULL_WORD); |
1 | 71 |
__ bind(L); |
1066 | 72 |
__ movptr(Address(to(), to_offset * wordSize), temp()); |
1 | 73 |
} |
74 |
||
75 |
||
76 |
void InterpreterRuntime::SignatureHandlerGenerator::generate( uint64_t fingerprint) { |
|
77 |
// generate code to handle arguments |
|
78 |
iterate(fingerprint); |
|
79 |
// return result handler |
|
80 |
__ lea(rax, |
|
81 |
ExternalAddress((address)Interpreter::result_handler(method()->result_type()))); |
|
82 |
// return |
|
83 |
__ ret(0); |
|
84 |
__ flush(); |
|
85 |
} |
|
86 |
||
87 |
||
88 |
Register InterpreterRuntime::SignatureHandlerGenerator::from() { return rdi; } |
|
89 |
Register InterpreterRuntime::SignatureHandlerGenerator::to() { return rsp; } |
|
90 |
Register InterpreterRuntime::SignatureHandlerGenerator::temp() { return rcx; } |
|
91 |
||
92 |
||
93 |
// Implementation of SignatureHandlerLibrary |
|
94 |
||
95 |
void SignatureHandlerLibrary::pd_set_handler(address handler) {} |
|
96 |
||
97 |
class SlowSignatureHandler: public NativeSignatureIterator { |
|
98 |
private: |
|
99 |
address _from; |
|
100 |
intptr_t* _to; |
|
101 |
||
102 |
virtual void pass_int() { |
|
103 |
*_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0)); |
|
5419 | 104 |
_from -= Interpreter::stackElementSize; |
1 | 105 |
} |
106 |
||
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
107 |
virtual void pass_float() { |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
108 |
*_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0)); |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
109 |
_from -= Interpreter::stackElementSize; |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
110 |
} |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
111 |
|
1 | 112 |
virtual void pass_long() { |
113 |
_to[0] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1)); |
|
114 |
_to[1] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(0)); |
|
115 |
_to += 2; |
|
5419 | 116 |
_from -= 2*Interpreter::stackElementSize; |
1 | 117 |
} |
118 |
||
119 |
virtual void pass_object() { |
|
120 |
// pass address of from |
|
121 |
intptr_t from_addr = (intptr_t)(_from + Interpreter::local_offset_in_bytes(0)); |
|
1909
952b42dad1fc
6795913: A few remaining wrong casts need to be fixed for building hotspot successfully on Mac OS.
xlu
parents:
1888
diff
changeset
|
122 |
*_to++ = (*(intptr_t*)from_addr == 0) ? NULL_WORD : from_addr; |
5419 | 123 |
_from -= Interpreter::stackElementSize; |
1 | 124 |
} |
125 |
||
126 |
public: |
|
127 |
SlowSignatureHandler(methodHandle method, address from, intptr_t* to) : |
|
128 |
NativeSignatureIterator(method) { |
|
129 |
_from = from; |
|
130 |
_to = to + (is_static() ? 2 : 1); |
|
131 |
} |
|
132 |
}; |
|
133 |
||
134 |
IRT_ENTRY(address, InterpreterRuntime::slow_signature_handler(JavaThread* thread, methodOopDesc* method, intptr_t* from, intptr_t* to)) |
|
135 |
methodHandle m(thread, (methodOop)method); |
|
136 |
assert(m->is_native(), "sanity check"); |
|
137 |
// handle arguments |
|
138 |
SlowSignatureHandler(m, (address)from, to + 1).iterate(UCONST64(-1)); |
|
139 |
// return result handler |
|
140 |
return Interpreter::result_handler(m->result_type()); |
|
141 |
IRT_END |