[Git][ghc/ghc][wip/T22010] Move JS unique globals from RTS to compiler

Jaro Reinders (@Noughtmare) gitlab at gitlab.haskell.org
Fri Jun 23 08:28:35 UTC 2023



Jaro Reinders pushed to branch wip/T22010 at Glasgow Haskell Compiler / GHC


Commits:
4a4086ec by Jaro Reinders at 2023-06-23T10:28:29+02:00
Move JS unique globals from RTS to compiler

- - - - -


2 changed files:

- compiler/jsbits/genSym.js
- rts/js/globals.js


Changes:

=====================================
compiler/jsbits/genSym.js
=====================================
@@ -5,6 +5,17 @@
 #define HIGH_UNIQUE_BITS (32 - UNIQUE_TAG_BITS)
 #define HIGH_UNIQUE_MASK ((1 << HIGH_UNIQUE_BITS) - 1)
 
+// The 'ghc_unique_inc' and 'ghc_unique_counter64' are in the native RTS. It allows them to be
+// shared with plugins even if two different instances of the GHC library are
+// loaded at the same time (#19940)
+// However, cross compilers do not support plugins so we have moved these globals back
+// into the compiler.
+var h$ghc_unique_inc       = h$newByteArray(4);
+h$ghc_unique_inc.i3[0]     = 1;
+var h$ghc_unique_counter64   = h$newByteArray(8);
+h$ghc_unique_counter64.i3[0] = 0;
+h$ghc_unique_counter64.i3[1] = 0;
+
 function genSym() {
   var rl = h$hs_plusWord64(h$ghc_unique_counter64.i3[1] >>> 0, h$ghc_unique_counter64.i3[0] >>> 0, 0, h$ghc_unique_inc.i3[0] >>> 0);
   h$ret1 = (h$ret1 & HIGH_UNIQUE_MASK) >>> 0;


=====================================
rts/js/globals.js
=====================================
@@ -16,10 +16,4 @@
 GVAR(h$getOrSetLibHSghcGlobalHasPprDebug, has_ppr_debug)
 GVAR(h$getOrSetLibHSghcGlobalHasNoDebugOutput, has_no_debug_output)
 GVAR(h$getOrSetLibHSghcGlobalHasNoStateHack, has_no_state_hack)
-GVAR(h$getOrSetLibHSghcFastStringTable, faststring_table)
-
-var h$ghc_unique_inc       = h$newByteArray(4);
-h$ghc_unique_inc.i3[0]     = 1;
-var h$ghc_unique_counter64   = h$newByteArray(8);
-h$ghc_unique_counter64.i3[0] = 0;
-h$ghc_unique_counter64.i3[1] = 0;
+GVAR(h$getOrSetLibHSghcFastStringTable, faststring_table)
\ No newline at end of file



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4a4086ecc16098551ab1cba5d14b80a71c632a3a

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4a4086ecc16098551ab1cba5d14b80a71c632a3a
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/20230623/5ca99d60/attachment-0001.html>


More information about the ghc-commits mailing list