src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java

Print this page

        

*** 136,146 **** ListBuffer<ClassSymbol> innerClassesQueue; /** The bootstrap methods to be written in the corresponding class attribute * (one for each invokedynamic) */ ! Map<DynamicMethod, MethodHandle> bootstrapMethods; /** The log to use for verbose output. */ private final Log log; --- 136,146 ---- ListBuffer<ClassSymbol> innerClassesQueue; /** The bootstrap methods to be written in the corresponding class attribute * (one for each invokedynamic) */ ! Map<DynamicMethodSymbol, MethodHandle> bootstrapMethods; /** The log to use for verbose output. */ private final Log log;
*** 400,410 **** } else { //invokedynamic DynamicMethodSymbol dynSym = (DynamicMethodSymbol)m; MethodHandle handle = new MethodHandle(dynSym.bsmKind, dynSym.bsm, types); DynamicMethod dynMeth = new DynamicMethod(dynSym, types); ! bootstrapMethods.put(dynMeth, handle); //init cp entries pool.put(names.BootstrapMethods); pool.put(handle); for (Object staticArg : dynSym.staticArgs) { pool.put(staticArg); --- 400,410 ---- } else { //invokedynamic DynamicMethodSymbol dynSym = (DynamicMethodSymbol)m; MethodHandle handle = new MethodHandle(dynSym.bsmKind, dynSym.bsm, types); DynamicMethod dynMeth = new DynamicMethod(dynSym, types); ! bootstrapMethods.put(dynSym, handle); //init cp entries pool.put(names.BootstrapMethods); pool.put(handle); for (Object staticArg : dynSym.staticArgs) { pool.put(staticArg);
*** 1022,1040 **** /** Write "bootstrapMethods" attribute. */ void writeBootstrapMethods() { int alenIdx = writeAttr(names.BootstrapMethods); databuf.appendChar(bootstrapMethods.size()); ! for (Map.Entry<DynamicMethod, MethodHandle> entry : bootstrapMethods.entrySet()) { ! DynamicMethod dmeth = entry.getKey(); ! DynamicMethodSymbol dsym = (DynamicMethodSymbol)dmeth.baseSymbol(); //write BSM handle databuf.appendChar(pool.get(entry.getValue())); //write static args length databuf.appendChar(dsym.staticArgs.length); //write static args array ! Object[] uniqueArgs = dmeth.uniqueStaticArgs; for (Object o : uniqueArgs) { databuf.appendChar(pool.get(o)); } } endAttr(alenIdx); --- 1022,1039 ---- /** Write "bootstrapMethods" attribute. */ void writeBootstrapMethods() { int alenIdx = writeAttr(names.BootstrapMethods); databuf.appendChar(bootstrapMethods.size()); ! for (Map.Entry<DynamicMethodSymbol, MethodHandle> entry : bootstrapMethods.entrySet()) { ! DynamicMethodSymbol dsym = entry.getKey(); //write BSM handle databuf.appendChar(pool.get(entry.getValue())); //write static args length databuf.appendChar(dsym.staticArgs.length); //write static args array ! Object[] uniqueArgs = dsym.getUniqueTypeArray(types); for (Object o : uniqueArgs) { databuf.appendChar(pool.get(o)); } } endAttr(alenIdx);