Skip to content

Commit

Permalink
[jvm] Fix off-by-one in multi cache
Browse files Browse the repository at this point in the history
  • Loading branch information
usev6 committed Dec 9, 2017
1 parent 47db26d commit 7eaebf5
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -96,9 +96,12 @@ public void add(CallCaptureInstance capture, SixModelObject result, ThreadContex
if (numArgs >= MD_CACHE_MAX_ARITY)
return;

/* The zero arity case was handled above.
* At index 0 we have the cache for arity 1 */
ArityCache ac = this.arityCaches[numArgs - 1];

/* If the cache is saturated, don't do anything (we could instead do a random
* replacement). */
ArityCache ac = this.arityCaches[numArgs];
if (ac != null && ac.numEntries == MD_CACHE_MAX_ENTRIES)
return;

Expand Down

0 comments on commit 7eaebf5

Please sign in to comment.