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

Use correct arrayBaseNode in BoolArrayStoreTransformer for OffHeap #20945

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rmnattas
Copy link
Contributor

When BoolArrayStoreTransformer insert runtime checks for unknown array type stores generated by bastore bytecode, it uses the target array address (without offset) as the base array to load the vft-symbol and check the class type. With OffHeap that node would be the dataAddrPtr instead of array base.

This PR checks if its the dataAddrPtr and uses the correct array base node for the generated check.

BEFORE
n88n      bstorei  <array-shadow>[#244  Shadow] 
n87n        aladd (internalPtr )                                                              
n85n          aloadi  <contiguousArrayDataAddrField>[#347  final Shadow +8] 
n69n            aload  UnsafeArrayGetTest.largeByteArray [B[#404  final Static] (obj1) 
n86n          i2l (X>=0 )                                                                     
n70n            iload  <auto slot 1>[#403  Auto] 
n471n       i2b                                                                               
n470n         iand                                                                           
n78n            isub                                                                      
n71n              iconst 127 (X!=0 X>=0 )                                                
n75n              ==>icalli
n468n           iadd                                                                    
n466n             ishl                                                                 
n464n               acmpeq                                                            
n462n                 aloadi  <vft-symbol>[#315  Shadow] 
n85n                    ==>aloadi
n463n                 aconst 0xb6d00 Abstract ([Z.class) (classPointerConstant X!=0 X>=0 X<=0 )
n465n               iconst 1 (X!=0 X>=0 )                                                     
n467n             iconst -1 (X!=0 X<=0 )                                                     


AFTER
n88n      bstorei  <array-shadow>[#244  Shadow] 
n87n        aladd (internalPtr )                                                              
n85n          aloadi  <contiguousArrayDataAddrField>[#347  final Shadow +8] 
n69n            aload  UnsafeArrayGetTest.largeByteArray [B[#404  final Static] (obj1) 
n86n          i2l (X>=0 )                                                                     
n70n            iload  <auto slot 1>[#403  Auto] 
n471n       i2b                                                                               
n470n         iand                                                                           
n78n            isub                                                                      
n71n              iconst 127 (X!=0 X>=0 )                                                
n75n              ==>icalli
n468n           iadd                                                                    
n466n             ishl                                                                 
n464n               acmpeq                                                            
n462n                 aloadi  <vft-symbol>[#315  Shadow] 
n69n                    ==>aload
n463n                 aconst 0xb6d00 Abstract ([Z.class) (classPointerConstant X!=0 X>=0 X<=0 )
n465n               iconst 1 (X!=0 X>=0 )                                                     
n467n             iconst -1 (X!=0 X<=0 )                                                     

@rmnattas
Copy link
Contributor Author

fyi @zl-wang

@rmnattas rmnattas marked this pull request as draft January 15, 2025 20:58
@rmnattas
Copy link
Contributor Author

Set as draft to finish testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant