Commit 33d3527b authored by Facundo Domínguez's avatar Facundo Domínguez
Browse files

Protect StablPtr dereference with the StaticPtr table lock.

Summary: Also comment on the need to use stgMallocBytes in StaticPtrTable.c.

Test Plan: ./validate

Reviewers: erikd, austin, bgamari, simonmar

Reviewed By: simonmar

Subscribers: thomie

Differential Revision:
parent 36bba475
......@@ -43,6 +43,9 @@ void hs_spt_insert(StgWord64 key[2],void *spe_closure) {
// Cannot remove this indirection yet because getStablePtr()
// might return NULL, in which case hs_spt_lookup() returns NULL
// instead of the actual closure pointer.
StgStablePtr * entry = stgMallocBytes( sizeof(StgStablePtr)
, "hs_spt_insert: entry"
......@@ -72,8 +75,8 @@ StgPtr hs_spt_lookup(StgWord64 key[2]) {
if (spt) {
const StgStablePtr * entry = lookupHashTable(spt, (StgWord)key);
const StgPtr ret = entry ? deRefStablePtr(*entry) : NULL;
return ret;
} else
return NULL;
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