[Git][ghc/ghc][master] compiler: Cross-reference Note [StgToJS design]

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu Jun 15 07:10:42 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
8f27023b by Ben Gamari at 2023-06-15T03:10:24-04:00
compiler: Cross-reference Note [StgToJS design]

In particular, the numeric representations are quite useful context in a
few places.

- - - - -


2 changed files:

- compiler/GHC/StgToJS/Prim.hs
- rts/js/arith.js


Changes:

=====================================
compiler/GHC/StgToJS/Prim.hs
=====================================
@@ -56,6 +56,9 @@ genPrim prof bound ty op = case op of
 
 ------------------------------ Int ----------------------------------------------
 
+-- N.B. See Note [StgToJS design] in GHC.StgToJS for details on
+-- number representation.
+
   IntAddOp        -> \[r] [x,y] -> PrimInline $ r |= toI32 (Add x y)
   IntSubOp        -> \[r] [x,y] -> PrimInline $ r |= toI32 (Sub x y)
   IntMulOp        -> \[r] [x,y] -> PrimInline $ r |= app "Math.imul" [x, y]


=====================================
rts/js/arith.js
=====================================
@@ -21,6 +21,12 @@ function h$logArith() { h$log.apply(h$log,arguments); }
 #define RETURN_W64(x) RETURN_UBX_TUP2(W64h(x), W64l(x))
 #define RETURN_W32(x) return Number(x)
 
+
+// N.B. 64-bit numbers are represented by two JS numbers,
+// each of which can represent a 32-bit integer precisely.
+// See Note [StgToJS design] in GHC.StgToJS for details on
+// number representation.
+
 function h$hs_quotWord64(h1,l1,h2,l2) {
   var a = W64(h1,l1);
   var b = W64(h2,l2);



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8f27023b1f465e44ea02e1b6ac7b7b04c632cc5e

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8f27023b1f465e44ea02e1b6ac7b7b04c632cc5e
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/20230615/aac69f67/attachment-0001.html>


More information about the ghc-commits mailing list