You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Aleksey Shipilev (JIRA)" <ji...@apache.org> on 2008/01/16 15:34:34 UTC

[jira] Created: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

[drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
-----------------------------------------------------------------------------------------

                 Key: HARMONY-5396
                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
             Project: Harmony
          Issue Type: Improvement
          Components: DRLVM
            Reporter: Aleksey Shipilev


During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Egor Pasko updated HARMONY-5396:
--------------------------------

    Attachment: 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt

attaching:

0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt

a more accurate flagging strategy (per-method) // to be committed

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Egor Pasko updated HARMONY-5396:
--------------------------------

    Attachment: 0006-ATOMIC_INC-strategy-linux-only.txt

patch: 0006-ATOMIC_INC-strategy-linux-only.txt

implements atomic updates of the counter while doing LOCK_INSERT for TNV insertions.

This lacks implementation on Windows. Can anybody, please, help me in it? The only missing is correct assembly on win32 and win64.

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0004-value-profiling-reviving-locked-profile.txt, 0005-volatile-fix.txt, 0006-ATOMIC_INC-strategy-linux-only.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Egor Pasko resolved HARMONY-5396.
---------------------------------

    Resolution: Fixed

let's consider it fixed, the comitted fixes already showed some significant performance improvements, if someone wants more in this case, call another issue

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0004-value-profiling-reviving-locked-profile.txt, 0005-volatile-fix.txt, 0006-ATOMIC_INC-strategy-linux-only.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568103#action_12568103 ] 

Aleksey Shipilev commented on HARMONY-5396:
-------------------------------------------

Pavel, thanks for explanation! I've missed that Egor's patch lacks original locking approach, while my patch leaves conventional mutex locking as default choice. I think we should reimplement it again to ensure gathering precise value profile - that is, not to influence large benchmarks. Then we could revisit the issue with selecting the working group of locking strategies.


> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aleksey Shipilev updated HARMONY-5396:
--------------------------------------

    Attachment: 0004-value-profiling-reviving-locked-profile.txt

0004-value-profiling-reviving-locked-profile.txt
 - Renaming LOCKED to LOCKED_INSERT
 - Reviving LOCKED solution, as discussed.

Defaults are:
 - server (ia32/em64t): LOCKED_INSERT
 - server_aggressive: LOCKED

This patch also fixes the problem with server_aggressive.emconf, there was no value for updateStrategy

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0004-value-profiling-reviving-locked-profile.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566763#action_12566763 ] 

Egor Pasko commented on HARMONY-5396:
-------------------------------------

Alexey,

bln, we worked on the same patch at the same time :)

I tried to give more options and atomic flag modification (but now I see it is buggy, need to make the flag a class member, not a static variable, my fault)

JFYI: I am usually more active in Harmony on Thursdays (this is how my schedule works:) 

how is that?

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568588#action_12568588 ] 

Aleksey Shipilev commented on HARMONY-5396:
-------------------------------------------

Sounds good, let's revisit (3) after M5.

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0004-value-profiling-reviving-locked-profile.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Pavel Ozhdikhin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568510#action_12568510 ] 

Pavel Ozhdikhin commented on HARMONY-5396:
------------------------------------------

4. It would be nice to have results for all options, LOCKED and LOCKED_INSERT is not the only choice.

5. Egor, I've never told that we should remove TNV_DIVIDED logics. Also, I did not mention this in my previous comment, I think you should have updated TNV_DIVIDED collector as well, as soon as you decided to commit new locking options.

Thanks,
Pavel


> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0004-value-profiling-reviving-locked-profile.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Egor Pasko updated HARMONY-5396:
--------------------------------

    Attachment: 0005-volatile-fix.txt

making the flag volatile in flagged update strategy (stability fix)

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0004-value-profiling-reviving-locked-profile.txt, 0005-volatile-fix.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568051#action_12568051 ] 

Egor Pasko commented on HARMONY-5396:
-------------------------------------

Pavel, I understand your concern, it makes sense to check the options without branching,

but:
1. ideally branches should make no slowdown because jumps are fairly static, i.e. branch predictor should take it nicely (no guarantee on hardware, of course)
2. we yet do not have a good benchmark to look at, which a) exercises the value profiler heavily b) is sensitive to changes to profile precision (lots of options for effective devirt?)



> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566955#action_12566955 ] 

Aleksey Shipilev commented on HARMONY-5396:
-------------------------------------------

Egor, that was fun :) I'm glad to see our approaches are essentially the same.
Your patch looks more mature, let's commit yours instead of mine.

Have you ideas how to nop VP calls?

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Egor Pasko updated HARMONY-5396:
--------------------------------

    Attachment: 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt

attaching implementation of value profiling options: locked, flagged_all, flagged_insert, unsafe (see comments in code for description of those)

patch: 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt

how the modified GenericQuicksort test runs:
1. since table inserts are rare and the test is single-threaded FLAGGED_INSERT is essentially the same as LOCKED and UNSAFE
2. LOCKED improved 2x in speed if compared to the original locking strategy
3. FLAGGED_ALL is 15% slower than FLAGGED_INSERT on my laptop (hmm, inserts are not so rare? needs investigation)
4. if value profile instrumentation is OFF, first iteration runs 3x faster, definitely want to patch the code with nops when profile is ready, such a waste of resources!

it would be interesting to see which strategy is best on a multi-threaded application on an SMP



> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568351#action_12568351 ] 

Aleksey Shipilev commented on HARMONY-5396:
-------------------------------------------

Egor, there is *CRASH* in server_aggressive, because no default option for updateStrategy is specified, so we need to commit the fix for that ASAP.  Maybe we might ask Mikhail F. or Alexey V. for help?

As for atomic increments, there are two approaches: 
 a. implementing *spin-loop* with atomic increment - but who will arbiter that in case of contention? I don't believe this is right.
 b. implementing fast atomic increment with falling back to mutex in case of contention. Linux has such thing as "futex".

 I think it should be more general approach, not only the ValueProfiler related. For example, try to migrate significant parts of framework from hymutex_lock/unlock to hyfutex_lock/unlock. That deserves separate thread.

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0004-value-profiling-reviving-locked-profile.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566956#action_12566956 ] 

Aleksey Shipilev commented on HARMONY-5396:
-------------------------------------------

One more thought on patches. There are difference between our implementations: my implementations does not fail when updateStrategy is not defined. I think it's reasonable to fall back gently to default mode.

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aleksey Shipilev updated HARMONY-5396:
--------------------------------------

    Attachment: HARMONY-5396-syncTie.patch

HARMONY-5396-syncTie.patch
Tying profile locking in addNewValue, exposing hotpath to be lock-free.

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>         Attachments: HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Egor Pasko reassigned HARMONY-5396:
-----------------------------------

    Assignee: Egor Pasko

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568516#action_12568516 ] 

Aleksey Shipilev commented on HARMONY-5396:
-------------------------------------------

Egor,

1. Thanks, all is OK after r627320.

2. Whoops, I thought I've eliminated them, sorry. Will teach CDT further :)

3. Yes, you're right on atomic increment approach for this counter - that's an option too. I've messed up things a little.

4. Let's implement the (3) option and then measure performance of benchmarks for all bulk.

5. I agree with Pavel, updateStrategy should be propagated to TNV_DIVIDED too.

Thanks,
Aleksey.


> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0004-value-profiling-reviving-locked-profile.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565126#action_12565126 ] 

Egor Pasko commented on HARMONY-5396:
-------------------------------------

committed refactoring at r617928. hope nobody objected :)

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Pavel Ozhdikhin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568094#action_12568094 ] 

Pavel Ozhdikhin commented on HARMONY-5396:
------------------------------------------

Alexey, for the long-running workloads the precision of the new ValueProfile will count and we need to compare new strategies here as well. Neither of 4 committed techniques guarantees precise value profile. Thus removing original locking approach is questionable to me. Only check on real benchmarks may answer.

Regarding the value profiling overhead  - it was noticeable on DaCapo which is not a long-running benchmark. To heavily exercise value profiler we need to turn on value profile guided devirt for all methods, including virtual ones. VP-guided devirt for virtual calls was disabled in server mode just because it had a noticeable profiling overhead.

Egor, in general I agree that branches are not as much affect performance as locks. The question is do we need to keep so many profiling options? My understanding on the dev list was that we experiment with the startegies  and choose 1-2 best to commit. And I'm concerned about removal of precise profile locking (until measurements show that it is needless).

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568338#action_12568338 ] 

Aleksey Shipilev commented on HARMONY-5396:
-------------------------------------------

> BTW, I also thought about atomic increment (lock prefix),
Egor, I think we have enough options to play with :)

It is really important to commit part 0004 as it solves the degradation for server_aggressive.


> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0004-value-profiling-reviving-locked-profile.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571902#action_12571902 ] 

Aleksey Shipilev commented on HARMONY-5396:
-------------------------------------------

Egor, on ia32 it should be like:

__asm {
	mov ecx, targetPtr
	mov eax, 0
	mov edx, newValue
	lock cmpxchg [ecx], edx		
	mov result, eax
}

Then check result, if (result == 0) then operation finishes successfully, if (result == newValue), then the update is failed.

 If you needn't to check this condition, you might use following code for atomic increment:

__asm {
	mov ecx, targetPtr
	mov edx, [ecx]
        add edx, 1
	lock cmpxchg [ecx], edx
}

As for x64, you might use cmpxchg8b instead of cmpxchg if you need to update 64-bit register.

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0004-value-profiling-reviving-locked-profile.txt, 0005-volatile-fix.txt, 0006-ATOMIC_INC-strategy-linux-only.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568163#action_12568163 ] 

Aleksey Shipilev commented on HARMONY-5396:
-------------------------------------------

Ok, I'm fine with that.
I will implement it by myself and notify you before starting work, if emergency action will be required.

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568345#action_12568345 ] 

Egor Pasko commented on HARMONY-5396:
-------------------------------------

Aleksey,

1. nice patch, thanks! will commit in 1-2 days
2. so, I assume there IS a degradation for server_aggressive that you measured? is it intermittent?
3. by suggesting an atomic increment I am speaking about replacing the LOCKED strategy, but not introducing an extra option, "lock inc" is definitely faster than a mutex, you know

P.S.: I do not really bother with server_aggressive scores, sorry for that. server_aggressive is for abstract world records in vacuum, but not for people that do not bother to build configurations highly tuned for specific hardware/OS/memsize/etc but need rather reasonable performance feelings in most cases. 



> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0004-value-profiling-reviving-locked-profile.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566976#action_12566976 ] 

Aleksey Shipilev commented on HARMONY-5396:
-------------------------------------------

Ok, fine with failing when no strategy is defined.
I will look into notification callback later.

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12567459#action_12567459 ] 

Egor Pasko commented on HARMONY-5396:
-------------------------------------

committed  0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt at r620305.

plz, feel free to check and experiment with the new options :)

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568067#action_12568067 ] 

Aleksey Shipilev commented on HARMONY-5396:
-------------------------------------------

I think the performance of ValueProfiler is only influence cold methods since hot recompiled methods have no value profiling. And so, we should only care about fast startup workloads, where code is relatively cold to be influenced with value profiling. That mean, we really don't care about long benchmarks.

Even though we care about short benchmarks, several subsequent branches is better than locking on mutex or atomic. 
May be we might try to measure Eclipse startup time in -Xem:server to have strict data.

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568476#action_12568476 ] 

Egor Pasko commented on HARMONY-5396:
-------------------------------------

Aleksey, Pavel

1. 0004-value-profiling-reviving-locked-profile.txt  applied at r627320, please, check

2. Alexey, plz, do not put tabs and trailing spaces into code :)

3. for atomic increment there is approach (c) that I am suggesting -- just use the userspace atomic increment x86 instruction, atomicity is guaranteed by hardware, fast and furious (surprise, surprise:)

4. Now server_aggressive is in place, back to my question: is there any difference between LOCKED and LOCKED_INSERT on your benchmark(s)?

5. we also have vpalgo=TNV_DIVIDED (which should be an even better profile if implemented right), did you try it on server_aggressive? if it makes no effect, then. according to Pavel's strategy we should remove it. In my strategy, I would not, because some day processors may change and this algorithm may be of use (and even now, I do not know, what happens on mobile processors)

thanks for discussions

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0004-value-profiling-reviving-locked-profile.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Pavel Ozhdikhin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568044#action_12568044 ] 

Pavel Ozhdikhin commented on HARMONY-5396:
------------------------------------------

IMO there are too many options/branches for such a hot method. Good for experimenting but not necessary for a product. I think it makes sense to compare these profile updating strategies on larger benchmarks and leave 1-2 promising the most. Aleksey, do you have comparison data on the benchmarks?

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12680775#action_12680775 ] 

Egor Pasko commented on HARMONY-5396:
-------------------------------------

reasons to close this issue:
0. no performance lab to test on
1. nobody showed up interested in producing win32 atomic increment code, gcc-only solution would be an unpleasant diverging

objections are welcome

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0004-value-profiling-reviving-locked-profile.txt, 0005-volatile-fix.txt, 0006-ATOMIC_INC-strategy-linux-only.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568124#action_12568124 ] 

Egor Pasko commented on HARMONY-5396:
-------------------------------------

Guys, you are kidding me :)

IF _intermittent_ performance degradations is an issue, then why don't we run synchronized edge profile? same crap.

I agree that implementing the original locking strategy might make sense, but then, please, agree to set it only in server_aggressive mode. Otherwise I do not see any way to improve user experience with the original microbenchmark.

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aleksey Shipilev updated HARMONY-5396:
--------------------------------------

    Attachment: 0002-ValueProfileCollector-implementing-locking-strategies.txt

0002-ValueProfileCollector-implementing-locking-strategies.txt
Implementing discussed locking strategies for non-critical data:
 FREE - no locking at all
 MUTEX - conventional mutexes locking
 FLAG - locking with "occupied' flag

Behavior is controlled with lockStrategy option:

../builds/shade.r618316.P.VPlock/bin/java -Xem:server QSort
VALUE_PROF.lockStrategy=MUTEX (default)
Iteration 0, elapsed: 20874 ms
Iteration 1, elapsed: 875 ms
Iteration 2, elapsed: 891 ms
...

../builds/shade.r618316.P.VPlock/bin/java -Xem:server QSort
VALUE_PROF.lockStrategy=FREE
Iteration 0, elapsed: 9453 ms
Iteration 1, elapsed: 921 ms
Iteration 2, elapsed: 875 ms
...
 
../builds/shade.r618316.P.VPlock/bin/java -Xem:server QSort
VALUE_PROF.lockStrategy=FLAG
Iteration 0, elapsed: 10703 ms
Iteration 1, elapsed: 875 ms
Iteration 2, elapsed: 890 ms
...

Egor, can you review the patch?

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568105#action_12568105 ] 

Aleksey Shipilev commented on HARMONY-5396:
-------------------------------------------

> I think, this is enough to prove that we can move on with the current precision 
Egor, the thing is, lack of accurate profiling can cause _intermittent_ performance degradations, which we wouldn't quickly notice. That's the price we would pay for speed of startup, and then we should resort to inaccurate profiling only in case of startup-important workloads. I think precise (e.g. locked) profiling should reside as default.

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568158#action_12568158 ] 

Egor Pasko commented on HARMONY-5396:
-------------------------------------

Aleksey, I know that performance can break all assumptions :)

I am going to implement+commit the legacy locking on Thursday. OK? ;)

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566966#action_12566966 ] 

Egor Pasko commented on HARMONY-5396:
-------------------------------------

OK, I just need to fix the flag to be a member of ValueMethodProfile.

on the nopping:

since it looks like a VM helper call with parameters is a big chunk of code, actually my idea is to make a jump over the call, that is how we can make it atomic, fast and not bother with calling conventions. There are 2 ways to do this:
1. make a conditional jump during the code generation, then patch the condition
2. patch the address, where VM helper begins (not sure we can, I am not a guru in x86 asm:)

DrlEMImpl.h has an interface to notify a JIT that profile is ready:
void (*profile_notification_callback)(JIT_Handle, PC_Handle, Method_Handle);

(interface was introduced in HARMONY-4875)

not a trivial thing, I would prefer to move the discussion to the mailing list

on failing:

I prefer to fail when settings are incorrect, or at least give a warning, otherwise it is not easy to figure out why your configuration changes did not produce any effect (a mere misprint can cost you an hour of debugging)

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568101#action_12568101 ] 

Egor Pasko commented on HARMONY-5396:
-------------------------------------

Pavel, on your precision concern: Aleksey already checked effect on SPECjbb2005. Quoting:

--
I had measured two modes: (a) locks eliminated completely, (b) addNewValue
is locked only on insertion of new value into the table.

SPECjbb2005: no boost/degradation for overall score, (a) +10% score
improvement for 1st warehouse, (b) +9% score improvement for 1st
warehouse.
--

variant (b) is the current default. I think, this is enough to prove that we can move on with the current precision

On the question whether we need so many profiling options. I still did not see any benchmarks sensitive to the choice of locking strategy. But for some reason I believe there are real cases where locking strategy choice is important. So, I cannot decide what to choose. I left the options where they are to make some experiments. I am OK to remove redundant ones as soon as they are proven redundant.

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Egor Pasko updated HARMONY-5396:
--------------------------------

    Attachment: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt

patch:
0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt

refactors the stuff to separate different strategies of value profiler. That helps because different locking strategies might be applied for both methods. Also improved readability a bit.

runs smoke tests in server mode smoothly on linux/x86. Introduces extra 2 virtual calls for each addNewValue, but I believe that won't slow anything down. 

would be great if somebody reviewed it this week, especially would be glad to see input from Aleksey Shipilev, Yuri Kashnikov, Mikhail Fursov.

thanks



> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568134#action_12568134 ] 

Aleksey Shipilev commented on HARMONY-5396:
-------------------------------------------

Egor, performance is such kind of stuff where assumptions are not always welcome :) 
Fine, let's implement legacy locking mode and enable it in server_aggressive.

Thanks!

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Aleksey Shipilev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566513#action_12566513 ] 

Aleksey Shipilev commented on HARMONY-5396:
-------------------------------------------

Egor, the change looks good. AFAIU, there are no performance optimizations yet.

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568587#action_12568587 ] 

Egor Pasko commented on HARMONY-5396:
-------------------------------------

4. I think we cannot commit (3) before M5 due to the in-progress state of the feature freeze :) (agreed with Pavel, all modes are interesting)

5. Pavel I just tried to apply the same logic to TNV_DIVIDED as you applied for LOCKED, FLAGGED, etc. (i.e. from your words "My understanding on the dev list was that we experiment with the startegies and choose 1-2 best to commit"), looks like I misunderstood that TNV_DIVIDED is the "2" in "1-2 best" :)

propagating updateStrategy to TNV_DIVIDED seems like not so trivial, I did not think about it yet. IMHO, it makes sense to check TNV_DIVIDED on a server benchmark (server_aggressive mode) first, and if id gives no benefit, drop the idea of improving updateStrategy  as redundant for a while.

I am not in a hurry, we can first implement (3.c) then check all the stuff we have. Sounds good?

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0004-value-profiling-reviving-locked-profile.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568171#action_12568171 ] 

Egor Pasko commented on HARMONY-5396:
-------------------------------------

BTW, I also thought about atomic increment (lock prefix), this should be somewhat faster than a mutex, but, unfortunately, not yet implemented in port_atomic.h

what do you think?

> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5396) [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571928#action_12571928 ] 

Egor Pasko commented on HARMONY-5396:
-------------------------------------

Aleksey,

in fact I proposed something (slightly) different:
lock add [eax], 1
this solution avoids cmpxcg (see patch 0006-... for details)

complete GCC inline assembly from the patch:
INLINE void port_atomic_inc32(volatile uint32 * data)
{
#if defined(_IA32_) || defined(_EM64T_)
    __asm__ __volatile__(
        "lock addl $1, (%1)"
        : "=m" (*data) /* output */
        : "r" (data) /* input */
        : "memory"
    );
#elif
    ABORT("Not supported");
#endif
}

On windows it should look like:
INLINE void port_atomic_inc32(volatile uint32 * data)
{
    __asm {
        mov eax,  data
        lock add [eax], 1
    }
}

I do not have a handy windows machine to verify, sorry.


> [drlvm][em] excess ValueProfiler locking causes degradation on JITted code with profiling
> -----------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5396
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5396
>             Project: Harmony
>          Issue Type: Improvement
>          Components: DRLVM
>            Reporter: Aleksey Shipilev
>            Assignee: Egor Pasko
>         Attachments: 0001-ValueProfileCollector-refactoring-to-separate-FirstN-and-Divided-methods.txt, 0002-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0002-ValueProfileCollector-implementing-locking-strategies.txt, 0003-value-profiling-options-locked-flagged_all-flagged_insert-unsafe.txt, 0004-value-profiling-reviving-locked-profile.txt, 0005-volatile-fix.txt, 0006-ATOMIC_INC-strategy-linux-only.txt, HARMONY-5396-syncTie.patch
>
>
> During investigation of serious slowdown in some microbenchmark, excess locking in ValueProfiler was identified. 
> Please see Harmony-dev thread for the details: http://markmail.org/message/tatsfbyb7eb3q3rr

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.