hotspot/src/os_cpu/linux_x86/vm/linux_x86_32.s
author dholmes
Tue, 03 Mar 2015 19:20:26 -0500
changeset 29456 cc1c5203e60d
parent 22234 da823d78ad65
child 46414 5d1d862dc8d8
permissions -rw-r--r--
7143664: Clean up OrderAccess implementations and usage Summary: Clarify and correct the abstract model for memory barriers provided by the orderAccess class. Refactor the implementations using template specialization to allow the bulk of the code to be shared, with platform specific customizations applied as needed. Reviewed-by: acorn, dcubed, dholmes, dlong, goetz, kbarrett, sgehwolf Contributed-by: Erik Osterlund <erik.osterlund@lnu.se>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
# 
22234
da823d78ad65 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 18740
diff changeset
     2
# Copyright (c) 2004, 2013, 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
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_conjoint_bytes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
        .globl _Copy_arrayof_conjoint_bytes
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_jshorts
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_jints
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
	.globl _Copy_conjoint_jlongs_atomic
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
	.globl _mmx_Copy_arrayof_conjoint_jshorts
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
        .globl _Atomic_cmpxchg_long
7885
c02b05ba16a1 7009756: volatile variables could be broken throw reflection API
kvn
parents: 5883
diff changeset
    41
        .globl _Atomic_move_long
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
	.text
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
        .globl  SpinPause
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
	.type   SpinPause,@function
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
SpinPause:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
        rep
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
        nop
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
        movl    $1, %eax
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
        # Support for void Copy::conjoint_bytes(void* from,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
        #                                       void* to,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
        #                                       size_t count)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
	.type    _Copy_conjoint_bytes,@function
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
_Copy_conjoint_bytes:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
        pushl    %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
        movl     4+12(%esp),%ecx      # count
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
        pushl    %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
        movl     8+ 4(%esp),%esi      # from
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
        movl     8+ 8(%esp),%edi      # to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
        cmpl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
        leal     -1(%esi,%ecx),%eax   # from + count - 1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
        jbe      cb_CopyRight
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
        cmpl     %eax,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
        jbe      cb_CopyLeft
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
        # copy from low to high
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
cb_CopyRight:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
        cmpl     $3,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
        jbe      5f                   # <= 3 bytes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
        # align source address at dword address boundary
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
        movl     %ecx,%eax            # original count
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
        movl     $4,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
        subl     %esi,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
        andl     $3,%ecx              # prefix byte count
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
        jz       1f                   # no prefix
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
        subl     %ecx,%eax            # byte count less prefix
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
        # copy prefix
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
        subl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
0:      movb     (%esi),%dl
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
        movb     %dl,(%edi,%esi,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
        addl     $1,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
        subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
        jnz      0b
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
        addl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
1:      movl     %eax,%ecx            # byte count less prefix
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
        shrl     $2,%ecx              # dword count
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
        jz       4f                   # no dwords to move
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
        cmpl     $32,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
        jbe      2f                   # <= 32 dwords
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
        # copy aligned dwords
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
        rep;     smovl
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
        jmp      4f
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
        # copy aligned dwords
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
2:      subl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
3:      movl     (%esi),%edx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
        movl     %edx,(%edi,%esi,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
        addl     $4,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
        subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
        jnz      3b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
        addl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
4:      movl     %eax,%ecx            # byte count less prefix
5883
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   107
5:      andl     $3,%ecx              # suffix byte count
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
        jz       7f                   # no suffix
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
        # copy suffix
5883
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   110
        xorl     %eax,%eax
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
6:      movb     (%esi,%eax,1),%dl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
        movb     %dl,(%edi,%eax,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
        addl     $1,%eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
        subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
        jnz      6b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
7:      popl     %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
        popl     %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
        # copy from high to low
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
cb_CopyLeft:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
        std
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
        leal     -4(%edi,%ecx),%edi   # to + count - 4
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
        movl     %eax,%esi            # from + count - 1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
        movl     %ecx,%eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
        subl     $3,%esi              # from + count - 4
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
        cmpl     $3,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
        jbe      5f                   # <= 3 bytes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
1:      shrl     $2,%ecx              # dword count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
        jz       4f                   # no dwords to move
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
        cmpl     $32,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
        ja       3f                   # > 32 dwords
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
        # copy dwords, aligned or not
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
        subl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
2:      movl     (%esi),%edx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
        movl     %edx,(%edi,%esi,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
        subl     $4,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
        subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
        jnz      2b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
        addl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
        jmp      4f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
        # copy dwords, aligned or not
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
3:      rep;     smovl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
4:      movl     %eax,%ecx            # byte count
5883
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   145
5:      andl     $3,%ecx              # suffix byte count
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
        jz       7f                   # no suffix
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
        # copy suffix
5883
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   148
        subl     %esi,%edi
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
        addl     $3,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
6:      movb     (%esi),%dl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
        movb     %dl,(%edi,%esi,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
	subl     $1,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
        subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
        jnz      6b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
7:      cld
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
        popl     %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
        popl     %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
        # Support for void Copy::arrayof_conjoint_bytes(void* from,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
        #                                               void* to,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
        #                                               size_t count)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
        #
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
        # Same as _Copy_conjoint_bytes, except no source alignment check.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
	.type    _Copy_arrayof_conjoint_bytes,@function
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
_Copy_arrayof_conjoint_bytes:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
        pushl    %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
        movl     4+12(%esp),%ecx      # count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
        pushl    %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
        movl     8+ 4(%esp),%esi      # from
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
        movl     8+ 8(%esp),%edi      # to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
        cmpl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
        leal     -1(%esi,%ecx),%eax   # from + count - 1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
        jbe      acb_CopyRight
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
        cmpl     %eax,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
        jbe      acb_CopyLeft 
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
        # copy from low to high
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
acb_CopyRight:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
        cmpl     $3,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
        jbe      5f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
1:      movl     %ecx,%eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
        shrl     $2,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
        jz       4f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
        cmpl     $32,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
        ja       3f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
        # copy aligned dwords
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
        subl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
2:      movl     (%esi),%edx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
        movl     %edx,(%edi,%esi,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
        addl     $4,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
        subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
        jnz      2b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
        addl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
        jmp      4f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
        # copy aligned dwords
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
3:      rep;     smovl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
4:      movl     %eax,%ecx
5883
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   200
5:      andl     $3,%ecx
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
        jz       7f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
        # copy suffix
5883
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   203
        xorl     %eax,%eax
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
6:      movb     (%esi,%eax,1),%dl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
        movb     %dl,(%edi,%eax,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
        addl     $1,%eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
        subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
        jnz      6b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
7:      popl     %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
        popl     %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
acb_CopyLeft:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
        std
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
        leal     -4(%edi,%ecx),%edi   # to + count - 4
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
        movl     %eax,%esi            # from + count - 1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
        movl     %ecx,%eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
        subl     $3,%esi              # from + count - 4
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
        cmpl     $3,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
        jbe      5f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
1:      shrl     $2,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
        jz       4f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
        cmpl     $32,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
        jbe      2f                   # <= 32 dwords
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
        rep;     smovl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
        jmp      4f
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 7891
diff changeset
   226
	.space 8
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
2:      subl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
3:      movl     (%esi),%edx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
        movl     %edx,(%edi,%esi,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
        subl     $4,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
        subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
        jnz      3b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
        addl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
4:      movl     %eax,%ecx
5883
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   236
5:      andl     $3,%ecx
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
        jz       7f
5883
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   238
        subl     %esi,%edi
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
        addl     $3,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
6:      movb     (%esi),%dl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
        movb     %dl,(%edi,%esi,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
	subl     $1,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
        subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
        jnz      6b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
7:      cld
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
        popl     %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
        popl     %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
        # Support for void Copy::conjoint_jshorts_atomic(void* from,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
        #                                                void* to,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
        #                                                size_t count)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
	.type    _Copy_conjoint_jshorts_atomic,@function
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
_Copy_conjoint_jshorts_atomic:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
        pushl    %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
        movl     4+12(%esp),%ecx      # count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
        pushl    %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
        movl     8+ 4(%esp),%esi      # from
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
        movl     8+ 8(%esp),%edi      # to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
        cmpl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
        leal     -2(%esi,%ecx,2),%eax # from + count*2 - 2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
        jbe      cs_CopyRight
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
        cmpl     %eax,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
        jbe      cs_CopyLeft 
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
        # copy from low to high
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
cs_CopyRight:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
        # align source address at dword address boundary
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
        movl     %esi,%eax            # original from
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
        andl     $3,%eax              # either 0 or 2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
        jz       1f                   # no prefix
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
        # copy prefix
5883
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   273
        subl     $1,%ecx
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   274
        jl       5f                   # zero count
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
        movw     (%esi),%dx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
        movw     %dx,(%edi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
        addl     %eax,%esi            # %eax == 2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
        addl     %eax,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
1:      movl     %ecx,%eax            # word count less prefix
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
        sarl     %ecx                 # dword count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
        jz       4f                   # no dwords to move
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
        cmpl     $32,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
        jbe      2f                   # <= 32 dwords
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
        # copy aligned dwords
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
        rep;     smovl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
        jmp      4f 
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
        # copy aligned dwords
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
2:      subl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
3:      movl     (%esi),%edx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
        movl     %edx,(%edi,%esi,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
        addl     $4,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
        subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
        jnz      3b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
        addl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
4:      andl     $1,%eax              # suffix count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
        jz       5f                   # no suffix
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
        # copy suffix
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
        movw     (%esi),%dx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
        movw     %dx,(%edi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
5:      popl     %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
        popl     %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
        # copy from high to low
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
cs_CopyLeft:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
        std
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
        leal     -4(%edi,%ecx,2),%edi # to + count*2 - 4
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
        movl     %eax,%esi            # from + count*2 - 2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
        movl     %ecx,%eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
        subl     $2,%esi              # from + count*2 - 4
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
1:      sarl     %ecx                 # dword count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
        jz       4f                   # no dwords to move
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
        cmpl     $32,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
        ja       3f                   # > 32 dwords
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
        subl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
2:      movl     (%esi),%edx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
        movl     %edx,(%edi,%esi,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
        subl     $4,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
        subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
        jnz      2b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
        addl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
        jmp      4f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
3:      rep;     smovl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
4:      andl     $1,%eax              # suffix count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
        jz       5f                   # no suffix
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
        # copy suffix
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
        addl     $2,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
        addl     $2,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
        movw     (%esi),%dx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
        movw     %dx,(%edi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
5:      cld
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
        popl     %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
        popl     %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
        # Support for void Copy::arrayof_conjoint_jshorts(void* from,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
        #                                                 void* to,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
        #                                                 size_t count)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
	.type    _Copy_arrayof_conjoint_jshorts,@function
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
_Copy_arrayof_conjoint_jshorts:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
        pushl    %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
        movl     4+12(%esp),%ecx      # count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
        pushl    %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
        movl     8+ 4(%esp),%esi      # from
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
        movl     8+ 8(%esp),%edi      # to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
        cmpl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
        leal     -2(%esi,%ecx,2),%eax # from + count*2 - 2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
        jbe      acs_CopyRight
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
        cmpl     %eax,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
        jbe      acs_CopyLeft 
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
acs_CopyRight:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
        movl     %ecx,%eax            # word count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
        sarl     %ecx                 # dword count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
        jz       4f                   # no dwords to move
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
        cmpl     $32,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
        jbe      2f                   # <= 32 dwords
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
        # copy aligned dwords
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
        rep;     smovl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
        jmp      4f 
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
        # copy aligned dwords
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 7891
diff changeset
   363
        .space 5
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
2:      subl     %esi,%edi 
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
3:      movl     (%esi),%edx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
        movl     %edx,(%edi,%esi,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
        addl     $4,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
        subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
        jnz      3b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
        addl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
4:      andl     $1,%eax              # suffix count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
        jz       5f                   # no suffix
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
        # copy suffix
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
        movw     (%esi),%dx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
        movw     %dx,(%edi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
5:      popl     %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
        popl     %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
acs_CopyLeft:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
        std
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
        leal     -4(%edi,%ecx,2),%edi # to + count*2 - 4
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
        movl     %eax,%esi            # from + count*2 - 2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
        movl     %ecx,%eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
        subl     $2,%esi              # from + count*2 - 4
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
        sarl     %ecx                 # dword count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
        jz       4f                   # no dwords to move
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
        cmpl     $32,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
        ja       3f                   # > 32 dwords
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
        subl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
2:      movl     (%esi),%edx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
        movl     %edx,(%edi,%esi,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
        subl     $4,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
        subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
        jnz      2b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
        addl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
        jmp      4f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
3:      rep;     smovl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
4:      andl     $1,%eax              # suffix count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
        jz       5f                   # no suffix
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
        # copy suffix
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
        addl     $2,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
        addl     $2,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
        movw     (%esi),%dx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
        movw     %dx,(%edi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
5:      cld
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
        popl     %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
        popl     %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
        # Support for void Copy::conjoint_jints_atomic(void* from,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
        #                                              void* to,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
        #                                              size_t count)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
        # Equivalent to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
        #   arrayof_conjoint_jints
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
	.type    _Copy_conjoint_jints_atomic,@function
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
	.type    _Copy_arrayof_conjoint_jints,@function
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
_Copy_conjoint_jints_atomic:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
_Copy_arrayof_conjoint_jints:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
        pushl    %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
        movl     4+12(%esp),%ecx      # count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
        pushl    %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
        movl     8+ 4(%esp),%esi      # from
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
        movl     8+ 8(%esp),%edi      # to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
        cmpl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
        leal     -4(%esi,%ecx,4),%eax # from + count*4 - 4
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
        jbe      ci_CopyRight
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
        cmpl     %eax,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
        jbe      ci_CopyLeft 
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
ci_CopyRight:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
        cmpl     $32,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
        jbe      2f                   # <= 32 dwords
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
        rep;     smovl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
        popl     %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
        popl     %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
        ret
17880
17f3d10c297f 8015252: Enable HotSpot build with Clang
simonis
parents: 7891
diff changeset
   439
        .space 10
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
2:      subl     %esi,%edi
5883
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   441
        jmp      4f
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
3:      movl     (%esi),%edx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
        movl     %edx,(%edi,%esi,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
        addl     $4,%esi
5883
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   446
4:      subl     $1,%ecx
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   447
        jge      3b
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
        popl     %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
        popl     %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
ci_CopyLeft:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
        std
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
        leal     -4(%edi,%ecx,4),%edi # to + count*4 - 4
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
        cmpl     $32,%ecx
5883
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   455
        ja       4f                   # > 32 dwords
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
        subl     %eax,%edi            # eax == from + count*4 - 4
5883
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   457
        jmp      3f
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
2:      movl     (%eax),%edx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
        movl     %edx,(%edi,%eax,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
        subl     $4,%eax
5883
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   462
3:      subl     $1,%ecx
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   463
        jge      2b
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
        cld
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
        popl     %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
        popl     %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
        ret
5883
8dc4bdc132d5 6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents: 5547
diff changeset
   468
4:      movl     %eax,%esi            # from + count*4 - 4
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
        rep;     smovl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
        cld
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
        popl     %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
        popl     %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
	
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
        # Support for void Copy::conjoint_jlongs_atomic(jlong* from,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
        #                                               jlong* to,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
        #                                               size_t count)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
        #
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
        # 32-bit
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
        #
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
        # count treated as signed
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
        #
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
        # if (from > to) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
        #   while (--count >= 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
        #     *to++ = *from++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
        #   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
        # } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
        #   while (--count >= 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
        #     to[count] = from[count];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
        #   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
        # }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
	.type    _Copy_conjoint_jlongs_atomic,@function
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
_Copy_conjoint_jlongs_atomic:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
        movl     4+8(%esp),%ecx       # count
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
        movl     4+0(%esp),%eax       # from
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
        movl     4+4(%esp),%edx       # to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
        cmpl     %eax,%edx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
        jae      cla_CopyLeft
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
cla_CopyRight:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
        subl     %eax,%edx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
        jmp      2f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
1:      fildll   (%eax)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
        fistpll  (%edx,%eax,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
        addl     $8,%eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
2:      subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
        jge      1b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
3:      fildll   (%eax,%ecx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
        fistpll  (%edx,%ecx,8)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
cla_CopyLeft:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
        subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
        jge      3b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
        # Support for void Copy::arrayof_conjoint_jshorts(void* from,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
        #                                                 void* to,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
        #                                                 size_t count)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
	.type    _mmx_Copy_arrayof_conjoint_jshorts,@function
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
_mmx_Copy_arrayof_conjoint_jshorts:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
        pushl    %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
        movl     4+12(%esp),%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
        pushl    %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
        movl     8+ 4(%esp),%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
        movl     8+ 8(%esp),%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
        cmpl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
        leal     -2(%esi,%ecx,2),%eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
        jbe      mmx_acs_CopyRight
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
        cmpl     %eax,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
        jbe      mmx_acs_CopyLeft
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
mmx_acs_CopyRight:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
        movl     %ecx,%eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
        sarl     %ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
        je       5f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
        cmpl     $33,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
        jae      3f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
1:      subl     %esi,%edi 
489c9b5090e2 Initial load
duke
parents:
diff changeset
   541
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   542
2:      movl     (%esi),%edx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   543
        movl     %edx,(%edi,%esi,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   544
        addl     $4,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
        subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   546
        jnz      2b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   547
        addl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
        jmp      5f 
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
3:      smovl # align to 8 bytes, we know we are 4 byte aligned to start
489c9b5090e2 Initial load
duke
parents:
diff changeset
   550
        subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
4:      .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   552
        movq     0(%esi),%mm0
489c9b5090e2 Initial load
duke
parents:
diff changeset
   553
        addl     $64,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   554
        movq     8(%esi),%mm1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   555
        subl     $16,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
        movq     16(%esi),%mm2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
        movq     %mm0,-64(%edi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
        movq     24(%esi),%mm0
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
        movq     %mm1,-56(%edi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
        movq     32(%esi),%mm1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
        movq     %mm2,-48(%edi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
        movq     40(%esi),%mm2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   563
        movq     %mm0,-40(%edi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
        movq     48(%esi),%mm0
489c9b5090e2 Initial load
duke
parents:
diff changeset
   565
        movq     %mm1,-32(%edi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
        movq     56(%esi),%mm1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
        movq     %mm2,-24(%edi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
        movq     %mm0,-16(%edi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
        addl     $64,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
        movq     %mm1,-8(%edi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   571
        cmpl     $16,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   572
        jge      4b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
        emms
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
	testl    %ecx,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
	ja       1b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
5:      andl     $1,%eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
        je       7f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
6:      movw     (%esi),%dx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   579
        movw     %dx,(%edi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   580
7:	popl     %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   581
        popl     %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   583
mmx_acs_CopyLeft:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   584
        std
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
        leal     -4(%edi,%ecx,2),%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
        movl     %eax,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
        movl     %ecx,%eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
        subl     $2,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   589
        sarl     %ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   590
        je       4f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   591
        cmpl     $32,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   592
        ja       3f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   593
        subl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   594
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   595
2:      movl     (%esi),%edx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   596
        movl     %edx,(%edi,%esi,1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   597
        subl     $4,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   598
        subl     $1,%ecx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   599
        jnz      2b
489c9b5090e2 Initial load
duke
parents:
diff changeset
   600
        addl     %esi,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   601
        jmp      4f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   602
3:      rep;     smovl
489c9b5090e2 Initial load
duke
parents:
diff changeset
   603
4:      andl     $1,%eax
489c9b5090e2 Initial load
duke
parents:
diff changeset
   604
        je       6f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   605
        addl     $2,%esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   606
        addl     $2,%edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   607
5:      movw     (%esi),%dx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   608
        movw     %dx,(%edi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   609
6:      cld
489c9b5090e2 Initial load
duke
parents:
diff changeset
   610
        popl     %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   611
        popl     %esi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   612
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   613
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
        # Support for jlong Atomic::cmpxchg(jlong exchange_value,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   616
        #                                   volatile jlong* dest,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   617
        #                                   jlong compare_value,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
        #                                   bool is_MP)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
        #
489c9b5090e2 Initial load
duke
parents:
diff changeset
   620
        .p2align 4,,15
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
	.type    _Atomic_cmpxchg_long,@function
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
_Atomic_cmpxchg_long:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
                                   #  8(%esp) : return PC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
        pushl    %ebx              #  4(%esp) : old %ebx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   625
        pushl    %edi              #  0(%esp) : old %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
        movl     12(%esp), %ebx    # 12(%esp) : exchange_value (low)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
        movl     16(%esp), %ecx    # 16(%esp) : exchange_value (high)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
        movl     24(%esp), %eax    # 24(%esp) : compare_value (low)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
        movl     28(%esp), %edx    # 28(%esp) : compare_value (high)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
        movl     20(%esp), %edi    # 20(%esp) : dest
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
        cmpl     $0, 32(%esp)      # 32(%esp) : is_MP
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
        je       1f
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
        lock
489c9b5090e2 Initial load
duke
parents:
diff changeset
   634
1:      cmpxchg8b (%edi)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   635
        popl     %edi
489c9b5090e2 Initial load
duke
parents:
diff changeset
   636
        popl     %ebx
489c9b5090e2 Initial load
duke
parents:
diff changeset
   637
        ret
489c9b5090e2 Initial load
duke
parents:
diff changeset
   638
7885
c02b05ba16a1 7009756: volatile variables could be broken throw reflection API
kvn
parents: 5883
diff changeset
   639
c02b05ba16a1 7009756: volatile variables could be broken throw reflection API
kvn
parents: 5883
diff changeset
   640
        # Support for jlong Atomic::load and Atomic::store.
c02b05ba16a1 7009756: volatile variables could be broken throw reflection API
kvn
parents: 5883
diff changeset
   641
        # void _Atomic_move_long(volatile jlong* src, volatile jlong* dst)
c02b05ba16a1 7009756: volatile variables could be broken throw reflection API
kvn
parents: 5883
diff changeset
   642
        .p2align 4,,15
c02b05ba16a1 7009756: volatile variables could be broken throw reflection API
kvn
parents: 5883
diff changeset
   643
	.type    _Atomic_move_long,@function
c02b05ba16a1 7009756: volatile variables could be broken throw reflection API
kvn
parents: 5883
diff changeset
   644
_Atomic_move_long:
c02b05ba16a1 7009756: volatile variables could be broken throw reflection API
kvn
parents: 5883
diff changeset
   645
        movl     4(%esp), %eax   # src
c02b05ba16a1 7009756: volatile variables could be broken throw reflection API
kvn
parents: 5883
diff changeset
   646
        fildll    (%eax)
c02b05ba16a1 7009756: volatile variables could be broken throw reflection API
kvn
parents: 5883
diff changeset
   647
        movl     8(%esp), %eax   # dest
c02b05ba16a1 7009756: volatile variables could be broken throw reflection API
kvn
parents: 5883
diff changeset
   648
        fistpll   (%eax)
c02b05ba16a1 7009756: volatile variables could be broken throw reflection API
kvn
parents: 5883
diff changeset
   649
        ret
c02b05ba16a1 7009756: volatile variables could be broken throw reflection API
kvn
parents: 5883
diff changeset
   650