618
619 /**
620 * Generate an invoker method for the passed {@link LambdaForm}.
621 */
622 private byte[] generateCustomizedCodeBytes() {
623 classFilePrologue();
624
625 // Suppress this method in backtraces displayed to the user.
626 mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
627
628 // Mark this method as a compiled LambdaForm
629 mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Compiled;", true);
630
631 if (lambdaForm.forceInline) {
632 // Force inlining of this invoker method.
633 mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
634 } else {
635 mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
636 }
637
638
639 // iterate over the form's names, generating bytecode instructions for each
640 // start iterating at the first name following the arguments
641 Name onStack = null;
642 for (int i = lambdaForm.arity; i < lambdaForm.names.length; i++) {
643 Name name = lambdaForm.names[i];
644
645 emitStoreResult(onStack);
646 onStack = name; // unless otherwise modified below
647 MethodHandleImpl.Intrinsic intr = name.function.intrinsicName();
648 switch (intr) {
649 case SELECT_ALTERNATIVE:
650 assert isSelectAlternative(i);
651 onStack = emitSelectAlternative(name, lambdaForm.names[i+1]);
652 i++; // skip MH.invokeBasic of the selectAlternative result
653 continue;
654 case GUARD_WITH_CATCH:
655 assert isGuardWithCatch(i);
656 onStack = emitGuardWithCatch(i);
657 i = i+2; // Jump to the end of GWC idiom
658 continue;
|
618
619 /**
620 * Generate an invoker method for the passed {@link LambdaForm}.
621 */
622 private byte[] generateCustomizedCodeBytes() {
623 classFilePrologue();
624
625 // Suppress this method in backtraces displayed to the user.
626 mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
627
628 // Mark this method as a compiled LambdaForm
629 mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Compiled;", true);
630
631 if (lambdaForm.forceInline) {
632 // Force inlining of this invoker method.
633 mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
634 } else {
635 mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
636 }
637
638 // iterate over the form's names, generating bytecode instructions for each
639 // start iterating at the first name following the arguments
640 Name onStack = null;
641 for (int i = lambdaForm.arity; i < lambdaForm.names.length; i++) {
642 Name name = lambdaForm.names[i];
643
644 emitStoreResult(onStack);
645 onStack = name; // unless otherwise modified below
646 MethodHandleImpl.Intrinsic intr = name.function.intrinsicName();
647 switch (intr) {
648 case SELECT_ALTERNATIVE:
649 assert isSelectAlternative(i);
650 onStack = emitSelectAlternative(name, lambdaForm.names[i+1]);
651 i++; // skip MH.invokeBasic of the selectAlternative result
652 continue;
653 case GUARD_WITH_CATCH:
654 assert isGuardWithCatch(i);
655 onStack = emitGuardWithCatch(i);
656 i = i+2; // Jump to the end of GWC idiom
657 continue;
|