Mercurial > hg > graal-compiler
annotate src/os_cpu/linux_x86/vm/assembler_linux_x86.cpp @ 7140:eb62c63c4549
made word type rewriting do stamp inference so that word typed phis are handled correctly
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 07 Dec 2012 11:09:17 +0100 |
parents | 65dba8692db7 |
children | cd3d6a6b95d9 |
rev | line source |
---|---|
0 | 1 /* |
1972 | 2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
304
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
304
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
304
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "asm/assembler.hpp" | |
27 #include "assembler_x86.inline.hpp" | |
28 #include "runtime/os.hpp" | |
29 #include "runtime/threadLocalStorage.hpp" | |
0 | 30 |
304 | 31 #ifndef _LP64 |
0 | 32 void MacroAssembler::int3() { |
33 call(RuntimeAddress(CAST_FROM_FN_PTR(address, os::breakpoint))); | |
34 } | |
35 | |
3798
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
36 #ifdef MINIMIZE_RAM_USAGE |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
37 |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
38 void MacroAssembler::get_thread(Register thread) { |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
39 // call pthread_getspecific |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
40 // void * pthread_getspecific(pthread_key_t key); |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
41 if (thread != rax) push(rax); |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
42 push(rcx); |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
43 push(rdx); |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
44 |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
45 push(ThreadLocalStorage::thread_index()); |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
46 call(RuntimeAddress(CAST_FROM_FN_PTR(address, pthread_getspecific))); |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
47 increment(rsp, wordSize); |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
48 |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
49 pop(rdx); |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
50 pop(rcx); |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
51 if (thread != rax) { |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
52 mov(thread, rax); |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
53 pop(rax); |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
54 } |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
55 } |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
56 |
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
57 #else |
0 | 58 void MacroAssembler::get_thread(Register thread) { |
59 movl(thread, rsp); | |
60 shrl(thread, PAGE_SHIFT); | |
61 | |
62 ExternalAddress tls_base((address)ThreadLocalStorage::sp_map_addr()); | |
63 Address index(noreg, thread, Address::times_4); | |
64 ArrayAddress tls(tls_base, index); | |
65 | |
66 movptr(thread, tls); | |
67 } | |
3798
65dba8692db7
7061197: ThreadLocalStorage sp map table should be optional
jcoomes
parents:
1972
diff
changeset
|
68 #endif // MINIMIZE_RAM_USAGE |
304 | 69 #else |
70 void MacroAssembler::int3() { | |
71 call(RuntimeAddress(CAST_FROM_FN_PTR(address, os::breakpoint))); | |
72 } | |
73 | |
74 void MacroAssembler::get_thread(Register thread) { | |
75 // call pthread_getspecific | |
76 // void * pthread_getspecific(pthread_key_t key); | |
77 if (thread != rax) { | |
78 push(rax); | |
79 } | |
80 push(rdi); | |
81 push(rsi); | |
82 push(rdx); | |
83 push(rcx); | |
84 push(r8); | |
85 push(r9); | |
86 push(r10); | |
87 // XXX | |
88 mov(r10, rsp); | |
89 andq(rsp, -16); | |
90 push(r10); | |
91 push(r11); | |
92 | |
93 movl(rdi, ThreadLocalStorage::thread_index()); | |
94 call(RuntimeAddress(CAST_FROM_FN_PTR(address, pthread_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 if (thread != rax) { | |
106 mov(thread, rax); | |
107 pop(rax); | |
108 } | |
109 } | |
110 #endif |