hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 1 489c9b5090e2
child 1659 b9a3819ac7c6
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
// Copyright 2004-2007 Sun Microsystems, Inc.  All Rights Reserved.
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
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
// CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
// have any questions.
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
  // 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
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
      movq     %fs:0, %rax 
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
  // Get the frame pointer from previous frame.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
      .inline _get_previous_fp,0
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
      movq     %rbp, %rax 
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
      movq     %rax, %rax 
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  // Support for jint Atomic::add(jint add_value, volatile jint* dest)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  // An additional bool (os::is_MP()) is passed as the last argument.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
      .inline _Atomic_add,3
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
      movl     %edi, %eax      // save add_value for return
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
      testl    %edx, %edx      // MP test
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
      je       1f
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
      lock
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
1:    xaddl    %edi, (%rsi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
      addl     %edi, %eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  // Support for jlong Atomic::add(jlong add_value, volatile jlong* dest)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  // An additional bool (os::is_MP()) is passed as the last argument.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
      .inline _Atomic_add_long,3
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
      movq     %rdi, %rax      // save add_value for return
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
      testq    %rdx, %rdx      // MP test
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
      je       1f
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
      lock
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
1:    xaddq    %rdi, (%rsi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
      addq     %rdi, %rax
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
      xchgl    (%rsi), %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
      movl     %edi, %eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  // Support for jlong Atomic::xchg(jlong exchange_value, volatile jlong* dest).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
      .inline _Atomic_xchg_long,2
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
      xchgq    (%rsi), %rdi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
      movq     %rdi, %rax
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  // Support for jint Atomic::cmpxchg(jint exchange_value, 
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  //                                  volatile jint *dest, 
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  //                                  jint compare_value)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  // An additional bool (os::is_MP()) is passed as the last argument.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
      .inline _Atomic_cmpxchg,4
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
      movl     %edx, %eax      // compare_value
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
      testl    %ecx, %ecx      // MP test
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
      je       1f
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
      lock
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
1:    cmpxchgl %edi, (%rsi)
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
      movq     %rdx, %rax      // compare_value
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
      testq    %rcx, %rcx      // MP test
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
      je       1f
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
      lock
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
1:    cmpxchgq %rdi, (%rsi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  // Support for OrderAccess::acquire()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
      .inline _OrderAccess_acquire,0
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
      movl     0(%rsp), %eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  // Support for OrderAccess::fence()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
      .inline _OrderAccess_fence,0
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
      lock
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
      addl     $0, (%rsp)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  // Support for u2 Bytes::swap_u2(u2 x)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
      .inline _raw_swap_u2,1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
      movw     %di, %ax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
      rorw     $8, %ax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  // Support for u4 Bytes::swap_u4(u4 x)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
      .inline _raw_swap_u4,1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
      movl     %edi, %eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
      bswapl   %eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  // Support for u8 Bytes::swap_u8(u8 x)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
      .inline _raw_swap_u8,1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
      movq     %rdi, %rax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
      bswapq   %rax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  // Support for void Prefetch::read
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
      .inline _Prefetch_read,2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
      prefetcht0 (%rdi, %rsi, 1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
      .end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  // Support for void Prefetch::write
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  // We use prefetcht0 because em64t doesn't support prefetchw.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  // prefetchw is a 3dnow instruction.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
      .inline _Prefetch_write,2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
      prefetcht0 (%rdi, %rsi, 1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
      .end