[Git][ghc/ghc][wip/js-staging] 2 commits: Doc: minor changes
Sylvain Henry (@hsyl20)
gitlab at gitlab.haskell.org
Thu Aug 25 13:31:07 UTC 2022
Sylvain Henry pushed to branch wip/js-staging at Glasgow Haskell Compiler / GHC
Commits:
ae77f624 by Sylvain Henry at 2022-08-25T15:32:26+02:00
Doc: minor changes
- - - - -
9e2d99d8 by Sylvain Henry at 2022-08-25T15:33:26+02:00
Add debug option to watch for insertion of undefined/null in the stack
- - - - -
3 changed files:
- compiler/GHC/StgToJS/Closure.hs
- compiler/GHC/StgToJS/Types.hs
- js/thread.js.pp
Changes:
=====================================
compiler/GHC/StgToJS/Closure.hs
=====================================
@@ -61,9 +61,9 @@ setObjInfoL debug obj rs layout t n a
= setObjInfo debug obj t n field_types a size rs
where
size = case layout of
- CILayoutVariable -> (-1)
- CILayoutUnknown size -> size
- CILayoutFixed size _ -> size
+ CILayoutVariable -> (-1)
+ CILayoutUnknown sz -> sz
+ CILayoutFixed sz _ -> sz
field_types = case layout of
CILayoutVariable -> []
CILayoutUnknown size -> toTypeList (replicate size ObjV)
=====================================
compiler/GHC/StgToJS/Types.hs
=====================================
@@ -77,7 +77,7 @@ data StgToJSConfig = StgToJSConfig
data ClosureInfo = ClosureInfo
{ ciVar :: FastString -- ^ object being infod
- , ciRegs :: CIRegs -- ^ things in registers when this is the next closure to enter
+ , ciRegs :: CIRegs -- ^ size of the payload (in number of JS values)
, ciName :: FastString -- ^ friendly name for printing
, ciLayout :: CILayout -- ^ heap/stack layout of the object
, ciType :: CIType -- ^ type of the object, with extra info where required
=====================================
js/thread.js.pp
=====================================
@@ -20,6 +20,9 @@
#define GHCJS_BUSY_YIELD 500
#endif
+// Watch for insertion of null or undefined in the stack
+//#define GHCJS_DEBUG_STACK
+
#ifdef GHCJS_TRACE_SCHEDULER
function h$logSched() { if(arguments.length == 1) {
if(h$currentThread != null) {
@@ -66,6 +69,18 @@ function h$Thread() {
this.tid = ++h$threadIdN;
this.status = THREAD_RUNNING;
this.stack = [h$done, 0, h$baseZCGHCziConcziSynczireportError, h$catch_e];
+#ifdef GHCJS_DEBUG_STACK
+ this.stack = new Proxy(this.stack, {
+ set(obj,prop,value) {
+ if (value === undefined || value === null) {
+ throw new Error("setting stack offset " + prop + " to " + value);
+ }
+ else {
+ return Reflect.set(...arguments);
+ }
+ }
+ });
+#endif
this.sp = 3;
this.mask = 0; // async exceptions masked (0 unmasked, 1: uninterruptible, 2: interruptible)
this.interruptible = false; // currently in an interruptible operation
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6202f5ffb567740d073731fa61baa9baf56e2bc7...9e2d99d800d76d69c64a251803ff3dd96c62b21e
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6202f5ffb567740d073731fa61baa9baf56e2bc7...9e2d99d800d76d69c64a251803ff3dd96c62b21e
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/20220825/2db106e2/attachment-0001.html>
More information about the ghc-commits
mailing list