RFR: JDK-8287061: Support for rematerializing scalar replaced objects participating in allocation merges [v14]

Cesar Soares Lucas cslucas at openjdk.org
Mon Jun 5 19:30:07 UTC 2023


On Mon, 5 Jun 2023 18:05:47 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> Cesar Soares Lucas has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 15 commits:
>> 
>>  - Catching up with master branch.
>>    
>>    Merge remote-tracking branch 'origin/master' into rematerialization-of-merges
>>  - Address PR review 6: refactoring around rematerialization & improve test cases.
>>  - Address PR review 5: refactor on rematerialization & add tests.
>>  - Merge remote-tracking branch 'origin/master' into rematerialization-of-merges
>>  - Address part of PR review 4 & fix a bug setting only_candidate
>>  - Catching up with master
>>    
>>    Merge remote-tracking branch 'origin/master' into rematerialization-of-merges
>>  - Fix tests. Remember previous reducible Phis.
>>  - Address PR review 3. Some comments and be able to abort compilation.
>>  - Merge with Master
>>  - Addressing PR review 2: refactor & reuse MacroExpand::scalar_replacement method.
>>  - ... and 5 more: https://git.openjdk.org/jdk/compare/46c4da7f...8f81a7c8
>
> src/hotspot/share/code/debugInfo.cpp line 301:
> 
>> 299: void ObjectMergeValue::print_detailed(outputStream* st) const {
>> 300:   st->print("merge: ID=%d", _id);
>> 301: #ifndef PRODUCT
> 
> Can you post a sample of the output, please?
> 
> Why is it limited to non-product builds? It's valuable irrespective of build flavor.
> 
> As I see in `ObjectValue::print_on` and `ScopeDesc::print_on`, you mix `print_on` with `print_fields_on`. Any particular reason for that? You could add `is_object_merge` case in ObjectValue::print_on` instead and extend `ObjectValue::print_fields_on` to cover `ObjectMergeValue` case. I find it hard to reason about `ObjectValue::print_on` vs `ObjectMergeValue::print_on` since it's a non-virtual method. 
> 
>  
> 
> Also, formatting is broken.

I added a few samples below and there are a few more here: https://gist.github.com/JohnTortugo/913523947e08157def6cfebafa7d5daa

Sample 1:


Compiled method (c2)     415   24             TestTrapAfterMerge::test (57 bytes)
 total in heap  [0x00007f7b4d03da90,0x00007f7b4d03de18] = 904
 relocation     [0x00007f7b4d03dc00,0x00007f7b4d03dc18] = 24
 main code      [0x00007f7b4d03dc20,0x00007f7b4d03dcb8] = 152
 stub code      [0x00007f7b4d03dcb8,0x00007f7b4d03dcd0] = 24
 oops           [0x00007f7b4d03dcd0,0x00007f7b4d03dce0] = 16
 metadata       [0x00007f7b4d03dce0,0x00007f7b4d03dce8] = 8
 scopes data    [0x00007f7b4d03dce8,0x00007f7b4d03dd50] = 104
 scopes pcs     [0x00007f7b4d03dd50,0x00007f7b4d03de10] = 192
 dependencies   [0x00007f7b4d03de10,0x00007f7b4d03de18] = 8
scopes:
ScopeDesc(pc=0x00007f7b4d03dc3a offset=1a):
   TestTrapAfterMerge::test at -1 (line 3)
ScopeDesc(pc=0x00007f7b4d03dc41 offset=21):
   TestTrapAfterMerge::test at 11 (line 5)
ScopeDesc(pc=0x00007f7b4d03dc44 offset=24):
   TestTrapAfterMerge::test at 51 (line 12)
ScopeDesc(pc=0x00007f7b4d03dc4a offset=2a):
   TestTrapAfterMerge::test at 46 (line 8)
ScopeDesc(pc=0x00007f7b4d03dc52 offset=32):
   TestTrapAfterMerge::test at 37 (line 9)
ScopeDesc(pc=0x00007f7b4d03dc57 offset=37):
   TestTrapAfterMerge::test at 43 (line 8)
ScopeDesc(pc=0x00007f7b4d03dc61 offset=41):
   TestTrapAfterMerge::test at 46 (line 8)  reexecute=true
   Locals
    - l0: empty
    - l1: empty
    - l2: reg rbx [6],int
    - l3: empty
    - l4: merge: ID=26
    - l5: reg r11 [22],int
   Objects
    - 0: merge: ID=26, selector="reg r10 [20],int", merge_pointer="nullptr", candidate objs=[27, 28]
    - 1: obj: ID=27, is_root=0, N.Fields=1, klass: Point 
Fields: reg r8 [16],int
    - 2: obj: ID=28, is_root=0, N.Fields=1, klass: Point 
Fields: reg rcx [2],int
ScopeDesc(pc=0x00007f7b4d03dc63 offset=43):
   TestTrapAfterMerge::test at 46 (line 8)
ScopeDesc(pc=0x00007f7b4d03dc6c offset=4c):
   TestTrapAfterMerge::test at 34 (line 8)
ScopeDesc(pc=0x00007f7b4d03dc71 offset=51):
   TestTrapAfterMerge::test at 55 (line 12)


- Sample2:


Compiled method (c2)     443   24             TestManys::test (41 bytes)
 total in heap  [0x00007f35e9155b90,0x00007f35e9155e78] = 744
 relocation     [0x00007f35e9155d00,0x00007f35e9155d18] = 24
 main code      [0x00007f35e9155d20,0x00007f35e9155d88] = 104
 stub code      [0x00007f35e9155d88,0x00007f35e9155da0] = 24
 oops           [0x00007f35e9155da0,0x00007f35e9155db0] = 16
 metadata       [0x00007f35e9155db0,0x00007f35e9155db8] = 8
 scopes data    [0x00007f35e9155db8,0x00007f35e9155e10] = 88
 scopes pcs     [0x00007f35e9155e10,0x00007f35e9155e70] = 96
 dependencies   [0x00007f35e9155e70,0x00007f35e9155e78] = 8
scopes:
ScopeDesc(pc=0x00007f35e9155d3a offset=1a):
   TestManys::test at -1 (line 57)
ScopeDesc(pc=0x00007f35e9155d42 offset=22):
   TestManys::test at 11 (line 59)
ScopeDesc(pc=0x00007f35e9155d58 offset=38):
   TestManys::test at 25 (line 63)
   Locals
    - l0: empty
    - l1: empty
    - l2: empty
    - l3: empty
    - l4: empty
    - l5: empty
    - l6: empty
    - l7: empty
    - l8: merge: ID=26
   Objects
    - 0: merge: ID=26, selector="reg rbp [10],int", merge_pointer="nullptr", candidate objs=[27, 28]
    - 1: obj: ID=27, is_root=0, N.Fields=4, klass: Point 
Fields: stack[36], stack[36], 0, 0
    - 2: obj: ID=28, is_root=0, N.Fields=4, klass: Point 
Fields: 2023, 0, 0, 0
ScopeDesc(pc=0x00007f35e9155d74 offset=54):
   TestManys::test at 25 (line 63)


- Sample3:

Compiled method (c2)     436   24             TestMultiSFO::test (48 bytes)
 total in heap  [0x00007f1df5155590,0x00007f1df5155850] = 704
 relocation     [0x00007f1df5155700,0x00007f1df5155718] = 24
 main code      [0x00007f1df5155720,0x00007f1df5155788] = 104
 stub code      [0x00007f1df5155788,0x00007f1df51557a0] = 24
 oops           [0x00007f1df51557a0,0x00007f1df51557b0] = 16
 metadata       [0x00007f1df51557b0,0x00007f1df51557b8] = 8
 scopes data    [0x00007f1df51557b8,0x00007f1df51557f8] = 64
 scopes pcs     [0x00007f1df51557f8,0x00007f1df5155848] = 80
 dependencies   [0x00007f1df5155848,0x00007f1df5155850] = 8
scopes:
ScopeDesc(pc=0x00007f1df515573a offset=1a):
   TestMultiSFO::test at -1 (line 12)
ScopeDesc(pc=0x00007f1df515575c offset=3c):
   TestMultiSFO::test at 28 (line 19)
   Locals
    - l0: empty
    - l1: empty
    - l2: empty
    - l3: merge: ID=14
    - l4: obj: ID=15, is_root=1, N.Fields=2, klass: TestMultiSFO$Point 
Fields: stack[12], stack[8]

   Objects
    - 0: merge: ID=14, selector="reg rbp [10],int", merge_pointer="nullptr", candidate objs=[15, 16]
    - 1: obj: ID=15, is_root=1, N.Fields=2, klass: TestMultiSFO$Point 
Fields: stack[12], stack[8]
    - 2: obj: ID=16, is_root=0, N.Fields=2, klass: TestMultiSFO$Point 
Fields: stack[8], stack[12]
ScopeDesc(pc=0x00007f1df5155778 offset=58):
   TestMultiSFO::test at 28 (line 19)

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/12897#discussion_r1218500009


More information about the hotspot-dev mailing list