hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.s
author goetz
Thu, 20 Jun 2013 15:02:05 +0200
changeset 18740 db44b1599483
parent 5547 f4b087cbb361
child 22234 da823d78ad65
permissions -rw-r--r--
8016697: Use stubs to implement safefetch Summary: Implement Safefetch as stub routines. This reduces compiler and os dependencies. Reviewed-by: twisti, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
     2
/ Copyright (c) 2004, 2005, 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: 1
diff changeset
    19
/ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
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: 1
diff changeset
    21
/ questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
/
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
18740
db44b1599483 8016697: Use stubs to implement safefetch
goetz
parents: 5547
diff changeset
    24
        .globl fs_load
db44b1599483 8016697: Use stubs to implement safefetch
goetz
parents: 5547
diff changeset
    25
        .globl fs_thread
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
        // NOTE WELL!  The _Copy functions are called directly
18740
db44b1599483 8016697: Use stubs to implement safefetch
goetz
parents: 5547
diff changeset
    28
        // from server-compiler-generated code via CallLeafNoFP,
db44b1599483 8016697: Use stubs to implement safefetch
goetz
parents: 5547
diff changeset
    29
        // which means that they *must* either not use floating
db44b1599483 8016697: Use stubs to implement safefetch
goetz
parents: 5547
diff changeset
    30
        // point or use it in the same manner as does the server
db44b1599483 8016697: Use stubs to implement safefetch
goetz
parents: 5547
diff changeset
    31
        // compiler.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
        .globl _Copy_arrayof_conjoint_bytes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
        .globl _Copy_conjoint_jshorts_atomic
18740
db44b1599483 8016697: Use stubs to implement safefetch
goetz
parents: 5547
diff changeset
    35
        .globl _Copy_arrayof_conjoint_jshorts
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
        .globl _Copy_conjoint_jints_atomic
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
        .globl _Copy_arrayof_conjoint_jints
18740
db44b1599483 8016697: Use stubs to implement safefetch
goetz
parents: 5547
diff changeset
    38
        .globl _Copy_conjoint_jlongs_atomic
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
        .globl _Copy_arrayof_conjoint_jlongs
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
18740
db44b1599483 8016697: Use stubs to implement safefetch
goetz
parents: 5547
diff changeset
    41
        .section .text,"ax"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
        / Fast thread accessors, used by threadLS_solaris_amd64.cpp
18740
db44b1599483 8016697: Use stubs to implement safefetch
goetz
parents: 5547
diff changeset
    44
        .align   16
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
fs_load:
18740
db44b1599483 8016697: Use stubs to implement safefetch
goetz
parents: 5547
diff changeset
    46
        movq %fs:(%rdi),%rax
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
18740
db44b1599483 8016697: Use stubs to implement safefetch
goetz
parents: 5547
diff changeset
    49
        .align   16
db44b1599483 8016697: Use stubs to implement safefetch
goetz
parents: 5547
diff changeset
    50
fs_thread:
db44b1599483 8016697: Use stubs to implement safefetch
goetz
parents: 5547
diff changeset
    51
        movq %fs:0x0,%rax
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
        .globl  SpinPause
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
        .align  16
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
SpinPause:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
        rep
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
        nop
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
        movq    $1, %rax
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
        ret
18740
db44b1599483 8016697: Use stubs to implement safefetch
goetz
parents: 5547
diff changeset
    61
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
        / Support for void Copy::arrayof_conjoint_bytes(void* from,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
        /                                               void* to,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
        /                                               size_t count)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
        / rdi - from
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
        / rsi - to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
        / rdx - count, treated as ssize_t
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
        /
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
        .align   16
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
_Copy_arrayof_conjoint_bytes:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
        movq     %rdx,%r8             / byte count
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
        shrq     $3,%rdx              / qword count
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
        cmpq     %rdi,%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
        leaq     -1(%rdi,%r8,1),%rax  / from + bcount*1 - 1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
        jbe      acb_CopyRight
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
        cmpq     %rax,%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
        jbe      acb_CopyLeft 
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
acb_CopyRight:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
        leaq     -8(%rdi,%rdx,8),%rax / from + qcount*8 - 8
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
        leaq     -8(%rsi,%rdx,8),%rcx / to + qcount*8 - 8
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
        negq     %rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
        jmp      7f
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
        .align   16
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
1:      movq     8(%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
        movq     %rsi,8(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
        addq     $1,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
        jnz      1b
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
2:      testq    $4,%r8               / check for trailing dword
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
        jz       3f
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
        movl     8(%rax),%esi         / copy trailing dword
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
        movl     %esi,8(%rcx)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
        addq     $4,%rax
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
        addq     $4,%rcx              / original %rsi is trashed, so we
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
                                      /  can't use it as a base register
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
3:      testq    $2,%r8               / check for trailing word
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
        jz       4f
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
        movw     8(%rax),%si          / copy trailing word
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
        movw     %si,8(%rcx)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
        addq     $2,%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
4:      testq    $1,%r8               / check for trailing byte
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
        jz       5f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
        movb     -1(%rdi,%r8,1),%al   / copy trailing byte
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
        movb     %al,8(%rcx)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
5:      ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
        .align   16
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
6:      movq     -24(%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
        movq     %rsi,-24(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
        movq     -16(%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
        movq     %rsi,-16(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
        movq     -8(%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
        movq     %rsi,-8(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
        movq     (%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
        movq     %rsi,(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
7:      addq     $4,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
        jle      6b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
        subq     $4,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
        jl       1b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
        jmp      2b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
acb_CopyLeft:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
        testq    $1,%r8               / check for trailing byte
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
        jz       1f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
        movb     -1(%rdi,%r8,1),%cl   / copy trailing byte
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
        movb     %cl,-1(%rsi,%r8,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
        subq     $1,%r8               / adjust for possible trailing word
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
1:      testq    $2,%r8               / check for trailing word
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
        jz       2f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
        movw     -2(%rdi,%r8,1),%cx   / copy trailing word
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
        movw     %cx,-2(%rsi,%r8,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
2:      testq    $4,%r8               / check for trailing dword
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
        jz       5f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
        movl     (%rdi,%rdx,8),%ecx   / copy trailing dword
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
        movl     %ecx,(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
        jmp      5f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
        .align   16
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
3:      movq     -8(%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
        movq     %rcx,-8(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
        subq     $1,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
        jnz      3b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
        .align   16
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
4:      movq     24(%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
        movq     %rcx,24(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
        movq     16(%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
        movq     %rcx,16(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
        movq     8(%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
        movq     %rcx,8(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
        movq     (%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
        movq     %rcx,(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
5:      subq     $4,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
        jge      4b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
        addq     $4,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
        jg       3b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
        / Support for void Copy::arrayof_conjoint_jshorts(void* from,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
        /                                                 void* to,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
        /                                                 size_t count)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
        / Equivalent to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
        /   conjoint_jshorts_atomic
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
        /
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
        / If 'from' and/or 'to' are aligned on 4- or 2-byte boundaries, we
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
        / let the hardware handle it.  The tow or four words within dwords
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
        / or qwords that span cache line boundaries will still be loaded
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
        / and stored atomically.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
        /
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
        / rdi - from
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
        / rsi - to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
        / rdx - count, treated as ssize_t
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
        /
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
        .align   16
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
_Copy_arrayof_conjoint_jshorts:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
_Copy_conjoint_jshorts_atomic:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
        movq     %rdx,%r8             / word count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
        shrq     $2,%rdx              / qword count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
        cmpq     %rdi,%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
        leaq     -2(%rdi,%r8,2),%rax  / from + wcount*2 - 2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
        jbe      acs_CopyRight
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
        cmpq     %rax,%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
        jbe      acs_CopyLeft 
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
acs_CopyRight:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
        leaq     -8(%rdi,%rdx,8),%rax / from + qcount*8 - 8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
        leaq     -8(%rsi,%rdx,8),%rcx / to + qcount*8 - 8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
        negq     %rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
        jmp      6f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
1:      movq     8(%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
        movq     %rsi,8(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
        addq     $1,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
        jnz      1b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
2:      testq    $2,%r8               / check for trailing dword
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
        jz       3f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
        movl     8(%rax),%esi         / copy trailing dword
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
        movl     %esi,8(%rcx)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
        addq     $4,%rcx              / original %rsi is trashed, so we
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
                                      /  can't use it as a base register
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
3:      testq    $1,%r8               / check for trailing word
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
        jz       4f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
        movw     -2(%rdi,%r8,2),%si   / copy trailing word
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
        movw     %si,8(%rcx)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
4:      ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
        .align   16
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
5:      movq     -24(%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
        movq     %rsi,-24(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
        movq     -16(%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
        movq     %rsi,-16(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
        movq     -8(%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
        movq     %rsi,-8(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
        movq     (%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
        movq     %rsi,(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
6:      addq     $4,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
        jle      5b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
        subq     $4,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
        jl       1b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
        jmp      2b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
acs_CopyLeft:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
        testq    $1,%r8               / check for trailing word
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
        jz       1f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
        movw     -2(%rdi,%r8,2),%cx   / copy trailing word
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
        movw     %cx,-2(%rsi,%r8,2)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
1:      testq    $2,%r8               / check for trailing dword
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
        jz       4f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
        movl     (%rdi,%rdx,8),%ecx   / copy trailing dword
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
        movl     %ecx,(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
        jmp      4f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
2:      movq     -8(%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
        movq     %rcx,-8(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
        subq     $1,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
        jnz      2b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
        .align   16
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
3:      movq     24(%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
        movq     %rcx,24(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
        movq     16(%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
        movq     %rcx,16(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
        movq     8(%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
        movq     %rcx,8(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
        movq     (%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
        movq     %rcx,(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
4:      subq     $4,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
        jge      3b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
        addq     $4,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
        jg       2b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
        / Support for void Copy::arrayof_conjoint_jints(jint* from,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
        /                                               jint* to,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
        /                                               size_t count)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
        / Equivalent to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
        /   conjoint_jints_atomic
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
        /
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
        / If 'from' and/or 'to' are aligned on 4-byte boundaries, we let
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
        / the hardware handle it.  The two dwords within qwords that span
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
        / cache line boundaries will still be loaded and stored atomically.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
        /
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
        / rdi - from
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
        / rsi - to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
        / rdx - count, treated as ssize_t
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
        /
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
        .align   16
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
_Copy_arrayof_conjoint_jints:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
_Copy_conjoint_jints_atomic:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
        movq     %rdx,%r8             / dword count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
        shrq     %rdx                 / qword count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
        cmpq     %rdi,%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
        leaq     -4(%rdi,%r8,4),%rax  / from + dcount*4 - 4
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
        jbe      aci_CopyRight
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
        cmpq     %rax,%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
        jbe      aci_CopyLeft 
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
aci_CopyRight:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
        leaq     -8(%rdi,%rdx,8),%rax / from + qcount*8 - 8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
        leaq     -8(%rsi,%rdx,8),%rcx / to + qcount*8 - 8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
        negq     %rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
        jmp      5f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
        .align   16
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
1:      movq     8(%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
        movq     %rsi,8(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
        addq     $1,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
        jnz       1b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
2:      testq    $1,%r8               / check for trailing dword
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
        jz       3f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
        movl     8(%rax),%esi         / copy trailing dword
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
        movl     %esi,8(%rcx)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
3:      ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
        .align   16
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
4:      movq     -24(%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
        movq     %rsi,-24(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
        movq     -16(%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
        movq     %rsi,-16(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
        movq     -8(%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
        movq     %rsi,-8(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
        movq     (%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
        movq     %rsi,(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
5:      addq     $4,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
        jle      4b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
        subq     $4,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
        jl       1b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
        jmp      2b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
aci_CopyLeft:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
        testq    $1,%r8               / check for trailing dword
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
        jz       3f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
        movl     -4(%rdi,%r8,4),%ecx  / copy trailing dword
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
        movl     %ecx,-4(%rsi,%r8,4)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
        jmp      3f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
1:      movq     -8(%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
        movq     %rcx,-8(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
        subq     $1,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
        jnz      1b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
        .align   16
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
2:      movq     24(%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
        movq     %rcx,24(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
        movq     16(%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
        movq     %rcx,16(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
        movq     8(%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
        movq     %rcx,8(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
        movq     (%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
        movq     %rcx,(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
3:      subq     $4,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
        jge      2b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
        addq     $4,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
        jg       1b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
        ret
18740
db44b1599483 8016697: Use stubs to implement safefetch
goetz
parents: 5547
diff changeset
   323
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
        / Support for void Copy::arrayof_conjoint_jlongs(jlong* from,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
        /                                                jlong* to,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
        /                                                size_t count)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
        / Equivalent to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
        /   conjoint_jlongs_atomic
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
        /   arrayof_conjoint_oops
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
        /   conjoint_oops_atomic
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
        /
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
        / rdi - from
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
        / rsi - to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
        / rdx - count, treated as ssize_t
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
        /
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
        .align   16
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
_Copy_arrayof_conjoint_jlongs:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
_Copy_conjoint_jlongs_atomic:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
        cmpq     %rdi,%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
        leaq     -8(%rdi,%rdx,8),%rax / from + count*8 - 8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
        jbe      acl_CopyRight
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
        cmpq     %rax,%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
        jbe      acl_CopyLeft 
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
acl_CopyRight:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
        leaq     -8(%rsi,%rdx,8),%rcx / to + count*8 - 8
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
        negq     %rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
        jmp      3f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
1:      movq     8(%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
        movq     %rsi,8(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
        addq     $1,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
        jnz      1b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
        .align   16
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
2:      movq     -24(%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
        movq     %rsi,-24(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
        movq     -16(%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
        movq     %rsi,-16(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
        movq     -8(%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
        movq     %rsi,-8(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
        movq     (%rax,%rdx,8),%rsi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
        movq     %rsi,(%rcx,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
3:      addq     $4,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
        jle      2b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
        subq     $4,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
        jl       1b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
4:      movq     -8(%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
        movq     %rcx,-8(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
        subq     $1,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
        jnz      4b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
        .align   16
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
5:      movq     24(%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
        movq     %rcx,24(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
        movq     16(%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
        movq     %rcx,16(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
        movq     8(%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
        movq     %rcx,8(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
        movq     (%rdi,%rdx,8),%rcx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
        movq     %rcx,(%rsi,%rdx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
acl_CopyLeft:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
        subq     $4,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
        jge      5b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
        addq     $4,%rdx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
        jg       4b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
        ret