Skip to content

Instantly share code, notes, and snippets.

🖤

Shao Cheng TerrorJack

🖤
Block or report user

Report or block TerrorJack

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@TerrorJack
TerrorJack / sem.mjs
Created Aug 6, 2019
Async JavaScript Semaphores
View sem.mjs
function semSetPromise(sem) {
delete sem.promise;
delete sem.resolve;
sem.promise = new Promise(resolve => {
if (sem.left) {
--sem.left;
resolve();
} else {
sem.resolve = resolve;
}
@TerrorJack
TerrorJack / Pool.hs
Created Aug 2, 2019
Memory pool backed by ghc storage manager
View Pool.hs
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
module Pool
( Pool
, newPool
, freePool
, pooledMallocBytes
, pooledReallocBytes
, pooledFree
View ghc-submodule-remove.sh
#!/bin/sh -e
git rm --cached libraries/binary
rm -rf libraries/binary/.git
git add libraries/binary
git rm --cached libraries/bytestring
rm -rf libraries/bytestring/.git
git add libraries/bytestring
@TerrorJack
TerrorJack / channel.mjs
Last active Aug 7, 2019
Async JavaScript Channels
View channel.mjs
function newThunk(f) {
let t = () => {
const r = f();
t = () => r;
return r;
};
return () => t();
}
function newNode() {
View test.txt
asterius ghc-testsuite
test/ghc-testsuite/ado/ado-optimal.hs
test/ghc-testsuite/ado/ado-optimal.hs: FAIL (9.63s)
uncaught exception: EvalException
EvalException {evalErrorMessage = "wasm-003b2ee6:1620\n\n\n\nRuntimeError: unreachable\n at prettyzm1zi1zi3zi6zm5t2Wzzuijam22NUf3MpOoWu_TextziPrettyPrintziAnnotatedziHughesPJ_.LcoSm (wasm-function[1619]:244)\n at scheduleWaitThread (wasm-function[1889]:196)\n at rts_evalLazyIO (wasm-function[1856]:27)\n at main (wasm-function[1508]:12)\n at evalmachine.<anonymous>:1:43\n at Script.runInContext (<anonymous>)\n at Script.runInContext (vm.js:134:20)\n at Proxy.runInContext (vm.js:297:6)\n at Worker.<anonymous> (file:///mnt/c/Users/Think/Documents/Haskell/asterius/.stack-work/install/x86_64-linux/ghc-8.9/8.9.20190403/share/x86_64-linux-ghc-8.9.20190403/inline-js-core-0.0.1/jsbits/eval.mjs:71:32)\n at Worker.emit (events.js:196:13)"}
test/ghc-testsuite/ado/ado001.hs
test/ghc-testsuite/ado
View test.hs
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
{-# OPTIONS_GHC -Wall -O2 -fforce-recomp -ddump-to-file -ddump-simpl -ddump-stg -ddump-cmm-raw -ddump-asm #-}
import GHC.Exts
import GHC.Types
main :: IO ()
main = do
r <-
View bytearray.hs
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
{-# OPTIONS_GHC
-Wall -ddump-to-file -ddump-simpl -ddump-stg -ddump-cmm-raw -ddump-asm #-}
import Control.Monad
import Data.Foldable
import GHC.Exts
import GHC.Types
View th.txt
[ ahc-iserv] discardCtrlC
[ ahc-iserv] msg: InitLinker
[ ahc-iserv] writing pipe: ()
[ ahc-iserv] reading pipe...
[ ahc-iserv] discardCtrlC
[ ahc-iserv] msg: AddLibrarySearchPath "/mnt/c/Users/Think/Documents/Haskell/asterius/.stack-work/install/x86_64-linux/ghc-8.9/8.9.20190403/share/x86_64-linux-ghc-8.9.20190403/asterius-0.0.1/.boot/asterius_lib/lib/x86_64-linux-ghc-8.9.20190403/ghc-prim-0.6.1-CvTX6v5U4yP8bNy4kMDeHL"
[ ahc-iserv] writing pipe: RemotePtr 0
[ ahc-iserv] reading pipe...
[ ahc-iserv] discardCtrlC
[ ahc-iserv] msg: LoadArchive "/mnt/c/Users/Think/Documents/Haskell/asterius/.stack-work/install/x86_64-linux/ghc-8.9/8.9.20190403/share/x86_64-linux-ghc-8.9.20190403/asterius-0.0.1/.boot/asterius_lib/lib/x86_64-linux-ghc-8.9.20190403/ghc-prim-0.6.1-CvTX6v5U4yP8bNy4kMDeHL/libHSghc-prim-0.6.1-CvTX6v5U4yP8bNy4kMDeHL.a"
View ahc-ld.prof
This file has been truncated, but you can view the full file.
Sun Mar 24 14:57 2019 Time and Allocation Profiling Report (Final)
ahc-ld +RTS -p -RTS @/tmp/ghc3268_0/ghc_10.rsp
total time = 31.35 secs (31354 ticks @ 1000 us, 1 processor)
total alloc = 56,677,062,712 bytes (excludes profiling overheads)
COST CENTRE MODULE SRC %time %alloc
View gist:a4a249294ce43cde7d068fff6c90ce40
App
(App
(Var
(Var
"templatezmhaskell_LanguageziHaskellziTHziLibziInternal_sigE"))
(App
(App
(App
(Var
(Var
You can’t perform that action at this time.