summaryrefslogtreecommitdiff
path: root/rts/Interpreter.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2015-11-07 09:39:05 +0000
committerSimon Marlow <marlowsd@gmail.com>2015-11-07 09:39:05 +0000
commitce1f1607ed7f8fedd2f63c8610cafefd59baaf32 (patch)
tree718641160c3d93a2ca974deec1e228cb09e1a97e /rts/Interpreter.c
parenta58eeb7febd67c93dab82de7049ef1dcdecd34e9 (diff)
downloadhaskell-ce1f1607ed7f8fedd2f63c8610cafefd59baaf32.tar.gz
Make GHCi & TH work when the compiler is built with -prof
Summary: Amazingly, there were zero changes to the byte code generator and very few changes to the interpreter - mainly because we've used good abstractions that hide the differences between profiling and non-profiling. So that bit was pleasantly straightforward, but there were a pile of other wibbles to get the whole test suite through. Note that a compiler built with -prof is now like one built with -dynamic, in that to use TH you have to build the code the same way. For dynamic, we automatically enable -dynamic-too when TH is required, but we don't have anything equivalent for profiling, so you have to explicitly use -prof when building code that uses TH with a profiled compiler. For this reason Cabal won't work with TH. We don't expect to ship a profiled compiler, so I think that's OK. Test Plan: validate with GhcProfiled=YES in validate.mk Reviewers: goldfire, bgamari, rwbarton, austin, hvr, erikd, ezyang Reviewed By: ezyang Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1407 GHC Trac Issues: #4837, #545
Diffstat (limited to 'rts/Interpreter.c')
-rw-r--r--rts/Interpreter.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/rts/Interpreter.c b/rts/Interpreter.c
index 573e4991f7..3ad3bc6d5b 100644
--- a/rts/Interpreter.c
+++ b/rts/Interpreter.c
@@ -340,6 +340,8 @@ eval_obj:
RETURN_TO_SCHEDULER(ThreadInterpret, StackOverflow);
}
+ ENTER_CCS_THUNK(cap,ap);
+
/* Ok; we're safe. Party on. Push an update frame. */
Sp -= sizeofW(StgUpdateFrame);
{
@@ -529,7 +531,7 @@ do_return_unboxed:
// get the offset of the stg_ctoi_ret_XXX itbl
offset = stack_frame_sizeW((StgClosure *)Sp);
- switch (get_itbl((StgClosure *)Sp+offset)->type) {
+ switch (get_itbl((StgClosure*)((StgPtr)Sp+offset))->type) {
case RET_BCO:
// Returning to an interpreted continuation: put the object on
@@ -883,7 +885,7 @@ run_BCO:
// the BCO
size_words = BCO_BITMAP_SIZE(obj) + 2;
new_aps = (StgAP_STACK *) allocate(cap, AP_STACK_sizeW(size_words));
- SET_HDR(new_aps,&stg_AP_STACK_info,CCS_SYSTEM);
+ SET_HDR(new_aps,&stg_AP_STACK_info,cap->r.rCCCS);
new_aps->size = size_words;
new_aps->fun = &stg_dummy_ret_closure;
@@ -1098,7 +1100,7 @@ run_BCO:
ap = (StgAP*)allocate(cap, AP_sizeW(n_payload));
Sp[-1] = (W_)ap;
ap->n_args = n_payload;
- SET_HDR(ap, &stg_AP_info, CCS_SYSTEM/*ToDo*/)
+ SET_HDR(ap, &stg_AP_info, cap->r.rCCCS)
Sp --;
goto nextInsn;
}
@@ -1109,7 +1111,7 @@ run_BCO:
ap = (StgAP*)allocate(cap, AP_sizeW(n_payload));
Sp[-1] = (W_)ap;
ap->n_args = n_payload;
- SET_HDR(ap, &stg_AP_NOUPD_info, CCS_SYSTEM/*ToDo*/)
+ SET_HDR(ap, &stg_AP_NOUPD_info, cap->r.rCCCS)
Sp --;
goto nextInsn;
}
@@ -1122,7 +1124,7 @@ run_BCO:
Sp[-1] = (W_)pap;
pap->n_args = n_payload;
pap->arity = arity;
- SET_HDR(pap, &stg_PAP_info, CCS_SYSTEM/*ToDo*/)
+ SET_HDR(pap, &stg_PAP_info, cap->r.rCCCS)
Sp --;
goto nextInsn;
}
@@ -1192,7 +1194,7 @@ run_BCO:
itbl->layout.payload.nptrs );
StgClosure* con = (StgClosure*)allocate_NONUPD(cap,request);
ASSERT( itbl->layout.payload.ptrs + itbl->layout.payload.nptrs > 0);
- SET_HDR(con, (StgInfoTable*)BCO_LIT(o_itbl), CCS_SYSTEM/*ToDo*/);
+ SET_HDR(con, (StgInfoTable*)BCO_LIT(o_itbl), cap->r.rCCCS);
for (i = 0; i < n_words; i++) {
con->payload[i] = (StgClosure*)Sp[i];
}