Skip to content

Instantly share code, notes, and snippets.

@bdw
Created July 22, 2014 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdw/69c277a8aed133cfe6ba to your computer and use it in GitHub Desktop.
Save bdw/69c277a8aed133cfe6ba to your computer and use it in GitHub Desktop.
MVMMultiCache diff
diff --git a/3rdparty/dyncall b/3rdparty/dyncall
--- a/3rdparty/dyncall
+++ b/3rdparty/dyncall
@@ -1 +1 @@
-Subproject commit 5c4e85c290756b84eb55c9ed97f550555bcdc29d
+Subproject commit 5c4e85c290756b84eb55c9ed97f550555bcdc29d-dirty
diff --git a/src/6model/reprs/MVMMultiCache.c b/src/6model/reprs/MVMMultiCache.c
index bc93e3b..d1a84fd 100644
--- a/src/6model/reprs/MVMMultiCache.c
+++ b/src/6model/reprs/MVMMultiCache.c
@@ -127,7 +127,9 @@ MVMObject * MVM_multi_cache_add(MVMThreadContext *tc, MVMObject *cache_obj, MVMO
/* If it's zero arity, just stick it in that slot. */
if (num_args == 0) {
- MVM_ASSIGN_REF(tc, &(cache_obj->header), cache->zero_arity, result);
+ /* bail if has nameds */
+ if (!has_nameds)
+ MVM_ASSIGN_REF(tc, &(cache_obj->header), cache->zero_arity, result);
return cache_obj;
}
@@ -217,8 +219,8 @@ MVMObject * MVM_multi_cache_find(MVMThreadContext *tc, MVMObject *cache_obj, MVM
}
/* If it's zero-arity, return result right off. */
- if (num_args == 0 && !has_nameds)
- return cache->zero_arity;
+ if (num_args == 0)
+ return has_nameds ? NULL : cache->zero_arity;
/* If there's more args than the maximum, won't be in the cache. */
if (num_args > MVM_MULTICACHE_MAX_ARITY)
@@ -295,8 +297,8 @@ MVMObject * MVM_multi_cache_find_callsite_args(MVMThreadContext *tc, MVMObject *
has_nameds = cs->arg_count != cs->num_pos;
/* If it's zero-arity, return result right off. */
- if (num_args == 0 && !has_nameds)
- return cache->zero_arity;
+ if (num_args == 0)
+ return has_nameds ? NULL : cache->zero_arity;
/* If there's more args than the maximum, won't be in the cache. */
if (num_args > MVM_MULTICACHE_MAX_ARITY)
@@ -371,8 +373,8 @@ MVMObject * MVM_multi_cache_find_spesh(MVMThreadContext *tc, MVMObject *cache_ob
has_nameds = arg_info->cs->arg_count != arg_info->cs->num_pos;
/* If it's zero-arity, return result right off. */
- if (num_args == 0 && !has_nameds)
- return cache->zero_arity;
+ if (num_args == 0)
+ return has_nameds ? NULL : cache->zero_arity;
/* If there's more args than the maximum, won't be in the cache. Also
* check against maximum size of spesh call site. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment