Mercurial > hg > truffle
annotate src/os_cpu/solaris_x86/vm/assembler_solaris_x86_64.cpp @ 210:05712c37c828
6676016: ParallelOldGC leaks memory
Summary: ensure that GCTask threads release resource and handle memory
Reviewed-by: jmasa, chrisphi
author | jcoomes |
---|---|
date | Wed, 18 Jun 2008 18:36:47 -0700 |
parents | 7793bd37a336 |
children | d1605aabd0a1 |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright 2004-2005 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 * | |
23 */ | |
24 | |
25 #include "incls/_precompiled.incl" | |
26 #include "incls/_assembler_solaris_x86_64.cpp.incl" | |
27 | |
28 void MacroAssembler::int3() { | |
29 call(RuntimeAddress(CAST_FROM_FN_PTR(address, os::breakpoint))); | |
30 } | |
31 | |
32 void MacroAssembler::get_thread(Register thread) { | |
33 // Try to emit a Solaris-specific fast TSD/TLS accessor. | |
34 ThreadLocalStorage::pd_tlsAccessMode tlsMode = ThreadLocalStorage::pd_getTlsAccessMode(); | |
35 if (tlsMode == ThreadLocalStorage::pd_tlsAccessIndirect) { // T1 | |
36 // Use thread as a temporary: mov r, fs:[0]; mov r, [r+tlsOffset] | |
37 emit_byte(Assembler::FS_segment); | |
38 movq(thread, Address(NULL, relocInfo::none)); | |
39 movq(thread, Address(thread, ThreadLocalStorage::pd_getTlsOffset())); | |
40 return; | |
41 } else if (tlsMode == ThreadLocalStorage::pd_tlsAccessDirect) { // T2 | |
42 // mov r, fs:[tlsOffset] | |
43 emit_byte(Assembler::FS_segment); | |
44 ExternalAddress tls_off((address) ThreadLocalStorage::pd_getTlsOffset()); | |
45 movptr(thread, tls_off); | |
46 return; | |
47 } | |
48 | |
49 // slow call to of thr_getspecific | |
50 // int thr_getspecific(thread_key_t key, void **value); | |
51 // Consider using pthread_getspecific instead. | |
52 | |
53 if (thread != rax) { | |
54 pushq(rax); | |
55 } | |
56 pushq(0); // space for return value | |
57 pushq(rdi); | |
58 pushq(rsi); | |
59 leaq(rsi, Address(rsp, 16)); // pass return value address | |
60 pushq(rdx); | |
61 pushq(rcx); | |
62 pushq(r8); | |
63 pushq(r9); | |
64 pushq(r10); | |
65 // XXX | |
66 movq(r10, rsp); | |
67 andq(rsp, -16); | |
68 pushq(r10); | |
69 pushq(r11); | |
70 | |
71 movl(rdi, ThreadLocalStorage::thread_index()); | |
72 call(RuntimeAddress(CAST_FROM_FN_PTR(address, thr_getspecific))); | |
73 | |
74 popq(r11); | |
75 popq(rsp); | |
76 popq(r10); | |
77 popq(r9); | |
78 popq(r8); | |
79 popq(rcx); | |
80 popq(rdx); | |
81 popq(rsi); | |
82 popq(rdi); | |
83 popq(thread); // load return value | |
84 if (thread != rax) { | |
85 popq(rax); | |
86 } | |
87 } | |
88 | |
168
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
0
diff
changeset
|
89 bool MacroAssembler::needs_explicit_null_check(intptr_t offset) { |
0 | 90 // Identical to Sparc/Solaris code |
168
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
0
diff
changeset
|
91 |
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
0
diff
changeset
|
92 // Exception handler checks the nmethod's implicit null checks table |
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
0
diff
changeset
|
93 // only when this method returns false. |
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
0
diff
changeset
|
94 if (UseCompressedOops) { |
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
0
diff
changeset
|
95 // The first page after heap_base is unmapped and |
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
0
diff
changeset
|
96 // the 'offset' is equal to [heap_base + offset] for |
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
0
diff
changeset
|
97 // narrow oop implicit null checks. |
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
0
diff
changeset
|
98 uintptr_t heap_base = (uintptr_t)Universe::heap_base(); |
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
0
diff
changeset
|
99 if ((uintptr_t)offset >= heap_base) { |
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
0
diff
changeset
|
100 // Normalize offset for the next check. |
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
0
diff
changeset
|
101 offset = (intptr_t)(pointer_delta((void*)offset, (void*)heap_base, 1)); |
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
0
diff
changeset
|
102 } |
7793bd37a336
6705887: Compressed Oops: generate x64 addressing and implicit null checks with narrow oops
kvn
parents:
0
diff
changeset
|
103 } |
0 | 104 bool offset_in_first_page = 0 <= offset && offset < os::vm_page_size(); |
105 return !offset_in_first_page; | |
106 } |