src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Fri Feb  5 19:16:59 2016
--- new/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Fri Feb  5 19:16:59 2016

*** 776,787 **** --- 776,800 ---- wrapper = newTarget; // no need for a counting wrapper anymore } return (asTypeCache = wrapper); } + // Customize target if counting happens for too long. + private int invocations = CUSTOMIZE_THRESHOLD; + private void maybeCustomizeTarget() { + int c = invocations; + if (c >= 0) { + if (c == 1) { + target.customize(); + } + invocations = c - 1; + } + } + boolean countDown() { int c = count; + maybeCustomizeTarget(); if (c <= 1) { // Try to limit number of updates. MethodHandle.updateForm() doesn't guarantee LF update visibility. if (isCounting) { isCounting = false; return true;

src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File