Re: How to use the compact regions API to write a compact to a file?

2020-05-22 Thread Shao, Cheng
Hi Matthew, It's possible to use Data.Compact.Serialize to write a compact to a file or read it back. Directly serializing via ByteStrings has also been discussed before, see link below. Hope this helps! https://hackage.haskell.org/package/compact https://github.com/ezyang/compact/issues/3 On Fr

Blocking MVar# primops not performing stack checks?

2020-02-26 Thread Shao, Cheng
Hi all, When an MVar# primop blocks, it jumps to a function in HeapStackCheck.cmm which pushes a RET_SMALL stack frame before returning to the scheduler (e.g. the takeMVar# primop jumps to stg_block_takemvar for stack adjustment). But these functions directly bump Sp without checking for possible

Re: How to turn LHExpr GhcPs into CoreExpr

2020-01-23 Thread Shao, Cheng
How about using `hscCompileCoreExprHook` to intercept the `CoreExpr` from the ghci pipeline? There exist GHC API to evaluate a String to a ForeignHValue iirc; we are not interested in the final ForeignHValue in this case, we just want the CoreExpr, and the logic of generating and linking BCO can be

Re: ByteArray# as a foreign import argument?

2019-10-10 Thread Shao, Cheng
u, Oct 10, 2019 at 8:54 PM Csaba Hruska wrote: >> >> It's a primitive type. >> https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/prelude/primops.txt.pp#L1388 >> https://gitlab.haskell.org/ghc/ghc/wikis/commentary/prim-ops >> >> Cheers, >>

ByteArray# as a foreign import argument?

2019-10-10 Thread Shao, Cheng
Hello devs, I've been trying to figure out how to pass lifted types as foreign types, then encountered the following code in the `DsCCall` module (https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/deSugar/DsCCall.hs#L172): ``` -- Byte-arrays, both mutable and otherwise; hack warning --

Cmm code of `id` function referring to `breakpoint`?

2019-02-05 Thread Shao, Cheng
: 0, upd: 8; } base_GHCziBase_breakpoint_entry() // [R2] { [] } {offset chvW: // global R1 = R2; call stg_ap_0_fast(R1) args: 8, res: 0, upd: 8; } ``` This looks suspicious. I'm curious if this is intended behavior of ghc. Reg

Re: MutVar# and GC

2019-01-17 Thread Shao, Cheng
Hi, I believe it's mentioned here: https://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/GC/RememberedSets Regards, Shao Cheng On Fri, Jan 18, 2019, 12:34 PM chessai . wrote: > Ryan, > > That makes perfect sense, thanks. Is that documented explicitly anywhere? > If

Re: GHC (API?) question: GHC Core for Base libraries

2018-12-04 Thread Shao, Cheng
Indeed, the boot.sh script is likely what you are looking for. To compile `base` and retrieve Core for it, you just need to set up an empty package database, use the Setup.hs script in base to compile it, and load your plugin via "--ghc-option=.." provided to `Setup configure`. On Wed, Dec 5, 2018

Re: GHC (API?) question: GHC Core for Base libraries

2018-12-03 Thread Shao, Cheng
Hi, Joachim Breitner's veggies(https://github.com/nomeata/veggies) project is a good example of using a vanilla ghc installation to compile standard libraries like base. On Tue, Dec 4, 2018, 10:11 AM Bill Hallahan wrote: > Hi, > > I'm writing a program analyzer that operates on GHC Core. Curre

Re: Does it sound a good idea to implement "backend plugins"?

2018-10-04 Thread Shao, Cheng
it isn't supposed to be a home plugin to be compiled and used on the fly. A typical use case would be compiling/installing the plugin to a standalone pkgdb, then used to compile other packages. > > On 5 Oct 2018, at 1:52 AM, Shao, Cheng wrote: > > Adding "pluggable bac

Re: Does it sound a good idea to implement "backend plugins"?

2018-10-04 Thread Shao, Cheng
g works via a pile of hacks upon hacks in ghc-toolkit, and it's not good for reuse. * The newly added backend plugins shouldn't have visible correctness/performance impact if they're not used, and it's just a few local modifications in the ghc codebase. > On Thu, Oct 4, 201

Does it sound a good idea to implement "backend plugins"?

2018-10-04 Thread Shao, Cheng
feature. Best, Shao Cheng ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Re: cc1plus.exe of bundled mingw-w64 segfaults

2018-09-02 Thread Shao, Cheng
other library to link, or something else has gone wrong? Thank you. __ On Sun, Sep 2, 2018 at 10:06 PM, Shao, Cheng wrote: > Hi folks, > > I'm building a Haskell/C++ hybrid project with a recent revision of > ghc on Windows, and noticed that cc1plus.exe always segfaults. The >

cc1plus.exe of bundled mingw-w64 segfaults

2018-09-02 Thread Shao, Cheng
ll version/urls when configuring ghc? I notice there's an "--enable-distro-toolchain" flag, does it work with building a bindist? Thank you. Regards, Shao Cheng ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Re: Non-Reinstallable packages

2018-08-06 Thread Shao, Cheng
Hi, IIRC those packages can be "reinstalled", just build & register into a fresh package database and add it to the pkgdb stack, ghc can shadow the ones in the global pkgdb. Regards, Shao Cheng On Tue, Aug 7, 2018 at 10:39 AM, Moritz Angermann wrote: > Dear friends, > &g

Re: Proposal: Professionalizing GHC Development

2018-04-01 Thread Shao, Cheng
Compiling GHC on a blockchain may not be economical, but running GHC-compiled programs on a blockchain is definitely a great idea! I've even come up with a paper title: A Secure Decentralized Transactional Implementation of Spinless Tagless G-machine, aka Haskoin! Time to recruiting a few engineer

Re: Windows

2018-03-26 Thread Shao, Cheng
ing that I should run “C:\msys64\msys2_shell.cmd -mingw64 > -mintty" just once, after installing? Or repeatedly? Or that I should > somehow us it as my main shell? And what does that commend actually do? > > Sorry to be dense > > > > Simon > > > > *From:* g

Re: Windows

2018-03-26 Thread Shao, Cheng
Hi Simon, If the build environment is managed by an MSYS2 installation, then the MinGW64 shell startup script automatically sets up "MSYSTEM" for you. It can be launched like "C:\msys64\msys2_shell.cmd -mingw64 -mintty". On Mon, Mar 26, 2018 at 5:46 PM, Simon Peyton Jones via ghc-devs < ghc-devs@

Is "cml_cont" of CmmCall used in practice?

2018-03-17 Thread Shao, Cheng
Hi all, Is the "cml_cont" field of the CmmCall variant is really used in practice? I traversed the output of raw Cmm produced by ghc compiling the whole base package, but the value of cml_cont is always Nothing. Regards, Shao Cheng ___ ghc-de

Custom ghcPrimIface for cross-compilation?

2018-03-15 Thread Shao Cheng
Hi all, is it possible for a 64-bit ghc to emit 32-bit code, if I supply a custom ghcPrimIface via Hooks and also modify the platform flags in DynFlags? The module does not import Prelude and has no dependencies other than GHC.Prim. ___ ghc-devs mailing l

Re: Extracting representation from GHC

2018-01-19 Thread Shao Cheng
Hi, IIRC you can already use hscFrontendHook in the DynFlags hooks to retrieve TcGblEnv, and with a little bit of work, also HsParsedModule. Regards, Shao Cheng On Fri, Jan 19, 2018, 5:41 PM Matthew Pickering wrote: > I have too wanted this in the past and made a post to a similar effect &

Re: Re: Re-compiling wired-in packages

2017-04-25 Thread Shao Cheng
t produce error, and it is properly registered by ghc-pkg, so I've no idea why there's a bad interface file. Do you have any ideas on possible causes? Thanks a lot. Greetings, Shao Cheng ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Re-compiling wired-in packages

2017-04-24 Thread Shao Cheng
their STG/Cmm representations? Thank a lot. Cheers, Shao Cheng ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs