diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2018-11-16 13:52:11 +0300 |
---|---|---|
committer | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2018-11-16 13:52:33 +0300 |
commit | a50a59a9603425fafb1fac33addb201c19546808 (patch) | |
tree | 228f87fd6e76edf2ec62a402324e47577ab0ed03 /rts/StaticPtrTable.c | |
parent | 4efd1b487e10c8cdbc1bca10c45f0887642a5c48 (diff) | |
download | haskell-a50a59a9603425fafb1fac33addb201c19546808.tar.gz |
More efficient, non-allocating unsafeLookupStaticPtr
We now allocate the key to spt on C stack rather than in Haskell heap,
avoiding allocating in `unsafeLookupStaticPtr`. This should be slightly
more efficient.
Test Plan: Validated locally
Reviewers: simonmar, hvr, bgamari, erikd
Reviewed By: simonmar
Subscribers: rwbarton, carter
Differential Revision: https://phabricator.haskell.org/D5333
Diffstat (limited to 'rts/StaticPtrTable.c')
-rw-r--r-- | rts/StaticPtrTable.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/rts/StaticPtrTable.c b/rts/StaticPtrTable.c index 0b2244025e..997987a2ce 100644 --- a/rts/StaticPtrTable.c +++ b/rts/StaticPtrTable.c @@ -76,9 +76,10 @@ void hs_spt_remove(StgWord64 key[2]) { } } -StgPtr hs_spt_lookup(StgWord64 key[2]) { +StgPtr hs_spt_lookup(StgWord64 key1, StgWord64 key2) { if (spt) { ACQUIRE_LOCK(&spt_lock); + StgWord64 key[2] = { key1, key2 }; const StgStablePtr * entry = lookupHashTable(spt, (StgWord)key); const StgPtr ret = entry ? deRefStablePtr(*entry) : NULL; RELEASE_LOCK(&spt_lock); |