src/share/classes/java/lang/invoke/MethodHandleNatives.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/share/classes/java/lang/invoke/MethodHandleNatives.java	Sat Mar 22 02:03:09 2014
--- new/src/share/classes/java/lang/invoke/MethodHandleNatives.java	Sat Mar 22 02:03:09 2014

*** 76,86 **** --- 76,86 ---- registerNatives(); COUNT_GWT = getConstant(Constants.GC_COUNT_GWT) != 0; // The JVM calls MethodHandleNatives.<clinit>. Cascade the <clinit> calls as needed: MethodHandleImpl.initStatics(); ! } // All compile-time constants go here. // There is an opportunity to check them against the JVM's idea of them. static class Constants { Constants() { } // static only
*** 291,300 **** --- 291,311 ---- Object[] appendixResult) { MethodHandle bootstrapMethod = (MethodHandle)bootstrapMethodObj; Class<?> caller = (Class<?>)callerObj; String name = nameObj.toString().intern(); MethodType type = (MethodType)typeObj; + if (!TRACE_METHOD_LINKAGE) + return linkCallSiteImpl(caller, bootstrapMethod, name, type, + staticArguments, appendixResult); + return linkCallSiteTracing(caller, bootstrapMethod, name, type, + staticArguments, appendixResult); + } + static MemberName linkCallSiteImpl(Class<?> caller, + MethodHandle bootstrapMethod, + String name, MethodType type, + Object staticArguments, + Object[] appendixResult) { CallSite callSite = CallSite.makeSite(bootstrapMethod, name, type, staticArguments, caller);
*** 304,313 **** --- 315,348 ---- } else { appendixResult[0] = callSite; return Invokers.linkToCallSiteMethod(type); } } + // Tracing logic: + static MemberName linkCallSiteTracing(Class<?> caller, + MethodHandle bootstrapMethod, + String name, MethodType type, + Object staticArguments, + Object[] appendixResult) { + Object bsmReference = bootstrapMethod.internalMemberName(); + if (bsmReference == null) bsmReference = bootstrapMethod; + Object staticArglist = (staticArguments instanceof Object[] ? + java.util.Arrays.asList((Object[]) staticArguments) : + staticArguments); + System.out.println("linkCallSite "+caller.getName()+" "+ + bsmReference+" "+ + name+type+"/"+staticArglist); + try { + MemberName res = linkCallSiteImpl(caller, bootstrapMethod, name, type, + staticArguments, appendixResult); + System.out.println("linkCallSite => "+res+" + "+appendixResult[0]); + return res; + } catch (Throwable ex) { + System.out.println("linkCallSite => throw "+ex); + throw ex; + } + } /** * The JVM wants a pointer to a MethodType. Oblige it by finding or creating one. */ static MethodType findMethodHandleType(Class<?> rtype, Class<?>[] ptypes) {

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