author | sundar |
Tue, 25 Jun 2013 17:31:19 +0530 | |
changeset 18615 | 3f6e6adcbc1a |
parent 14837 | a75c3082d106 |
child 32181 | dee472a9b4db |
permissions | -rw-r--r-- |
1 | 1 |
/* |
7397 | 2 |
* Copyright (c) 1999, 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:
1066
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1066
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:
1066
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
14626
0cf4eccf130f
8003240: x86: move MacroAssembler into separate file
twisti
parents:
7397
diff
changeset
|
26 |
#include "asm/macroAssembler.hpp" |
0cf4eccf130f
8003240: x86: move MacroAssembler into separate file
twisti
parents:
7397
diff
changeset
|
27 |
#include "asm/macroAssembler.inline.hpp" |
7397 | 28 |
#include "runtime/os.hpp" |
29 |
#include "runtime/threadLocalStorage.hpp" |
|
1 | 30 |
|
31 |
||
32 |
void MacroAssembler::int3() { |
|
1066 | 33 |
push(rax); |
34 |
push(rdx); |
|
35 |
push(rcx); |
|
1 | 36 |
call(RuntimeAddress(CAST_FROM_FN_PTR(address, os::breakpoint))); |
1066 | 37 |
pop(rcx); |
38 |
pop(rdx); |
|
39 |
pop(rax); |
|
1 | 40 |
} |
41 |
||
1066 | 42 |
#define __ _masm-> |
43 |
#ifndef _LP64 |
|
44 |
static void slow_call_thr_specific(MacroAssembler* _masm, Register thread) { |
|
1 | 45 |
|
46 |
// slow call to of thr_getspecific |
|
47 |
// int thr_getspecific(thread_key_t key, void **value); |
|
48 |
// Consider using pthread_getspecific instead. |
|
49 |
||
1066 | 50 |
__ push(0); // allocate space for return value |
51 |
if (thread != rax) __ push(rax); // save rax, if caller still wants it |
|
52 |
__ push(rcx); // save caller save |
|
53 |
__ push(rdx); // save caller save |
|
1 | 54 |
if (thread != rax) { |
1066 | 55 |
__ lea(thread, Address(rsp, 3 * sizeof(int))); // address of return value |
1 | 56 |
} else { |
1066 | 57 |
__ lea(thread, Address(rsp, 2 * sizeof(int))); // address of return value |
58 |
} |
|
59 |
__ push(thread); // and pass the address |
|
60 |
__ push(ThreadLocalStorage::thread_index()); // the key |
|
61 |
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, thr_getspecific))); |
|
62 |
__ increment(rsp, 2 * wordSize); |
|
63 |
__ pop(rdx); |
|
64 |
__ pop(rcx); |
|
65 |
if (thread != rax) __ pop(rax); |
|
66 |
__ pop(thread); |
|
67 |
||
68 |
} |
|
69 |
#else |
|
70 |
static void slow_call_thr_specific(MacroAssembler* _masm, Register thread) { |
|
71 |
// slow call to of thr_getspecific |
|
72 |
// int thr_getspecific(thread_key_t key, void **value); |
|
73 |
// Consider using pthread_getspecific instead. |
|
74 |
||
75 |
if (thread != rax) { |
|
76 |
__ push(rax); |
|
1 | 77 |
} |
1066 | 78 |
__ push(0); // space for return value |
79 |
__ push(rdi); |
|
80 |
__ push(rsi); |
|
81 |
__ lea(rsi, Address(rsp, 16)); // pass return value address |
|
82 |
__ push(rdx); |
|
83 |
__ push(rcx); |
|
84 |
__ push(r8); |
|
85 |
__ push(r9); |
|
86 |
__ push(r10); |
|
87 |
// XXX |
|
88 |
__ mov(r10, rsp); |
|
89 |
__ andptr(rsp, -16); |
|
90 |
__ push(r10); |
|
91 |
__ push(r11); |
|
92 |
||
93 |
__ movl(rdi, ThreadLocalStorage::thread_index()); |
|
94 |
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, thr_getspecific))); |
|
95 |
||
96 |
__ pop(r11); |
|
97 |
__ pop(rsp); |
|
98 |
__ pop(r10); |
|
99 |
__ pop(r9); |
|
100 |
__ pop(r8); |
|
101 |
__ pop(rcx); |
|
102 |
__ pop(rdx); |
|
103 |
__ pop(rsi); |
|
104 |
__ pop(rdi); |
|
105 |
__ pop(thread); // load return value |
|
106 |
if (thread != rax) { |
|
107 |
__ pop(rax); |
|
108 |
} |
|
1 | 109 |
} |
1066 | 110 |
#endif //LP64 |
111 |
||
112 |
void MacroAssembler::get_thread(Register thread) { |
|
113 |
||
114 |
int segment = NOT_LP64(Assembler::GS_segment) LP64_ONLY(Assembler::FS_segment); |
|
115 |
// Try to emit a Solaris-specific fast TSD/TLS accessor. |
|
116 |
ThreadLocalStorage::pd_tlsAccessMode tlsMode = ThreadLocalStorage::pd_getTlsAccessMode (); |
|
117 |
if (tlsMode == ThreadLocalStorage::pd_tlsAccessIndirect) { // T1 |
|
118 |
// Use thread as a temporary: mov r, gs:[0]; mov r, [r+tlsOffset] |
|
14837
a75c3082d106
8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents:
14626
diff
changeset
|
119 |
emit_int8 (segment); |
1066 | 120 |
// ExternalAddress doesn't work because it can't take NULL |
121 |
AddressLiteral null(0, relocInfo::none); |
|
122 |
movptr (thread, null); |
|
123 |
movptr(thread, Address(thread, ThreadLocalStorage::pd_getTlsOffset())) ; |
|
124 |
return ; |
|
125 |
} else |
|
126 |
if (tlsMode == ThreadLocalStorage::pd_tlsAccessDirect) { // T2 |
|
127 |
// mov r, gs:[tlsOffset] |
|
14837
a75c3082d106
8004250: replace AbstractAssembler a_byte/a_long with emit_int8/emit_int32
twisti
parents:
14626
diff
changeset
|
128 |
emit_int8 (segment); |
1066 | 129 |
AddressLiteral tls_off((address)ThreadLocalStorage::pd_getTlsOffset(), relocInfo::none); |
130 |
movptr (thread, tls_off); |
|
131 |
return ; |
|
132 |
} |
|
133 |
||
134 |
slow_call_thr_specific(this, thread); |
|
135 |
||
136 |
} |