File tree Expand file tree Collapse file tree
src/main/java/org/codehaus/groovy/vmplugin/v8 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5353public class IndyInterface {
5454 private static final long INDY_OPTIMIZE_THRESHOLD = SystemUtil .getLongSafe ("groovy.indy.optimize.threshold" , 10_000L );
5555 private static final long INDY_FALLBACK_THRESHOLD = SystemUtil .getLongSafe ("groovy.indy.fallback.threshold" , 10_000L );
56+ /**
57+ * Initial capacity for the call site registry used to track all active call sites
58+ * for cache invalidation when metaclass changes occur. The default of 1024 balances
59+ * memory usage against resize overhead. Tune via {@code groovy.indy.callsite.initial.capacity}
60+ * system property for larger applications.
61+ */
62+ private static final int INDY_CALLSITE_INITIAL_CAPACITY = SystemUtil .getIntegerSafe ("groovy.indy.callsite.initial.capacity" , 1024 );
5663
5764 /**
5865 * flags for method and property calls
@@ -176,7 +183,7 @@ public static CallType fromCallSiteName(String callSiteName) {
176183 * Weak set of all CacheableCallSites. Used to invalidate caches when metaclass changes.
177184 * Uses WeakReferences so call sites can be garbage collected when no longer referenced.
178185 */
179- private static final Set <WeakReference <CacheableCallSite >> ALL_CALL_SITES = ConcurrentHashMap .newKeySet ();
186+ private static final Set <WeakReference <CacheableCallSite >> ALL_CALL_SITES = ConcurrentHashMap .newKeySet (INDY_CALLSITE_INITIAL_CAPACITY );
180187
181188 static {
182189 GroovySystem .getMetaClassRegistry ().addMetaClassRegistryChangeEventListener (cmcu -> invalidateSwitchPoints ());
You can’t perform that action at this time.
0 commit comments