Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARM codegen needs to handle non-simple array copies #1996

Closed
JamesKingdon opened this issue Nov 11, 2017 · 1 comment
Closed

ARM codegen needs to handle non-simple array copies #1996

JamesKingdon opened this issue Nov 11, 2017 · 1 comment

Comments

@JamesKingdon
Copy link
Contributor

OMR::ARM::TreeEvaluator::arraycopyEvaluator in arm/codegen/OMRTreeEvaluator.cpp currently asserts when passed a non-simple array copy node. In a production build without asserts it will generate incorrect code for most non-simple array copies.

@JamesKingdon
Copy link
Contributor Author

JamesKingdon commented Nov 11, 2017

Running with gcpolicy optthruput should eliminate the need for write barriers, so it may be possible to quickly handle the degenerate case where complex copies can be treated as simple.

Here's the array copy that currently trips up a count=0,disableAsyncCheck -version test:

 n71n     (  1)    arraycopy  <arraycopy>[#478  helper Method] [flags 0x400 0x0 ] (Unsigned cannotOverflow forwardArrayCopy noArrayStoreCheckArrayCopy referenceArrayCopy wordElementArrayCopy )  [0x903047e8] bci=[0,1,58] rc=1 vc=145 vn=- li=3 udi=- nc=5 flg=0xd020
 n3n      (  2)      aload  sun/invoke/util/Wrapper.$VALUES [Lsun/invoke/util/Wrapper;[#616  notAccessed final Static] [flags 0xa0307 0x0 ] (X!=0 X>=0 sharedMemory )  [0x90303b28] bci=[-1,0,28] rc=2 vc=145 vn=- li=3 udi=- nc=0 flg=0x104
 n27n     (  3)      ==>anewarray (in &GPR_0x90431af0) (highWordZero Unsigned X!=0 allocationCanBeRemoved sharedMemory )
 n68n     (  1)      aiadd                                                                            [0x90304758] bci=[0,1,58] rc=1 vc=145 vn=- li=3 udi=- nc=2
 n3n      (  2)        ==>aload (X!=0 X>=0 sharedMemory )
 n67n     (  2)        iconst 8 (X!=0 X>=0 )                                                          [0x90304728] bci=[0,0,58] rc=2 vc=145 vn=- li=3 udi=- nc=0 flg=0x104
 n70n     (  1)      aiadd                                                                            [0x903047b8] bci=[0,1,58] rc=1 vc=145 vn=- li=3 udi=- nc=2
 n27n     (  3)        ==>anewarray (in &GPR_0x90431af0) (highWordZero Unsigned X!=0 allocationCanBeRemoved sharedMemory )
 n67n     (  2)        ==>iconst 8 (X!=0 X>=0 )
 n66n     (  1)      iconst 40 (X!=0 X>=0 )                                                           [0x903046f8] bci=[0,1,58] rc=1 vc=145 vn=- li=3 udi=- nc=0 flg=0x104

I'm exploring the possibility that the noArrayStoreCheckArrayCopy flag is enough to tell that this can be treated as a simple copy.
Possibly noArrayStoreCheckArrayCopy is necessary, but it's not sufficient. The key criteria is whether or not write barriers are required which can be determined from cg->comp()->getOptions()->needWriteBarriers()

knn-k added a commit to knn-k/omr that referenced this issue Dec 25, 2017
OMR::ARM::TreeEvaluator::arraycopyEvaluator() asserts when passed
a non-simple arraycopy node.
This implements new functions genWrtbarForArrayCopy() and
VMCardCheckEvaluator() for handling non-simple arraycopy nodes.

Closes: eclipse#1996

Signed-off-by: knn-k <konno@jp.ibm.com>
knn-k added a commit to knn-k/omr that referenced this issue Jan 27, 2018
OMR::ARM::TreeEvaluator::arraycopyEvaluator() asserts when passed
a non-simple arraycopy node.
This commit calls TR::TreeEvaluator::genWrtbarForArrayCopy() in
non-simple arraycopy case.

Closes: eclipse#1996

Signed-off-by: knn-k <konno@jp.ibm.com>
0dvictor pushed a commit to 0dvictor/omr that referenced this issue Feb 15, 2018
OMR::ARM::TreeEvaluator::arraycopyEvaluator() asserts when passed
a non-simple arraycopy node.
This commit calls TR::TreeEvaluator::genWrtbarForArrayCopy() in
non-simple arraycopy case.

Closes: eclipse#1996

Signed-off-by: knn-k <konno@jp.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants