[Git][ghc/ghc][master] JS: clean up some foreign imports

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Sat Nov 18 11:53:59 UTC 2023



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


Commits:
faff671a by Luite Stegeman at 2023-11-17T14:12:51+01:00
JS: clean up some foreign imports

- - - - -


7 changed files:

- libraries/base/src/GHC/JS/Foreign/Callback.hs
- libraries/base/src/GHC/JS/Prim.hs
- libraries/base/src/GHC/JS/Prim/Internal.hs
- libraries/base/src/System/Posix/Internals.hs
- + rts/js/config.js
- rts/js/thread.js
- rts/rts.cabal


Changes:

=====================================
libraries/base/src/GHC/JS/Foreign/Callback.hs
=====================================
@@ -145,5 +145,5 @@ foreign import javascript unsafe "(($1, $2) => { return h$makeCallbackApply($1,
 foreign import javascript unsafe "(($1, $2) => { return h$makeCallbackApply($1, h$runSyncReturn, [false], $2); })"
   js_syncCallbackApplyReturn :: Int -> Exts.Any -> IO (Callback b)
 
-foreign import javascript unsafe "(($1) => { return h$release($1); })"
+foreign import javascript unsafe "h$release"
   js_release :: Callback a -> IO ()


=====================================
libraries/base/src/GHC/JS/Prim.hs
=====================================
@@ -259,16 +259,16 @@ seqList xs = go xs `seq` xs
   where go (y:ys) = y `seq` go ys
         go []     = ()
 
-foreign import javascript unsafe "(($1) => { return h$toHsString($1); })"
+foreign import javascript unsafe "h$toHsString"
   js_fromJSString :: JSVal -> Exts.Any
 
-foreign import javascript unsafe "(($1) => { return h$fromHsString($1); })"
+foreign import javascript unsafe "h$fromHsString"
   js_toJSString :: Exts.Any -> JSVal
 
-foreign import javascript unsafe "(($1) => { return h$toHsListJSVal($1); })"
+foreign import javascript unsafe "h$toHsListJSVal"
   js_fromJSArray :: JSVal -> IO Exts.Any
 
-foreign import javascript unsafe "(($1) => { return h$fromHsListJSVal($1); })"
+foreign import javascript unsafe "h$fromHsListJSVal"
   js_toJSArray :: Exts.Any -> IO JSVal
 
 foreign import javascript unsafe "(($1) => { return ($1 === null); })"


=====================================
libraries/base/src/GHC/JS/Prim/Internal.hs
=====================================
@@ -43,14 +43,14 @@ foreign import javascript unsafe
   js_setCurrentThreadResultWouldBlock :: IO ()
 
 foreign import javascript unsafe
-  "(($1) => { return h$setCurrentThreadResultJSException($1); })"
+  "h$setCurrentThreadResultJSException"
   js_setCurrentThreadResultJSException :: JSVal -> IO ()
 
 foreign import javascript unsafe
-  "(($1) => { return h$setCurrentThreadResultHaskellException($1); })"
+  "h$setCurrentThreadResultHaskellException"
   js_setCurrentThreadResultHaskellException :: JSVal -> IO ()
 
 foreign import javascript unsafe
-  "(($1) => { return h$setCurrentThreadResultValue($1); })"
+  "h$setCurrentThreadResultValue"
   js_setCurrentThreadResultValue :: JSVal -> IO ()
 


=====================================
libraries/base/src/System/Posix/Internals.hs
=====================================
@@ -504,7 +504,7 @@ foreign import ccall unsafe "HsBase.h __hscore_lstat"
 
 #if defined(javascript_HOST_ARCH)
 
-foreign import javascript unsafe "(() => { return rts_isThreaded; })" rtsIsThreaded_ :: Int
+foreign import javascript unsafe "h$rts_isThreaded" rtsIsThreaded_ :: Int
 foreign import javascript interruptible "h$base_access"
     c_access :: CString -> CInt -> IO CInt
 foreign import javascript interruptible "h$base_chmod"


=====================================
rts/js/config.js
=====================================
@@ -0,0 +1,21 @@
+function h$rts_isThreaded() {
+  return 0;
+}
+  
+function h$rts_isTracing() {
+  return 0;
+}
+
+function h$rts_isDynamic() {
+  return 0;
+}
+
+function h$rts_isDebugged() {
+  return 0;
+}
+
+function h$rts_isProfiled() {
+  return 0;
+}
+
+  
\ No newline at end of file


=====================================
rts/js/thread.js
=====================================
@@ -1460,5 +1460,3 @@ function h$makeMVarListener(mv, stopProp, stopImmProp, preventDefault) {
 function h$rs() {
   return h$stack[h$sp];
 }
-
-const rts_isThreaded = 0;


=====================================
rts/rts.cabal
=====================================
@@ -99,6 +99,7 @@ library
       c-sources: version.c
 
       js-sources:
+        js/config.js
         js/structs.js
         js/arith.js
         js/compact.js



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/faff671a7786202bff39fa0cdf41e4518fb11c4b
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/20231118/50554cfb/attachment-0001.html>


More information about the ghc-commits mailing list