Commit a307ad56 authored by Simon Marlow's avatar Simon Marlow

small optimisation: inline stmNewTVar()

parent 811a19c9
......@@ -631,7 +631,10 @@ main(int argc, char *argv[])
closure_field(StgTVarWatchQueue, next_queue_entry);
closure_field(StgTVarWatchQueue, prev_queue_entry);
closure_size(StgTVar);
closure_field(StgTVar, current_value);
closure_field(StgTVar, first_watch_queue_entry);
closure_field(StgTVar, num_updates);
closure_size(StgWeak);
closure_field(StgWeak,link);
......
......@@ -1062,8 +1062,15 @@ stg_newTVarzh (P_ init)
{
W_ tv;
MAYBE_GC_P (stg_newTVarzh, init);
("ptr" tv) = ccall stmNewTVar(MyCapability() "ptr", init "ptr");
ALLOC_PRIM_P (SIZEOF_StgTVar, stg_newTVarzh, init);
tv = Hp - SIZEOF_StgTVar + WDS(1);
SET_HDR (tv, stg_TVAR_info, CCCS);
StgTVar_current_value(tv) = init;
StgTVar_first_watch_queue_entry(tv) = stg_END_STM_WATCH_QUEUE_closure;
StgTVar_num_updates(tv) = 0;
return (tv);
}
......
......@@ -1648,18 +1648,3 @@ void stmWriteTVar(Capability *cap,
}
/*......................................................................*/
StgTVar *stmNewTVar(Capability *cap,
StgClosure *new_value) {
StgTVar *result;
result = (StgTVar *)allocate(cap, sizeofW(StgTVar));
SET_HDR (result, &stg_TVAR_info, CCS_SYSTEM);
result -> current_value = new_value;
result -> first_watch_queue_entry = END_STM_WATCH_QUEUE;
#if defined(THREADED_RTS)
result -> num_updates = 0;
#endif
return result;
}
/*......................................................................*/
......@@ -181,14 +181,6 @@ void stmWaitUnlock(Capability *cap, StgTRecHeader *trec);
StgBool stmReWait(Capability *cap, StgTSO *tso);
/*----------------------------------------------------------------------
TVar management operations
--------------------------
*/
StgTVar *stmNewTVar(Capability *cap, StgClosure *new_value);
/*----------------------------------------------------------------------
Data access operations
......
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