hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il
author kvn
Fri, 07 Jan 2011 10:16:57 -0800
changeset 7885 c02b05ba16a1
parent 5547 f4b087cbb361
child 7891 2c38f387381e
permissions -rw-r--r--
7009756: volatile variables could be broken throw reflection API Summary: Use Atomic::load() and Atomic::store() to access a volatile long. Reviewed-by: iveresov, jrose, dholmes, never
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
//
7885
c02b05ba16a1 7009756: volatile variables could be broken throw reflection API
kvn
parents: 5547
diff changeset
     2
// Copyright (c) 2003, 2011, 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.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
//  
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
  // Support for u8 os::setup_fpu()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
      .inline _solaris_raw_setup_fpu,1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
      movl     0(%esp), %eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
      fldcw    (%eax)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
  // The argument size of each inline directive is ignored by the compiler
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
  // and is set to 0 for compatibility reason.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  // Get the raw thread ID from %gs:0
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
      .inline _raw_thread_id,0
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
      movl     %gs:0, %eax 
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
1659
b9a3819ac7c6 6773838: There is no calling stack for Compiler thread in hs_err file on x86
coleenp
parents: 1
diff changeset
    40
  // Get current fp
b9a3819ac7c6 6773838: There is no calling stack for Compiler thread in hs_err file on x86
coleenp
parents: 1
diff changeset
    41
      .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
    42
      .volatile
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
      movl     %ebp, %eax 
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  // Support for jint Atomic::add(jint inc, volatile jint* dest)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  // An additional bool (os::is_MP()) is passed as the last argument.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
      .inline _Atomic_add,3
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
      movl     0(%esp), %eax   // inc
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
      movl     4(%esp), %edx   // dest
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
      movl     %eax, %ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
      cmpl     $0, 8(%esp)     // MP test
5542
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
    53
      jne      1f
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
    54
      xaddl    %eax, (%edx)
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
    55
      jmp      2f
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
    56
1:    lock
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
    57
      xaddl    %eax, (%edx)
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
    58
2:    addl     %ecx, %eax
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  // Support for jint Atomic::xchg(jint exchange_value, volatile jint* dest).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
      .inline _Atomic_xchg,2
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
      movl     0(%esp), %eax   // exchange_value
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
      movl     4(%esp), %ecx   // dest
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
      xchgl    (%ecx), %eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  // Support for jint Atomic::cmpxchg(jint exchange_value, 
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  //                                  volatile jint *dest, 
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  //                                  jint compare_value)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  // An additional bool (os::is_MP()) is passed as the last argument.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
      .inline _Atomic_cmpxchg,4
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
      movl     8(%esp), %eax   // compare_value
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
      movl     0(%esp), %ecx   // exchange_value
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
      movl     4(%esp), %edx   // dest
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
      cmp      $0, 12(%esp)    // MP test
5542
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
    77
      jne      1f
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
    78
      cmpxchgl %ecx, (%edx)
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
    79
      jmp      2f
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
    80
1:    lock
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
    81
      cmpxchgl %ecx, (%edx)
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
    82
2:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  // Support for jlong Atomic::cmpxchg(jlong exchange_value,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  //                                   volatile jlong* dest,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  //                                   jlong compare_value)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  // An additional bool (os::is_MP()) is passed as the last argument.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
      .inline _Atomic_cmpxchg_long,6
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
      pushl    %ebx
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
      pushl    %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
      movl     20(%esp), %eax  // compare_value (low)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
      movl     24(%esp), %edx  // compare_value (high)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
      movl     16(%esp), %edi  // dest
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
      movl     8(%esp), %ebx   // exchange_value (low)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
      movl     12(%esp), %ecx  // exchange_high (high)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
      cmp      $0, 28(%esp)    // MP test
5542
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
    98
      jne      1f
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
    99
      cmpxchg8b (%edi)
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
   100
      jmp      2f
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
   101
1:    lock
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
   102
      cmpxchg8b (%edi)
be05c5ffe905 6951319: enable solaris builds using Sun Studio 12 update 1
jcoomes
parents: 3594
diff changeset
   103
2:    popl     %edi
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
      popl     %ebx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
7885
c02b05ba16a1 7009756: volatile variables could be broken throw reflection API
kvn
parents: 5547
diff changeset
   107
  // Support for jlong Atomic::load and Atomic::store.
c02b05ba16a1 7009756: volatile variables could be broken throw reflection API
kvn
parents: 5547
diff changeset
   108
  // void _Atomic_move_long(volatile jlong* src, volatile jlong* dst)
c02b05ba16a1 7009756: volatile variables could be broken throw reflection API
kvn
parents: 5547
diff changeset
   109
      .inline _Atomic_move_long,2
3594
0ce9158bc84c 6863420: os::javaTimeNanos() go backward on Solaris x86
kvn
parents: 2105
diff changeset
   110
      movl     0(%esp), %eax   // src
0ce9158bc84c 6863420: os::javaTimeNanos() go backward on Solaris x86
kvn
parents: 2105
diff changeset
   111
      fildll    (%eax)
0ce9158bc84c 6863420: os::javaTimeNanos() go backward on Solaris x86
kvn
parents: 2105
diff changeset
   112
      movl     4(%esp), %eax   // dest
0ce9158bc84c 6863420: os::javaTimeNanos() go backward on Solaris x86
kvn
parents: 2105
diff changeset
   113
      fistpll   (%eax)
0ce9158bc84c 6863420: os::javaTimeNanos() go backward on Solaris x86
kvn
parents: 2105
diff changeset
   114
      .end
0ce9158bc84c 6863420: os::javaTimeNanos() go backward on Solaris x86
kvn
parents: 2105
diff changeset
   115
0ce9158bc84c 6863420: os::javaTimeNanos() go backward on Solaris x86
kvn
parents: 2105
diff changeset
   116
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  // Support for OrderAccess::acquire()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
      .inline _OrderAccess_acquire,0
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
      movl     0(%esp), %eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  // Support for OrderAccess::fence()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
      .inline _OrderAccess_fence,0
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
      lock
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
      addl     $0, (%esp)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  // Support for u2 Bytes::swap_u2(u2 x)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
      .inline _raw_swap_u2,1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
      movl     0(%esp), %eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
      xchgb    %al, %ah
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 u4 Bytes::swap_u4(u4 x)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
      .inline _raw_swap_u4,1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
      movl     0(%esp), %eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
      bswap    %eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  // Support for u8 Bytes::swap_u8_base(u4 x, u4 y)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
      .inline _raw_swap_u8,2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
      movl     4(%esp), %eax   // y
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
      movl     0(%esp), %edx   // x
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
      bswap    %eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
      bswap    %edx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
      .end