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