annotate src/os_cpu/solaris_x86/vm/solaris_x86_64.il @ 4749:7ab5f6318694

7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64 Summary: Add rdtsc detection and inline generation. Reviewed-by: kamg, dholmes Contributed-by: karen.kinnear@oracle.com
author phh
date Sun, 01 Jan 2012 11:17:59 -0500
parents 0a8e0d4345b3
children da4be62fb889
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 //
2042
0a8e0d4345b3 7010068: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - first pass
trims
parents: 1552
diff changeset
2 // Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 //
a61af66fc99e Initial load
duke
parents:
diff changeset
5 // This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 // under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 // published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 //
a61af66fc99e Initial load
duke
parents:
diff changeset
9 // This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 // version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 // accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 //
a61af66fc99e Initial load
duke
parents:
diff changeset
15 // You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 // 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 // Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 //
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1547
diff changeset
19 // Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1547
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: 1547
diff changeset
21 // questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 //
a61af66fc99e Initial load
duke
parents:
diff changeset
23 //
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 // The argument size of each inline directive is ignored by the compiler
a61af66fc99e Initial load
duke
parents:
diff changeset
26 // and is set to the number of arguments as documentation.
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28 // Get the raw thread ID from %gs:0
a61af66fc99e Initial load
duke
parents:
diff changeset
29 .inline _raw_thread_id,0
a61af66fc99e Initial load
duke
parents:
diff changeset
30 movq %fs:0, %rax
a61af66fc99e Initial load
duke
parents:
diff changeset
31 .end
a61af66fc99e Initial load
duke
parents:
diff changeset
32
4749
7ab5f6318694 7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents: 2042
diff changeset
33 // Get current fp
472
7b920868b475 6773838: There is no calling stack for Compiler thread in hs_err file on x86
coleenp
parents: 0
diff changeset
34 .inline _get_current_fp,0
7b920868b475 6773838: There is no calling stack for Compiler thread in hs_err file on x86
coleenp
parents: 0
diff changeset
35 .volatile
0
a61af66fc99e Initial load
duke
parents:
diff changeset
36 movq %rbp, %rax
a61af66fc99e Initial load
duke
parents:
diff changeset
37 .end
a61af66fc99e Initial load
duke
parents:
diff changeset
38
4749
7ab5f6318694 7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents: 2042
diff changeset
39 // Support for os::rdtsc()
7ab5f6318694 7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents: 2042
diff changeset
40 .inline _raw_rdtsc,0
7ab5f6318694 7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents: 2042
diff changeset
41 rdtsc
7ab5f6318694 7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents: 2042
diff changeset
42 salq $32, %rdx
7ab5f6318694 7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents: 2042
diff changeset
43 orq %rdx, %rax
7ab5f6318694 7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents: 2042
diff changeset
44 .end
7ab5f6318694 7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents: 2042
diff changeset
45
0
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // Support for jint Atomic::add(jint add_value, volatile jint* dest)
1547
fb1a39993f69 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 579
diff changeset
47 .inline _Atomic_add,2
0
a61af66fc99e Initial load
duke
parents:
diff changeset
48 movl %edi, %eax // save add_value for return
a61af66fc99e Initial load
duke
parents:
diff changeset
49 lock
1547
fb1a39993f69 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 579
diff changeset
50 xaddl %edi, (%rsi)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
51 addl %edi, %eax
a61af66fc99e Initial load
duke
parents:
diff changeset
52 .end
a61af66fc99e Initial load
duke
parents:
diff changeset
53
a61af66fc99e Initial load
duke
parents:
diff changeset
54 // Support for jlong Atomic::add(jlong add_value, volatile jlong* dest)
1547
fb1a39993f69 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 579
diff changeset
55 .inline _Atomic_add_long,2
0
a61af66fc99e Initial load
duke
parents:
diff changeset
56 movq %rdi, %rax // save add_value for return
a61af66fc99e Initial load
duke
parents:
diff changeset
57 lock
1547
fb1a39993f69 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 579
diff changeset
58 xaddq %rdi, (%rsi)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
59 addq %rdi, %rax
a61af66fc99e Initial load
duke
parents:
diff changeset
60 .end
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 // Support for jint Atomic::xchg(jint exchange_value, volatile jint* dest).
a61af66fc99e Initial load
duke
parents:
diff changeset
63 .inline _Atomic_xchg,2
a61af66fc99e Initial load
duke
parents:
diff changeset
64 xchgl (%rsi), %edi
a61af66fc99e Initial load
duke
parents:
diff changeset
65 movl %edi, %eax
a61af66fc99e Initial load
duke
parents:
diff changeset
66 .end
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // Support for jlong Atomic::xchg(jlong exchange_value, volatile jlong* dest).
a61af66fc99e Initial load
duke
parents:
diff changeset
69 .inline _Atomic_xchg_long,2
a61af66fc99e Initial load
duke
parents:
diff changeset
70 xchgq (%rsi), %rdi
a61af66fc99e Initial load
duke
parents:
diff changeset
71 movq %rdi, %rax
a61af66fc99e Initial load
duke
parents:
diff changeset
72 .end
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // Support for jint Atomic::cmpxchg(jint exchange_value,
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // volatile jint *dest,
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // jint compare_value)
1547
fb1a39993f69 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 579
diff changeset
77 .inline _Atomic_cmpxchg,3
0
a61af66fc99e Initial load
duke
parents:
diff changeset
78 movl %edx, %eax // compare_value
a61af66fc99e Initial load
duke
parents:
diff changeset
79 lock
1547
fb1a39993f69 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 579
diff changeset
80 cmpxchgl %edi, (%rsi)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
81 .end
a61af66fc99e Initial load
duke
parents:
diff changeset
82
a61af66fc99e Initial load
duke
parents:
diff changeset
83 // Support for jlong Atomic::cmpxchg(jlong exchange_value,
a61af66fc99e Initial load
duke
parents:
diff changeset
84 // volatile jlong* dest,
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // jlong compare_value)
1547
fb1a39993f69 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 579
diff changeset
86 .inline _Atomic_cmpxchg_long,3
0
a61af66fc99e Initial load
duke
parents:
diff changeset
87 movq %rdx, %rax // compare_value
a61af66fc99e Initial load
duke
parents:
diff changeset
88 lock
1547
fb1a39993f69 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 579
diff changeset
89 cmpxchgq %rdi, (%rsi)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
90 .end
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 // Support for OrderAccess::acquire()
a61af66fc99e Initial load
duke
parents:
diff changeset
93 .inline _OrderAccess_acquire,0
a61af66fc99e Initial load
duke
parents:
diff changeset
94 movl 0(%rsp), %eax
a61af66fc99e Initial load
duke
parents:
diff changeset
95 .end
a61af66fc99e Initial load
duke
parents:
diff changeset
96
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // Support for OrderAccess::fence()
a61af66fc99e Initial load
duke
parents:
diff changeset
98 .inline _OrderAccess_fence,0
a61af66fc99e Initial load
duke
parents:
diff changeset
99 lock
a61af66fc99e Initial load
duke
parents:
diff changeset
100 addl $0, (%rsp)
a61af66fc99e Initial load
duke
parents:
diff changeset
101 .end
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 // Support for u2 Bytes::swap_u2(u2 x)
a61af66fc99e Initial load
duke
parents:
diff changeset
104 .inline _raw_swap_u2,1
a61af66fc99e Initial load
duke
parents:
diff changeset
105 movw %di, %ax
a61af66fc99e Initial load
duke
parents:
diff changeset
106 rorw $8, %ax
a61af66fc99e Initial load
duke
parents:
diff changeset
107 .end
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 // Support for u4 Bytes::swap_u4(u4 x)
a61af66fc99e Initial load
duke
parents:
diff changeset
110 .inline _raw_swap_u4,1
a61af66fc99e Initial load
duke
parents:
diff changeset
111 movl %edi, %eax
a61af66fc99e Initial load
duke
parents:
diff changeset
112 bswapl %eax
a61af66fc99e Initial load
duke
parents:
diff changeset
113 .end
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 // Support for u8 Bytes::swap_u8(u8 x)
a61af66fc99e Initial load
duke
parents:
diff changeset
116 .inline _raw_swap_u8,1
a61af66fc99e Initial load
duke
parents:
diff changeset
117 movq %rdi, %rax
a61af66fc99e Initial load
duke
parents:
diff changeset
118 bswapq %rax
a61af66fc99e Initial load
duke
parents:
diff changeset
119 .end
a61af66fc99e Initial load
duke
parents:
diff changeset
120
a61af66fc99e Initial load
duke
parents:
diff changeset
121 // Support for void Prefetch::read
a61af66fc99e Initial load
duke
parents:
diff changeset
122 .inline _Prefetch_read,2
a61af66fc99e Initial load
duke
parents:
diff changeset
123 prefetcht0 (%rdi, %rsi, 1)
a61af66fc99e Initial load
duke
parents:
diff changeset
124 .end
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126 // Support for void Prefetch::write
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // We use prefetcht0 because em64t doesn't support prefetchw.
a61af66fc99e Initial load
duke
parents:
diff changeset
128 // prefetchw is a 3dnow instruction.
a61af66fc99e Initial load
duke
parents:
diff changeset
129 .inline _Prefetch_write,2
a61af66fc99e Initial load
duke
parents:
diff changeset
130 prefetcht0 (%rdi, %rsi, 1)
a61af66fc99e Initial load
duke
parents:
diff changeset
131 .end