[Git][ghc/ghc][wip/T22010] Add genSym.js
Jaro Reinders (@Noughtmare)
gitlab at gitlab.haskell.org
Fri Jun 23 08:10:01 UTC 2023
Jaro Reinders pushed to branch wip/T22010 at Glasgow Haskell Compiler / GHC
Commits:
2bd06da6 by Jaro Reinders at 2023-06-23T10:09:49+02:00
Add genSym.js
- - - - -
2 changed files:
- compiler/ghc.cabal.in
- + compiler/jsbits/genSym.js
Changes:
=====================================
compiler/ghc.cabal.in
=====================================
@@ -160,6 +160,9 @@ Library
cbits/cutils.c
cbits/genSym.c
cbits/keepCAFsForGHCi.c
+
+ js-sources:
+ jsbits/genSym.js
hs-source-dirs:
.
=====================================
compiler/jsbits/genSym.js
=====================================
@@ -0,0 +1,15 @@
+//#OPTIONS: CPP
+#include "Unique.h"
+
+// We assume that the unique tag occupies less than 32 bits (should be safe)
+#define HIGH_UNIQUE_BITS (32 - UNIQUE_TAG_BITS)
+#define HIGH_UNIQUE_MASK ((1 << HIGH_UNIQUE_BITS) - 1)
+
+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;
+ // h$ret1 contains the higher part (rh)
+ h$ghc_unique_counter64.i3[0] = rl | 0;
+ h$ghc_unique_counter64.i3[1] = h$ret1 | 0;
+ return rl; // h$ret1 still contains rh
+}
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2bd06da6eced0c0f4eb6135dbd2eee0061c88a04
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2bd06da6eced0c0f4eb6135dbd2eee0061c88a04
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/0a630ff3/attachment-0001.html>
More information about the ghc-commits
mailing list