JDK-6547163 : 6498658 changes introduced regression in arraycopy on sparc
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 7
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2007-04-18
  • Updated: 2010-04-03
  • Resolved: 2007-05-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u2Fixed 7Fixed hs10Fixed
Related Reports
Relates :  
Relates :  
Description
6498658 changes introduced regression in arraycopy on sparc (32-bits VM)
when the copy offsets statically known constants which have heapWordSize mod
values (4 bytes in 32-bits VM) and offset's difference is not 8 bytes mod:

20070214101449.sgoldman.6524971
jaberwocky% gamma -Xbatch ArrayCopyTest5

Disjoint +4 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 122
Time to copy 64  chars (128 bytes): 134
Time to copy 32   ints (128 bytes): 125
Time to copy 32   oops (128 bytes): 134

Disjoint +8 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 124
Time to copy 64  chars (128 bytes): 98
Time to copy 32   ints (128 bytes): 103
Time to copy 32   oops (128 bytes): 110
Time to copy 16  longs (128 bytes): 87

Disjoint +4 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 117
Time to copy 64  chars (128 bytes): 103
Time to copy 32   ints (128 bytes): 100
Time to copy 32   oops (128 bytes): 109

Disjoint +8 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 103
Time to copy 64  chars (128 bytes): 72
Time to copy 32   ints (128 bytes): 77
Time to copy 32   oops (128 bytes): 86
Time to copy 16  longs (128 bytes): 62

Disjoint +4 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 89
Time to copy 64  chars (128 bytes): 99
Time to copy 32   ints (128 bytes): 108
Time to copy 32   oops (128 bytes): 96

Disjoint +8 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 90
Time to copy 64  chars (128 bytes): 65
Time to copy 32   ints (128 bytes): 65
Time to copy 32   oops (128 bytes): 78
Time to copy 16  longs (128 bytes): 55

20070214151808.kvn.6498658
jaberwocky% gamma -Xbatch ArrayCopyTest5

Disjoint +4 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 18451
Time to copy 64  chars (128 bytes): 18401
Time to copy 32   ints (128 bytes): 17089
Time to copy 32   oops (128 bytes): 17070

Disjoint +8 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 81
Time to copy 64  chars (128 bytes): 80
Time to copy 32   ints (128 bytes): 81
Time to copy 32   oops (128 bytes): 80
Time to copy 16  longs (128 bytes): 68

Disjoint +4 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 18694
Time to copy 64  chars (128 bytes): 18658
Time to copy 32   ints (128 bytes): 17317
Time to copy 32   oops (128 bytes): 17259

Disjoint +8 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 57
Time to copy 64  chars (128 bytes): 54
Time to copy 32   ints (128 bytes): 54
Time to copy 32   oops (128 bytes): 60
Time to copy 16  longs (128 bytes): 43

Disjoint +4 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 18660
Time to copy 64  chars (128 bytes): 18573
Time to copy 32   ints (128 bytes): 17239
Time to copy 32   oops (128 bytes): 17221

Disjoint +8 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 53
Time to copy 64  chars (128 bytes): 47
Time to copy 32   ints (128 bytes): 45
Time to copy 32   oops (128 bytes): 46
Time to copy 16  longs (128 bytes): 35

Fixed VM
jaberwocky% gamma -Xbatch ArrayCopyTest5

Disjoint +4 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 98
Time to copy 64  chars (128 bytes): 87
Time to copy 32   ints (128 bytes): 89
Time to copy 32   oops (128 bytes): 93

Disjoint +8 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 80
Time to copy 64  chars (128 bytes): 73
Time to copy 32   ints (128 bytes): 79
Time to copy 32   oops (128 bytes): 78
Time to copy 16  longs (128 bytes): 67

Disjoint +4 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 84
Time to copy 64  chars (128 bytes): 67
Time to copy 32   ints (128 bytes): 65
Time to copy 32   oops (128 bytes): 68

Disjoint +8 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 55
Time to copy 64  chars (128 bytes): 49
Time to copy 32   ints (128 bytes): 54
Time to copy 32   oops (128 bytes): 52
Time to copy 16  longs (128 bytes): 41

Disjoint +4 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 59
Time to copy 64  chars (128 bytes): 55
Time to copy 32   ints (128 bytes): 55
Time to copy 32   oops (128 bytes): 62

Disjoint +8 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 50
Time to copy 64  chars (128 bytes): 49
Time to copy 32   ints (128 bytes): 42
Time to copy 32   oops (128 bytes): 51
Time to copy 16  longs (128 bytes): 35


64-bits VM is fine since heapWordSize is 8 bytes:

20070214101449.sgoldman.6524971
jaberwocky% gamma -Xbatch ArrayCopyTest5

Disjoint +4 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 135
Time to copy 64  chars (128 bytes): 142
Time to copy 32   ints (128 bytes): 133
Time to copy 32   oops (128 bytes): 145

Disjoint +8 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 135
Time to copy 64  chars (128 bytes): 110
Time to copy 32   ints (128 bytes): 111
Time to copy 32   oops (128 bytes): 145
Time to copy 16  longs (128 bytes): 91

Disjoint +4 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 126
Time to copy 64  chars (128 bytes): 115
Time to copy 32   ints (128 bytes): 110
Time to copy 32   oops (128 bytes): 118

Disjoint +8 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 112
Time to copy 64  chars (128 bytes): 82
Time to copy 32   ints (128 bytes): 85
Time to copy 32   oops (128 bytes): 118
Time to copy 16  longs (128 bytes): 68

Disjoint +4 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 101
Time to copy 64  chars (128 bytes): 108
Time to copy 32   ints (128 bytes): 112
Time to copy 32   oops (128 bytes): 113

Disjoint +8 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 103
Time to copy 64  chars (128 bytes): 77
Time to copy 32   ints (128 bytes): 72
Time to copy 32   oops (128 bytes): 106
Time to copy 16  longs (128 bytes): 60

20070214151808.kvn.6498658
jaberwocky% gamma -Xbatch ArrayCopyTest5

Disjoint +4 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 99
Time to copy 64  chars (128 bytes): 107
Time to copy 32   ints (128 bytes): 98
Time to copy 32   oops (128 bytes): 134

Disjoint +8 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 78
Time to copy 64  chars (128 bytes): 84
Time to copy 32   ints (128 bytes): 84
Time to copy 32   oops (128 bytes): 134
Time to copy 16  longs (128 bytes): 76

Disjoint +4 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 91
Time to copy 64  chars (128 bytes): 81
Time to copy 32   ints (128 bytes): 72
Time to copy 32   oops (128 bytes): 106

Disjoint +8 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 53
Time to copy 64  chars (128 bytes): 60
Time to copy 32   ints (128 bytes): 59
Time to copy 32   oops (128 bytes): 112
Time to copy 16  longs (128 bytes): 50

Disjoint +4 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 71
Time to copy 64  chars (128 bytes): 70
Time to copy 32   ints (128 bytes): 66
Time to copy 32   oops (128 bytes): 96

Disjoint +8 bytes offset small arraycopy:
Time to copy 128 bytes (128 bytes): 46
Time to copy 64  chars (128 bytes): 52
Time to copy 32   ints (128 bytes): 46
Time to copy 32   oops (128 bytes): 101
Time to copy 16  longs (128 bytes): 43

Comments
SUGGESTED FIX Webrev: http://prt-web.sfbay.sun.com/net/prt-archiver.sfbay/data/archived_workspaces/main/c2_baseline/2007/20070418210619.kvn.6547163/workspace/webrevs/webrev-2007.04.18/index.html Solution: Check source address in aligned stubs also and use copy with shift if it is not aligned to 8 bytes. Added regression test.
19-04-2007

EVALUATION The aligned arraycopy stubs are called when the copy offsets statically known constants which have heapWordSize mod values (4 bytes in 32-bits VM). In aligned arraycopy stubs only destination address was checked and aligned to 8 bytes causing the execution of ldx/stx instructions on address not aligned to 8 bytes. Which causes HW traps on each instruction.
18-04-2007