Commit e46742f5 authored by Sergei Trofimovich's avatar Sergei Trofimovich

rts: fix threadStackUnderflow type in cmm

stg_stack_underflow_frame had an incorrect
call of C function 'threadStackUnderflow':
    ("ptr" ret_off) =
      foreign "C" threadStackUnderflow(
        MyCapability(),
        CurrentTSO);

Which means it's prototype is:
    void * (*) (W_, void*);
While real prototype is:
    W_ (*) (Capability *cap, StgTSO *tso);

The fix is simple. Fix type annotations:
    (ret_off) =
      foreign "C" threadStackUnderflow(
        MyCapability() "ptr",
        CurrentTSO "ptr");

Noticed when debugged T9045 test failure
on m68k target which distincts between
pointer and non pointer return types
(uses different registers)

While at it noticed and fixed return types
for 'throwTo' and 'findSpark'.

Trac #11395
Signed-off-by: default avatarSergei Trofimovich <siarheit@google.com>
parent 2f45cf3f
......@@ -307,7 +307,7 @@ stg_killThreadzh (P_ target, P_ exception)
} else {
W_ msg;
(msg) = ccall throwTo(MyCapability() "ptr",
("ptr" msg) = ccall throwTo(MyCapability() "ptr",
CurrentTSO "ptr",
target "ptr",
exception "ptr");
......
......@@ -2344,7 +2344,7 @@ stg_getSparkzh ()
#ifndef THREADED_RTS
return (0,ghczmprim_GHCziTypes_False_closure);
#else
(spark) = ccall findSpark(MyCapability());
("ptr" spark) = ccall findSpark(MyCapability() "ptr");
if (spark != 0) {
return (1,spark);
} else {
......
......@@ -32,8 +32,8 @@ INFO_TABLE_RET (stg_stack_underflow_frame, UNDERFLOW_FRAME,
SAVE_STGREGS
SAVE_THREAD_STATE();
("ptr" ret_off) = foreign "C" threadStackUnderflow(MyCapability(),
CurrentTSO);
(ret_off) = foreign "C" threadStackUnderflow(MyCapability() "ptr",
CurrentTSO);
LOAD_THREAD_STATE();
RESTORE_STGREGS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment