The tso->block_info field is now overwritten by pushOnRunQueue(), but
stg_block_async_info was assuming that it still held a pointer to the
StgAsyncIOResult. We must therefore save this value somewhere safe
before putting the TSO on the run queue.
-INFO_TABLE_RET( stg_block_async, RET_SMALL )
+INFO_TABLE_RET( stg_block_async, RET_SMALL, W_ unused )
- ares = StgTSO_block_info(CurrentTSO);
len = StgAsyncIOResult_len(ares);
errC = StgAsyncIOResult_errCode(ares);
len = StgAsyncIOResult_len(ares);
errC = StgAsyncIOResult_errCode(ares);
- StgTSO_block_info(CurrentTSO) = NULL;
foreign "C" free(ares "ptr");
R1 = len;
foreign "C" free(ares "ptr");
R1 = len;
Sp(0) = errC;
jump %ENTRY_CODE(Sp(1));
}
stg_block_async
{
Sp(0) = errC;
jump %ENTRY_CODE(Sp(1));
}
stg_block_async
{
Sp(0) = stg_block_async_info;
BLOCK_GENERIC;
}
Sp(0) = stg_block_async_info;
BLOCK_GENERIC;
}
/* Used by threadDelay implementation; it would be desirable to get rid of
* this free()'ing void return continuation.
*/
/* Used by threadDelay implementation; it would be desirable to get rid of
* this free()'ing void return continuation.
*/
-INFO_TABLE_RET( stg_block_async_void, RET_SMALL )
+INFO_TABLE_RET( stg_block_async_void, RET_SMALL, W_ ares )
- ares = StgTSO_block_info(CurrentTSO);
- StgTSO_block_info(CurrentTSO) = NULL;
foreign "C" free(ares "ptr");
foreign "C" free(ares "ptr");
jump %ENTRY_CODE(Sp(0));
}
stg_block_async_void
{
jump %ENTRY_CODE(Sp(0));
}
stg_block_async_void
{
Sp(0) = stg_block_async_void_info;
BLOCK_GENERIC;
}
Sp(0) = stg_block_async_void_info;
BLOCK_GENERIC;
}
/* Terminates the run queue + this inner for-loop. */
tso->_link = END_TSO_QUEUE;
tso->why_blocked = NotBlocked;
/* Terminates the run queue + this inner for-loop. */
tso->_link = END_TSO_QUEUE;
tso->why_blocked = NotBlocked;
+ // save the StgAsyncIOResult in the
+ // stg_block_async_info stack frame, because
+ // the block_info field will be overwritten by
+ // pushOnRunQueue().
+ tso->sp[1] = (W_)tso->block_info.async_result;
pushOnRunQueue(&MainCapability, tso);
break;
}
pushOnRunQueue(&MainCapability, tso);
break;
}