NonMoving: Implement -xns to disable selector optimization wip/gc/shortcutting
authorÖmer Sinan Ağacan <omeragacan@gmail.com>
Thu, 16 May 2019 13:28:32 +0000 (16:28 +0300)
committerBen Gamari <ben@smart-cactus.org>
Tue, 22 Oct 2019 16:20:15 +0000 (12:20 -0400)
includes/rts/Flags.h
rts/RtsFlags.c
rts/sm/NonMovingMark.c

index 9a039fd..f27ce23 100644 (file)
@@ -52,7 +52,9 @@ typedef struct _GC_FLAGS {
     double  oldGenFactor;
     double  pcFreeHeap;
 
-    bool         useNonmoving;
+    bool         useNonmoving; // default = false
+    bool         nonmovingSelectorOpt; // Do selector optimization in the
+                                       // non-moving heap, default = false
     uint32_t     generations;
     bool squeezeUpdFrames;
 
index c606d86..0e28b98 100644 (file)
@@ -157,6 +157,7 @@ void initRtsFlagsDefaults(void)
     RtsFlags.GcFlags.pcFreeHeap         = 3;    /* 3% */
     RtsFlags.GcFlags.oldGenFactor       = 2;
     RtsFlags.GcFlags.useNonmoving       = false;
+    RtsFlags.GcFlags.nonmovingSelectorOpt = false;
     RtsFlags.GcFlags.generations        = 2;
     RtsFlags.GcFlags.squeezeUpdFrames   = true;
     RtsFlags.GcFlags.compact            = false;
@@ -1542,6 +1543,10 @@ error = true;
                     OPTION_SAFE;
                     RtsFlags.GcFlags.useNonmoving = true;
                     unchecked_arg_start++;
+                    if (rts_argv[arg][3] == 's') {
+                        RtsFlags.GcFlags.nonmovingSelectorOpt = true;
+                        unchecked_arg_start++;
+                    }
                     break;
 
                 case 'c': /* Debugging tool: show current cost centre on
index 846c02b..59db431 100644 (file)
@@ -1455,7 +1455,11 @@ mark_closure (MarkQueue *queue, const StgClosure *p0, StgClosure **origin)
     }
 
     case THUNK_SELECTOR:
-        nonmoving_eval_thunk_selector(queue, (StgSelector*)p, origin);
+        if (RtsFlags.GcFlags.nonmovingSelectorOpt) {
+            nonmoving_eval_thunk_selector(queue, (StgSelector*)p, origin);
+        } else {
+            PUSH_FIELD((StgSelector *) p, selectee);
+        }
         break;
 
     case AP_STACK: {