harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject svn commit: r627320 - in /harmony/enhanced/drlvm/trunk/vm: em/src/ jitrino/config/em64t/ jitrino/config/ia32/
Date Wed, 13 Feb 2008 09:17:03 GMT
Author: egor
Date: Wed Feb 13 01:17:02 2008
New Revision: 627320

URL: http://svn.apache.org/viewvc?rev=627320&view=rev
Log:
applying patch from HARMONY-5396 [drlvm][em] excess ValueProfiler locking causes
degradation on JITted code with profiling:

 0004-value-profiling-reviving-locked-profile.txt
(with minor changes: formatting and comments)

this is a fix for server_aggressive mode that now crashes, removing the crash
and reviving the same locking strategy


Modified:
    harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp
    harmony/enhanced/drlvm/trunk/vm/em/src/NValueProfileCollector.cpp
    harmony/enhanced/drlvm/trunk/vm/em/src/NValueProfileCollector.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf
    harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server_aggressive.emconf

Modified: harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp?rev=627320&r1=627319&r2=627320&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/em/src/DrlEMImpl.cpp Wed Feb 13 01:17:02 2008
@@ -655,6 +655,8 @@
             updateStrategy = UPDATE_FLAGGED_INSERT;
         }else if (strategy == "UNSAFE") {
             updateStrategy = UPDATE_UNSAFE;
+        }else if (strategy == "LOCKED_INSERT") {
+            updateStrategy = UPDATE_LOCKED_INSERT;
         }else if (strategy != "LOCKED") {
             LECHO(10, "EM: unsupported value profiler updateStrategy");
             return NULL;

Modified: harmony/enhanced/drlvm/trunk/vm/em/src/NValueProfileCollector.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/em/src/NValueProfileCollector.cpp?rev=627320&r1=627319&r2=627320&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/em/src/NValueProfileCollector.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/em/src/NValueProfileCollector.cpp Wed Feb 13 01:17:02
2008
@@ -171,7 +171,9 @@
             VPData* instProfile, ValueT curr_value)
 {
     uint8* updating_ptr = methProfile->getUpdatingStatePtr();
-    if (updateStrategy == UPDATE_FLAGGED_ALL) {
+    if (updateStrategy == UPDATE_LOCKED) {
+        methProfile->lockProfile();
+    } else if (updateStrategy == UPDATE_FLAGGED_ALL) {
         // Checking a flag and modifying it atomically must be faster than
         // locking because it skips simultaneous updates. Faster but sacrifices
         // profile precision.
@@ -183,10 +185,11 @@
     ValueT* last_value = &(instProfile->last_value);
     uint32* num_times_profiled = &(instProfile->num_times_profiled);
     if (curr_value == *last_value){
-        // We increment the counter safely only with UPDATE_FLAGGED_ALL
+        // We increment the counter safely with UPDATE_FLAGGED_ALL and
+        // UPDATE_LOCKED
         (*num_times_profiled)++;
     } else {
-        if (updateStrategy == UPDATE_LOCKED) {
+        if (updateStrategy == UPDATE_LOCKED_INSERT) {
             methProfile->lockProfile();
         }else if (updateStrategy == UPDATE_FLAGGED_INSERT) {
             if (port_atomic_cas8(updating_ptr, 1, 0) != 0) {
@@ -199,14 +202,16 @@
         *num_times_profiled = 1;
         insert(steady_part, clear_part, curr_value, *num_times_profiled);
         *last_value = curr_value;
-        if (updateStrategy == UPDATE_LOCKED) {
+        if (updateStrategy == UPDATE_LOCKED_INSERT) {
             methProfile->unlockProfile();
         }else if (updateStrategy == UPDATE_FLAGGED_INSERT) {
             *updating_ptr = 0;
         }
     }
     UNSAFE_REGION_END
-    if (updateStrategy == UPDATE_FLAGGED_ALL) {
+    if (updateStrategy == UPDATE_LOCKED) {
+        methProfile->unlockProfile();
+    } else if (updateStrategy == UPDATE_FLAGGED_ALL) {
         *updating_ptr = 0;
     }
 }

Modified: harmony/enhanced/drlvm/trunk/vm/em/src/NValueProfileCollector.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/em/src/NValueProfileCollector.h?rev=627320&r1=627319&r2=627320&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/em/src/NValueProfileCollector.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/em/src/NValueProfileCollector.h Wed Feb 13 01:17:02 2008
@@ -44,10 +44,14 @@
 
 enum ProfileUpdateStrategy {
 
+    // Lock when modifying the TNV table, even trivial counter increments.
+    // This mode is only one that guarantees accurate profiling.
+    UPDATE_LOCKED,
+
     // Lock when restructuring the TNV table (inserting). Trivial counter
     // increments might not be locked (in current implementation they are not
     // locked for FirstN table management only)
-    UPDATE_LOCKED,
+    UPDATE_LOCKED_INSERT,
 
     // When a new value is added to TNV all simultaneous updates to the table
     // are skipped

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf?rev=627320&r1=627319&r2=627320&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/em64t/server.emconf Wed Feb 13 01:17:02
2008
@@ -43,7 +43,7 @@
 
 VALUE_PROF.profilerType=VALUE_PROFILER
 VALUE_PROF.vpalgo=TNV_FIRST_N
-VALUE_PROF.updateStrategy=LOCKED
+VALUE_PROF.updateStrategy=LOCKED_INSERT
 VALUE_PROF.vpSteadySize=4
 SD1_OPT.genProfile=EDGE_PROF,VALUE_PROF
 SD2_OPT.useProfile=EDGE_PROF,VALUE_PROF

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf?rev=627320&r1=627319&r2=627320&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server.emconf Wed Feb 13 01:17:02
2008
@@ -43,7 +43,7 @@
 
 VALUE_PROF.profilerType=VALUE_PROFILER
 VALUE_PROF.vpalgo=TNV_FIRST_N
-VALUE_PROF.updateStrategy=LOCKED
+VALUE_PROF.updateStrategy=LOCKED_INSERT
 VALUE_PROF.vpSteadySize=4
 SD1_OPT.genProfile=EDGE_PROF,VALUE_PROF
 SD2_OPT.useProfile=EDGE_PROF,VALUE_PROF

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server_aggressive.emconf
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server_aggressive.emconf?rev=627320&r1=627319&r2=627320&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server_aggressive.emconf (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/config/ia32/server_aggressive.emconf Wed Feb 13
01:17:02 2008
@@ -34,6 +34,7 @@
 
 VALUE_PROF.profilerType=VALUE_PROFILER
 VALUE_PROF.vpalgo=TNV_FIRST_N
+VALUE_PROF.updateStrategy=LOCKED
 VALUE_PROF.vpSteadySize=4
 SD1_OPT.genProfile=EDGE_PROF,VALUE_PROF
 SD2_OPT.useProfile=EDGE_PROF,VALUE_PROF



Mime
View raw message