[Git][ghc/ghc][wip/js-staging] Enable RTS args filtering (cf cgrun025)

Sylvain Henry (@hsyl20) gitlab at gitlab.haskell.org
Fri Aug 26 08:12:23 UTC 2022



Sylvain Henry pushed to branch wip/js-staging at Glasgow Haskell Compiler / GHC


Commits:
6e8d292b by Sylvain Henry at 2022-08-26T10:14:41+02:00
Enable RTS args filtering (cf cgrun025)

- - - - -


1 changed file:

- js/environment.js.pp


Changes:

=====================================
js/environment.js.pp
=====================================
@@ -90,6 +90,47 @@ if(h$isNode) {
 }
 #endif
 
+//filter RTS arguments
+var h$rtsArgs = [];
+{
+    var prog_args = [];
+    var rts_args = [];
+    var in_rts = false;
+    var i = 0;
+    for(i=0;i<h$programArgs.length;i++) {
+        var a = h$programArgs[i];
+        // The '--RTS' argument disables all future
+        // +RTS ... -RTS processing.
+        if (a === "--RTS") {
+            break;
+        }
+        // The '--' argument is passed through to the program, but
+        // disables all further +RTS ... -RTS processing.
+        else if (a === "--") {
+            break;
+        }
+        else if (a === "+RTS") {
+            in_rts = true;
+        }
+        else if (a === "-RTS") {
+            in_rts = false;
+        }
+        else if (in_rts) {
+            rts_args.push(a);
+        }
+        else {
+            prog_args.push(a);
+        }
+    }
+    // process remaining program arguments
+    for (;i<h$programArgs.length;i++) {
+        prog_args.push(h$programArgs[i]);
+    }
+    //set global variables
+    h$programArgs = prog_args;
+    h$rtsArgs     = rts_args;
+}
+
 function h$getProgArgv(argc_v,argc_off,argv_v,argv_off) {
   TRACE_ENV("getProgArgV");
   var c = h$programArgs.length;



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6e8d292b596f719e66fd6c8f5dddda5701ba7c1e

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6e8d292b596f719e66fd6c8f5dddda5701ba7c1e
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20220826/3115030e/attachment-0001.html>


More information about the ghc-commits mailing list