Re: Confused about PAP object layout

2020-02-14 Thread Simon Marlow
On Fri, 14 Feb 2020 at 11:49, Ömer Sinan Ağacan wrote: > Hi Simon, > > In this code: (slightly simplified) > > StgPtr > scavenge_PAP (StgPAP *pap) > { > evacuate(>fun); > return scavenge_PAP_payload (pap->fun, pap->payload, pap->n_args); > } > > StgPtr >

Confused about PAP object layout

2020-02-14 Thread Ömer Sinan Ağacan
Hi Simon, In this code: (slightly simplified) StgPtr scavenge_PAP (StgPAP *pap) { evacuate(>fun); return scavenge_PAP_payload (pap->fun, pap->payload, pap->n_args); } StgPtr scavenge_PAP_payload (StgClosure *fun, StgClosure **payload, StgWord size) {

Re: Confused about PAP object layout

2020-02-14 Thread Ömer Sinan Ağacan
Right, I think that's the problem. We then pass the same "size" to scavenge_large_bitmap as the size of the bitmap. So we assume size of the bitmap is pap->n_args. So the call stack is - scavenge_PAP, calls scavenge_PAP_payload with pap->n_args as "size" - scavenge_PAP_payload, calls

Re: GHC 8.6.5 now works on SmartOS - Was: GHC 8.8.2 + cabal-install 3.0.0 finally working on SmartOS x64 20200117 (yet GHC 8.6.5 left less usable)

2020-02-14 Thread Ben Gamari
Compl Yue via ghc-devs writes: > I verified that the problem in GHC 8.6.5 can be solved by backporting > merge request 87, a patch as well as the build steps have been updated > at https://gitlab.haskell.org/complyue/smart-ghc8, enjoy! > Great work figuring out the issue! Thanks for your work

Re: Confused about PAP object layout

2020-02-14 Thread Ömer Sinan Ağacan
I think that makes sense, with the invariant that n_args <= bitmap_size. We evacuate the arguments used by the function but not others. Thanks. It's somewhat weird to see an object with useful stuff, then garbage, then useful stuff again in the heap, but that's not an issue by itself. For example

Re: Confused about PAP object layout

2020-02-14 Thread Ben Gamari
Ömer Sinan Ağacan writes: > Right, I think that's the problem. We then pass the same "size" to > scavenge_large_bitmap as the size of the bitmap. So we assume size of the > bitmap > is pap->n_args. > > So the call stack is > > - scavenge_PAP, calls scavenge_PAP_payload with pap->n_args as

Re: Confused about PAP object layout

2020-02-14 Thread Ben Gamari
Ömer Sinan Ağacan writes: > I think that makes sense, with the invariant that n_args <= bitmap_size. We > evacuate the arguments used by the function but not others. Thanks. > > It's somewhat weird to see an object with useful stuff, then garbage, then > useful stuff again in the heap, but

Calling an unknown function from low-level Cmm

2020-02-14 Thread Alexis King
Hi all, I’m trying to understand how to properly call an unknown function from low-level Cmm code. If I’m just applying a function to a state token, it’s easy; I can just do R1 = io; jump stg_ap_v_fast [R1]; since the calling convention is consistent in that case. But what if my

Re: Confused about PAP object layout

2020-02-14 Thread Alexis King
Disclaimer: I am not an expert. But I happened to have been looking at this code just yesterday, so I’ll try to answer to check my understanding. :) Fundamentally, a PAP is not fully-saturated, so the number of arguments in its payload may be smaller than the information contained in the