src/hotspot/os_cpu/solaris_x86/solaris_x86_64.il
author stefank
Mon, 25 Nov 2019 12:33:15 +0100
changeset 59252 623722a6aeb9
parent 59251 4cbfa5077d68
permissions -rw-r--r--
8234740: Harmonize parameter order in Atomic - cmpxchg Reviewed-by: rehn, dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
//
29456
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 27691
diff changeset
     2
// Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
// This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
// under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
// published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
// This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
// version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
// accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
// You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
// 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
//
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5542
diff changeset
    19
// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5542
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: 5542
diff changeset
    21
// questions.
29456
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 27691
diff changeset
    22
//
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
  // The argument size of each inline directive is ignored by the compiler
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
  // and is set to the number of arguments as documentation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
  // Get the raw thread ID from %gs:0
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
      .inline _raw_thread_id,0
29456
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 27691
diff changeset
    30
      movq     %fs:0, %rax
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
11961
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 11417
diff changeset
    33
  // Get current sp
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 11417
diff changeset
    34
      .inline _get_current_sp,0
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 11417
diff changeset
    35
      .volatile
29456
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 27691
diff changeset
    36
      movq     %rsp, %rax
11961
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 11417
diff changeset
    37
      .end
0abd4cd26e5a 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
roland
parents: 11417
diff changeset
    38
11417
4ecc3253bec4 7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents: 7662
diff changeset
    39
  // Get current fp
1659
b9a3819ac7c6 6773838: There is no calling stack for Compiler thread in hs_err file on x86
coleenp
parents: 1
diff changeset
    40
      .inline _get_current_fp,0
b9a3819ac7c6 6773838: There is no calling stack for Compiler thread in hs_err file on x86
coleenp
parents: 1
diff changeset
    41
      .volatile
29456
cc1c5203e60d 7143664: Clean up OrderAccess implementations and usage
dholmes
parents: 27691
diff changeset
    42
      movq     %rbp, %rax
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
11417
4ecc3253bec4 7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents: 7662
diff changeset
    45
  // Support for os::rdtsc()
4ecc3253bec4 7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents: 7662
diff changeset
    46
      .inline _raw_rdtsc,0
4ecc3253bec4 7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents: 7662
diff changeset
    47
      rdtsc
4ecc3253bec4 7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents: 7662
diff changeset
    48
      salq     $32, %rdx
4ecc3253bec4 7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents: 7662
diff changeset
    49
      orq      %rdx, %rax
4ecc3253bec4 7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents: 7662
diff changeset
    50
      .end
4ecc3253bec4 7125934: Add a fast unordered timestamp capability to Hotspot on x86/x64
phh
parents: 7662
diff changeset
    51
59249
29b0d0b61615 8234737: Harmonize parameter order in Atomic - add
stefank
parents: 47216
diff changeset
    52
  // Implementation of jint _Atomic_add(jint add_value, volatile jint* dest)
29b0d0b61615 8234737: Harmonize parameter order in Atomic - add
stefank
parents: 47216
diff changeset
    53
  // used by Atomic::add(volatile jint* dest, jint add_value)
5542
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 2105
diff changeset
    54
      .inline _Atomic_add,2
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
      movl     %edi, %eax      // save add_value for return
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
      lock
5542
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 2105
diff changeset
    57
      xaddl    %edi, (%rsi)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
      addl     %edi, %eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
59249
29b0d0b61615 8234737: Harmonize parameter order in Atomic - add
stefank
parents: 47216
diff changeset
    61
  // Implementation of jlong _Atomic_add(jlong add_value, volatile jlong* dest)
29b0d0b61615 8234737: Harmonize parameter order in Atomic - add
stefank
parents: 47216
diff changeset
    62
  // used by Atomic::add(volatile jlong* dest, jint add_value)
5542
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 2105
diff changeset
    63
      .inline _Atomic_add_long,2
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
      movq     %rdi, %rax      // save add_value for return
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
      lock
5542
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 2105
diff changeset
    66
      xaddq    %rdi, (%rsi)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
      addq     %rdi, %rax
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
59251
4cbfa5077d68 8234739: Harmonize parameter order in Atomic - xchg
stefank
parents: 59249
diff changeset
    70
  // Implementation of jint _Atomic_xchg(jint exchange_value, volatile jint* dest)
4cbfa5077d68 8234739: Harmonize parameter order in Atomic - xchg
stefank
parents: 59249
diff changeset
    71
  // used by Atomic::xchg(volatile jint* dest, jint exchange_value)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
      .inline _Atomic_xchg,2
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
      xchgl    (%rsi), %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
      movl     %edi, %eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
59251
4cbfa5077d68 8234739: Harmonize parameter order in Atomic - xchg
stefank
parents: 59249
diff changeset
    77
  // Implementation of jlong _Atomic_xchg(jlong exchange_value, volatile jlong* dest)
4cbfa5077d68 8234739: Harmonize parameter order in Atomic - xchg
stefank
parents: 59249
diff changeset
    78
  // used by Atomic::xchg(volatile jlong* dest, jlong exchange_value)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
      .inline _Atomic_xchg_long,2
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
      xchgq    (%rsi), %rdi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
      movq     %rdi, %rax
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
59252
623722a6aeb9 8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents: 59251
diff changeset
    84
  // Support for jbyte Atomic::cmpxchg(volatile jbyte *dest,
623722a6aeb9 8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents: 59251
diff changeset
    85
  //                                   jbyte compare_value,
623722a6aeb9 8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents: 59251
diff changeset
    86
  //                                   jbyte exchange_value)
27691
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 13963
diff changeset
    87
      .inline _Atomic_cmpxchg_byte,3
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 13963
diff changeset
    88
      movb     %dl, %al      // compare_value
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 13963
diff changeset
    89
      lock
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 13963
diff changeset
    90
      cmpxchgb %dil, (%rsi)
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 13963
diff changeset
    91
      .end
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 13963
diff changeset
    92
59252
623722a6aeb9 8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents: 59251
diff changeset
    93
  // Support for jint Atomic::cmpxchg(volatile jint *dest,
623722a6aeb9 8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents: 59251
diff changeset
    94
  //                                  int compare_value,
623722a6aeb9 8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents: 59251
diff changeset
    95
  //                                  jint exchange_value)
5542
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 2105
diff changeset
    96
      .inline _Atomic_cmpxchg,3
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
      movl     %edx, %eax      // compare_value
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
      lock
5542
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 2105
diff changeset
    99
      cmpxchgl %edi, (%rsi)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
59252
623722a6aeb9 8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents: 59251
diff changeset
   102
  // Support for jlong Atomic::cmpxchg(volatile jlong* dest,
623722a6aeb9 8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents: 59251
diff changeset
   103
  //                                   jlong compare_value,
623722a6aeb9 8234740: Harmonize parameter order in Atomic - cmpxchg
stefank
parents: 59251
diff changeset
   104
  //                                   jlong exchange_value)
5542
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 2105
diff changeset
   105
      .inline _Atomic_cmpxchg_long,3
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
      movq     %rdx, %rax      // compare_value
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
      lock
5542
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 2105
diff changeset
   108
      cmpxchgq %rdi, (%rsi)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  // Support for u2 Bytes::swap_u2(u2 x)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
      .inline _raw_swap_u2,1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
      movw     %di, %ax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
      rorw     $8, %ax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  // Support for u4 Bytes::swap_u4(u4 x)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
      .inline _raw_swap_u4,1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
      movl     %edi, %eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
      bswapl   %eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  // Support for u8 Bytes::swap_u8(u8 x)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
      .inline _raw_swap_u8,1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
      movq     %rdi, %rax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
      bswapq   %rax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  // Support for void Prefetch::read
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
      .inline _Prefetch_read,2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
      prefetcht0 (%rdi, %rsi, 1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  // Support for void Prefetch::write
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  // We use prefetcht0 because em64t doesn't support prefetchw.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  // prefetchw is a 3dnow instruction.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
      .inline _Prefetch_write,2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
      prefetcht0 (%rdi, %rsi, 1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
      .end