diff options
Diffstat (limited to 'rts/adjustor/LibffiAdjustor.c')
-rw-r--r-- | rts/adjustor/LibffiAdjustor.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/rts/adjustor/LibffiAdjustor.c b/rts/adjustor/LibffiAdjustor.c index b74059b8ce..e24a4a12f7 100644 --- a/rts/adjustor/LibffiAdjustor.c +++ b/rts/adjustor/LibffiAdjustor.c @@ -9,6 +9,7 @@ #include "StablePtr.h" #include "sm/Storage.h" #include "Hash.h" +#include "Adjustor.h" #include "ffi.h" #include <string.h> @@ -16,6 +17,10 @@ /* Maps AdjustorExecutable* to AdjustorWritable*. */ static HashTable* allocatedExecs; +void initAdjustors() { + allocatedExecs = allocHashTable(); +} + static AdjustorWritable allocate_adjustor(AdjustorExecutable *exec_ret) { AdjustorWritable writ; @@ -24,9 +29,6 @@ static AdjustorWritable allocate_adjustor(AdjustorExecutable *exec_ret) ACQUIRE_SM_LOCK; cl = writ = ffi_closure_alloc(sizeof(ffi_closure), exec_ret); if (cl != NULL) { - if (allocatedExecs == NULL) { - allocatedExecs = allocHashTable(); - } insertHashTable(allocatedExecs, (StgWord)*exec_ret, writ); } RELEASE_SM_LOCK; @@ -37,8 +39,7 @@ static AdjustorWritable exec_to_writable(AdjustorExecutable exec) { AdjustorWritable writ; ACQUIRE_SM_LOCK; - if (allocatedExecs == NULL || - (writ = lookupHashTable(allocatedExecs, (StgWord)exec)) == NULL) { + if ((writ = lookupHashTable(allocatedExecs, (StgWord)exec)) == NULL) { RELEASE_SM_LOCK; barf("exec_to_writable: not found"); } |