diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2019-01-10 11:55:25 +0300 |
---|---|---|
committer | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2019-01-12 10:11:19 +0300 |
commit | 74cd4ec5d2f9321aad5db3285cb60d78f2562996 (patch) | |
tree | 8c2cec2852dd719a97edf8a8345ea4f84277bda7 /rts | |
parent | cb2349a4233d6bdef2d7090853397e6278a7378c (diff) | |
download | haskell-74cd4ec5d2f9321aad5db3285cb60d78f2562996.tar.gz |
Fix raiseAsync() UNDERFLOW_FRAME handling in profiling runtime
UNDERFLOW_FRAMEs don't have profiling headers so we have to use the
AP_STACK's function's CCS as the new frame's CCS.
Fixes one of the many bugs caught by concprog001 (#15508).
Diffstat (limited to 'rts')
-rw-r--r-- | rts/RaiseAsync.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/rts/RaiseAsync.c b/rts/RaiseAsync.c index 72f5dff7f6..f58f9177c8 100644 --- a/rts/RaiseAsync.c +++ b/rts/RaiseAsync.c @@ -93,7 +93,7 @@ suspendComputation (Capability *cap, StgTSO *tso, StgUpdateFrame *stop_here) throwTo(). Note [Throw to self when masked] - + When a StackOverflow occurs when the thread is masked, we want to defer the exception to when the thread becomes unmasked/hits an interruptible point. We already have a mechanism for doing this, @@ -103,26 +103,26 @@ suspendComputation (Capability *cap, StgTSO *tso, StgUpdateFrame *stop_here) multithreaded nonsense). Morally, a stack overflow should be an asynchronous exception sent by a thread to itself, and it should have the same semantics. But there are a few key differences: - + - If you actually tried to send an asynchronous exception to yourself using throwTo, the exception would actually immediately be delivered. This is because throwTo itself is considered an interruptible point, so the exception is always deliverable. Thus, ordinarily, we never end up with a message to oneself in the blocked_exceptions queue. - + - In the case of a StackOverflow, we don't actually care about the wakeup semantics; when an exception is delivered, the thread that originally threw the exception should be woken up, since throwTo blocks until the exception is successfully thrown. Fortunately, it is harmless to wakeup a thread that doesn't actually need waking up, e.g. ourselves. - + - No synchronization is necessary, because we own the TSO and the capability. You can observe this by tracing through the execution of throwTo. We skip synchronizing the message and inter-capability communication. - + We think this doesn't break any invariants, but do be careful! -------------------------------------------------------------------------- */ @@ -921,8 +921,7 @@ raiseAsync(Capability *cap, StgTSO *tso, StgClosure *exception, ap->payload[i] = (StgClosure *)*sp++; } - SET_HDR(ap,&stg_AP_STACK_NOUPD_info, - ((StgClosure *)frame)->header.prof.ccs /* ToDo */); + SET_HDR(ap,&stg_AP_STACK_NOUPD_info,stack->header.prof.ccs); TICK_ALLOC_SE_THK(WDS(words+1),0); stack->sp = sp; |