comparison src/cpu/zero/vm/cppInterpreter_zero.cpp @ 6926:a3e2f723f2a5

8000780: make Zero build and run with JDK8 Reviewed-by: coleenp, dholmes, twisti Contributed-by: Roman Kennke <rkennke@redhat.com>
author twisti
date Mon, 29 Oct 2012 11:08:48 -0700
parents da91efe96a93
children 2cd5e15048e6
comparison
equal deleted inserted replaced
6915:a516debe2cee 6926:a3e2f723f2a5
178 // Jump into the OSR method 178 // Jump into the OSR method
179 Interpreter::invoke_osr( 179 Interpreter::invoke_osr(
180 method, istate->osr_entry(), istate->osr_buf(), THREAD); 180 method, istate->osr_entry(), istate->osr_buf(), THREAD);
181 return; 181 return;
182 } 182 }
183 else if (istate->msg() == BytecodeInterpreter::call_method_handle) {
184 oop method_handle = istate->callee();
185
186 // Trim back the stack to put the parameters at the top
187 stack->set_sp(istate->stack() + 1);
188
189 // Make the call
190 process_method_handle(method_handle, THREAD);
191 fixup_after_potential_safepoint();
192
193 // Convert the result
194 istate->set_stack(stack->sp() - 1);
195
196 // Restore the stack
197 stack->set_sp(istate->stack_limit() + 1);
198
199 // Resume the interpreter
200 istate->set_msg(BytecodeInterpreter::method_resume);
201 }
202 else { 183 else {
203 ShouldNotReachHere(); 184 ShouldNotReachHere();
204 } 185 }
205 } 186 }
206 187
533 break; 514 break;
534 } 515 }
535 if (entry->is_volatile()) { 516 if (entry->is_volatile()) {
536 switch (entry->flag_state()) { 517 switch (entry->flag_state()) {
537 case ctos: 518 case ctos:
538 SET_LOCALS_INT(object->char_field_acquire(entry->f2()), 0); 519 SET_LOCALS_INT(object->char_field_acquire(entry->f2_as_index()), 0);
539 break; 520 break;
540 521
541 case btos: 522 case btos:
542 SET_LOCALS_INT(object->byte_field_acquire(entry->f2()), 0); 523 SET_LOCALS_INT(object->byte_field_acquire(entry->f2_as_index()), 0);
543 break; 524 break;
544 525
545 case stos: 526 case stos:
546 SET_LOCALS_INT(object->short_field_acquire(entry->f2()), 0); 527 SET_LOCALS_INT(object->short_field_acquire(entry->f2_as_index()), 0);
547 break; 528 break;
548 529
549 case itos: 530 case itos:
550 SET_LOCALS_INT(object->int_field_acquire(entry->f2()), 0); 531 SET_LOCALS_INT(object->int_field_acquire(entry->f2_as_index()), 0);
551 break; 532 break;
552 533
553 case ltos: 534 case ltos:
554 SET_LOCALS_LONG(object->long_field_acquire(entry->f2()), 0); 535 SET_LOCALS_LONG(object->long_field_acquire(entry->f2_as_index()), 0);
555 break; 536 break;
556 537
557 case ftos: 538 case ftos:
558 SET_LOCALS_FLOAT(object->float_field_acquire(entry->f2()), 0); 539 SET_LOCALS_FLOAT(object->float_field_acquire(entry->f2_as_index()), 0);
559 break; 540 break;
560 541
561 case dtos: 542 case dtos:
562 SET_LOCALS_DOUBLE(object->double_field_acquire(entry->f2()), 0); 543 SET_LOCALS_DOUBLE(object->double_field_acquire(entry->f2_as_index()), 0);
563 break; 544 break;
564 545
565 case atos: 546 case atos:
566 SET_LOCALS_OBJECT(object->obj_field_acquire(entry->f2()), 0); 547 SET_LOCALS_OBJECT(object->obj_field_acquire(entry->f2_as_index()), 0);
567 break; 548 break;
568 549
569 default: 550 default:
570 ShouldNotReachHere(); 551 ShouldNotReachHere();
571 } 552 }
572 } 553 }
573 else { 554 else {
574 switch (entry->flag_state()) { 555 switch (entry->flag_state()) {
575 case ctos: 556 case ctos:
576 SET_LOCALS_INT(object->char_field(entry->f2()), 0); 557 SET_LOCALS_INT(object->char_field(entry->f2_as_index()), 0);
577 break; 558 break;
578 559
579 case btos: 560 case btos:
580 SET_LOCALS_INT(object->byte_field(entry->f2()), 0); 561 SET_LOCALS_INT(object->byte_field(entry->f2_as_index()), 0);
581 break; 562 break;
582 563
583 case stos: 564 case stos:
584 SET_LOCALS_INT(object->short_field(entry->f2()), 0); 565 SET_LOCALS_INT(object->short_field(entry->f2_as_index()), 0);
585 break; 566 break;
586 567
587 case itos: 568 case itos:
588 SET_LOCALS_INT(object->int_field(entry->f2()), 0); 569 SET_LOCALS_INT(object->int_field(entry->f2_as_index()), 0);
589 break; 570 break;
590 571
591 case ltos: 572 case ltos:
592 SET_LOCALS_LONG(object->long_field(entry->f2()), 0); 573 SET_LOCALS_LONG(object->long_field(entry->f2_as_index()), 0);
593 break; 574 break;
594 575
595 case ftos: 576 case ftos:
596 SET_LOCALS_FLOAT(object->float_field(entry->f2()), 0); 577 SET_LOCALS_FLOAT(object->float_field(entry->f2_as_index()), 0);
597 break; 578 break;
598 579
599 case dtos: 580 case dtos:
600 SET_LOCALS_DOUBLE(object->double_field(entry->f2()), 0); 581 SET_LOCALS_DOUBLE(object->double_field(entry->f2_as_index()), 0);
601 break; 582 break;
602 583
603 case atos: 584 case atos:
604 SET_LOCALS_OBJECT(object->obj_field(entry->f2()), 0); 585 SET_LOCALS_OBJECT(object->obj_field(entry->f2_as_index()), 0);
605 break; 586 break;
606 587
607 default: 588 default:
608 ShouldNotReachHere(); 589 ShouldNotReachHere();
609 } 590 }
625 // Pop our parameters 606 // Pop our parameters
626 stack->set_sp(stack->sp() + method->size_of_parameters()); 607 stack->set_sp(stack->sp() + method->size_of_parameters());
627 608
628 // No deoptimized frames on the stack 609 // No deoptimized frames on the stack
629 return 0; 610 return 0;
630 }
631
632 int CppInterpreter::method_handle_entry(Method* method,
633 intptr_t UNUSED, TRAPS) {
634 JavaThread *thread = (JavaThread *) THREAD;
635 ZeroStack *stack = thread->zero_stack();
636 int argument_slots = method->size_of_parameters();
637 int result_slots = type2size[result_type_of(method)];
638 intptr_t *vmslots = stack->sp();
639 intptr_t *unwind_sp = vmslots + argument_slots;
640
641 // Find the MethodType
642 address p = (address) method;
643 for (jint* pc = method->method_type_offsets_chain(); (*pc) != -1; pc++) {
644 p = *(address*)(p + (*pc));
645 }
646 oop method_type = (oop) p;
647
648 // The MethodHandle is in the slot after the arguments
649 int num_vmslots = argument_slots - 1;
650 oop method_handle = VMSLOTS_OBJECT(num_vmslots);
651
652 // InvokeGeneric requires some extra shuffling
653 oop mhtype = java_lang_invoke_MethodHandle::type(method_handle);
654 bool is_exact = mhtype == method_type;
655 if (!is_exact) {
656 if (true || // FIXME
657 method->intrinsic_id() == vmIntrinsics::_invokeExact) {
658 CALL_VM_NOCHECK_NOFIX(
659 SharedRuntime::throw_WrongMethodTypeException(
660 thread, method_type, mhtype));
661 // NB all oops trashed!
662 assert(HAS_PENDING_EXCEPTION, "should do");
663 stack->set_sp(unwind_sp);
664 return 0;
665 }
666 assert(method->intrinsic_id() == vmIntrinsics::_invokeGeneric, "should be");
667
668 // Load up an adapter from the calling type
669 // NB the x86 code for this (in methodHandles_x86.cpp, search for
670 // "genericInvoker") is really really odd. I'm hoping it's trying
671 // to accomodate odd VM/class library combinations I can ignore.
672 oop adapter = NULL; //FIXME: load the adapter from the CP cache
673 IF (adapter == NULL) {
674 CALL_VM_NOCHECK_NOFIX(
675 SharedRuntime::throw_WrongMethodTypeException(
676 thread, method_type, mhtype));
677 // NB all oops trashed!
678 assert(HAS_PENDING_EXCEPTION, "should do");
679 stack->set_sp(unwind_sp);
680 return 0;
681 }
682
683 // Adapters are shared among form-families of method-type. The
684 // type being called is passed as a trusted first argument so that
685 // the adapter knows the actual types of its arguments and return
686 // values.
687 insert_vmslots(num_vmslots + 1, 1, THREAD);
688 if (HAS_PENDING_EXCEPTION) {
689 // NB all oops trashed!
690 stack->set_sp(unwind_sp);
691 return 0;
692 }
693
694 vmslots = stack->sp();
695 num_vmslots++;
696 SET_VMSLOTS_OBJECT(method_type, num_vmslots);
697
698 method_handle = adapter;
699 }
700
701 // Start processing
702 process_method_handle(method_handle, THREAD);
703 if (HAS_PENDING_EXCEPTION)
704 result_slots = 0;
705
706 // If this is an invokeExact then the eventual callee will not
707 // have unwound the method handle argument so we have to do it.
708 // If a result is being returned the it will be above the method
709 // handle argument we're unwinding.
710 if (is_exact) {
711 intptr_t result[2];
712 for (int i = 0; i < result_slots; i++)
713 result[i] = stack->pop();
714 stack->pop();
715 for (int i = result_slots - 1; i >= 0; i--)
716 stack->push(result[i]);
717 }
718
719 // Check
720 assert(stack->sp() == unwind_sp - result_slots, "should be");
721
722 // No deoptimized frames on the stack
723 return 0;
724 }
725
726 void CppInterpreter::process_method_handle(oop method_handle, TRAPS) {
727 JavaThread *thread = (JavaThread *) THREAD;
728 ZeroStack *stack = thread->zero_stack();
729 intptr_t *vmslots = stack->sp();
730
731 bool direct_to_method = false;
732 BasicType src_rtype = T_ILLEGAL;
733 BasicType dst_rtype = T_ILLEGAL;
734
735 MethodHandleEntry *entry =
736 java_lang_invoke_MethodHandle::vmentry(method_handle);
737 MethodHandles::EntryKind entry_kind =
738 (MethodHandles::EntryKind) (((intptr_t) entry) & 0xffffffff);
739
740 Method* method = NULL;
741 switch (entry_kind) {
742 case MethodHandles::_invokestatic_mh:
743 direct_to_method = true;
744 break;
745
746 case MethodHandles::_invokespecial_mh:
747 case MethodHandles::_invokevirtual_mh:
748 case MethodHandles::_invokeinterface_mh:
749 {
750 oop receiver =
751 VMSLOTS_OBJECT(
752 java_lang_invoke_MethodHandle::vmslots(method_handle) - 1);
753 if (receiver == NULL) {
754 stack->set_sp(calculate_unwind_sp(stack, method_handle));
755 CALL_VM_NOCHECK_NOFIX(
756 throw_exception(
757 thread, vmSymbols::java_lang_NullPointerException()));
758 // NB all oops trashed!
759 assert(HAS_PENDING_EXCEPTION, "should do");
760 return;
761 }
762 if (entry_kind != MethodHandles::_invokespecial_mh) {
763 intptr_t index = java_lang_invoke_DirectMethodHandle::vmindex(method_handle);
764 InstanceKlass* rcvrKlass =
765 (InstanceKlass *) receiver->klass();
766 if (entry_kind == MethodHandles::_invokevirtual_mh) {
767 method = (Method*) rcvrKlass->start_of_vtable()[index];
768 }
769 else {
770 oop iclass = java_lang_invoke_MethodHandle::next_target(method_handle);
771 itableOffsetEntry* ki =
772 (itableOffsetEntry *) rcvrKlass->start_of_itable();
773 int i, length = rcvrKlass->itable_length();
774 for (i = 0; i < length; i++, ki++ ) {
775 if (ki->interface_klass() == iclass)
776 break;
777 }
778 if (i == length) {
779 stack->set_sp(calculate_unwind_sp(stack, method_handle));
780 CALL_VM_NOCHECK_NOFIX(
781 throw_exception(
782 thread, vmSymbols::java_lang_IncompatibleClassChangeError()));
783 // NB all oops trashed!
784 assert(HAS_PENDING_EXCEPTION, "should do");
785 return;
786 }
787 itableMethodEntry* im = ki->first_method_entry(receiver->klass());
788 method = im[index].method();
789 if (method == NULL) {
790 stack->set_sp(calculate_unwind_sp(stack, method_handle));
791 CALL_VM_NOCHECK_NOFIX(
792 throw_exception(
793 thread, vmSymbols::java_lang_AbstractMethodError()));
794 // NB all oops trashed!
795 assert(HAS_PENDING_EXCEPTION, "should do");
796 return;
797 }
798 }
799 }
800 }
801 direct_to_method = true;
802 break;
803
804 case MethodHandles::_bound_ref_direct_mh:
805 case MethodHandles::_bound_int_direct_mh:
806 case MethodHandles::_bound_long_direct_mh:
807 direct_to_method = true;
808 // fall through
809 case MethodHandles::_bound_ref_mh:
810 case MethodHandles::_bound_int_mh:
811 case MethodHandles::_bound_long_mh:
812 {
813 BasicType arg_type = T_ILLEGAL;
814 int arg_mask = -1;
815 int arg_slots = -1;
816 MethodHandles::get_ek_bound_mh_info(
817 entry_kind, arg_type, arg_mask, arg_slots);
818 int arg_slot =
819 java_lang_invoke_BoundMethodHandle::vmargslot(method_handle);
820
821 // Create the new slot(s)
822 intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
823 insert_vmslots(arg_slot, arg_slots, THREAD);
824 if (HAS_PENDING_EXCEPTION) {
825 // all oops trashed
826 stack->set_sp(unwind_sp);
827 return;
828 }
829 vmslots = stack->sp();
830
831 // Store bound argument into new stack slot
832 oop arg = java_lang_invoke_BoundMethodHandle::argument(method_handle);
833 if (arg_type == T_OBJECT) {
834 assert(arg_slots == 1, "should be");
835 SET_VMSLOTS_OBJECT(arg, arg_slot);
836 }
837 else {
838 jvalue arg_value;
839 arg_type = java_lang_boxing_object::get_value(arg, &arg_value);
840 switch (arg_type) {
841 case T_BOOLEAN:
842 SET_VMSLOTS_INT(arg_value.z, arg_slot);
843 break;
844 case T_CHAR:
845 SET_VMSLOTS_INT(arg_value.c, arg_slot);
846 break;
847 case T_BYTE:
848 SET_VMSLOTS_INT(arg_value.b, arg_slot);
849 break;
850 case T_SHORT:
851 SET_VMSLOTS_INT(arg_value.s, arg_slot);
852 break;
853 case T_INT:
854 SET_VMSLOTS_INT(arg_value.i, arg_slot);
855 break;
856 case T_FLOAT:
857 SET_VMSLOTS_FLOAT(arg_value.f, arg_slot);
858 break;
859 case T_LONG:
860 SET_VMSLOTS_LONG(arg_value.j, arg_slot + 1);
861 break;
862 case T_DOUBLE:
863 SET_VMSLOTS_DOUBLE(arg_value.d, arg_slot + 1);
864 break;
865 default:
866 tty->print_cr("unhandled type %s", type2name(arg_type));
867 ShouldNotReachHere();
868 }
869 }
870 }
871 break;
872
873 case MethodHandles::_adapter_retype_only:
874 case MethodHandles::_adapter_retype_raw:
875 src_rtype = result_type_of_handle(
876 java_lang_invoke_MethodHandle::next_target(method_handle));
877 dst_rtype = result_type_of_handle(method_handle);
878 break;
879
880 case MethodHandles::_adapter_check_cast:
881 {
882 int arg_slot =
883 java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
884 oop arg = VMSLOTS_OBJECT(arg_slot);
885 if (arg != NULL) {
886 Klass* objKlassOop = arg->klass();
887 Klass* klassOf = java_lang_Class::as_Klass(
888 java_lang_invoke_AdapterMethodHandle::argument(method_handle));
889
890 if (objKlassOop != klassOf &&
891 !objKlassOop->is_subtype_of(klassOf)) {
892 ResourceMark rm(THREAD);
893 const char* objName = Klass::cast(objKlassOop)->external_name();
894 const char* klassName = Klass::cast(klassOf)->external_name();
895 char* message = SharedRuntime::generate_class_cast_message(
896 objName, klassName);
897
898 stack->set_sp(calculate_unwind_sp(stack, method_handle));
899 CALL_VM_NOCHECK_NOFIX(
900 throw_exception(
901 thread, vmSymbols::java_lang_ClassCastException(), message));
902 // NB all oops trashed!
903 assert(HAS_PENDING_EXCEPTION, "should do");
904 return;
905 }
906 }
907 }
908 break;
909
910 case MethodHandles::_adapter_dup_args:
911 {
912 int arg_slot =
913 java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
914 int conv =
915 java_lang_invoke_AdapterMethodHandle::conversion(method_handle);
916 int num_slots = -MethodHandles::adapter_conversion_stack_move(conv);
917 assert(num_slots > 0, "should be");
918
919 // Create the new slot(s)
920 intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
921 stack->overflow_check(num_slots, THREAD);
922 if (HAS_PENDING_EXCEPTION) {
923 // all oops trashed
924 stack->set_sp(unwind_sp);
925 return;
926 }
927
928 // Duplicate the arguments
929 for (int i = num_slots - 1; i >= 0; i--)
930 stack->push(*VMSLOTS_SLOT(arg_slot + i));
931
932 vmslots = stack->sp(); // unused, but let the compiler figure that out
933 }
934 break;
935
936 case MethodHandles::_adapter_drop_args:
937 {
938 int arg_slot =
939 java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
940 int conv =
941 java_lang_invoke_AdapterMethodHandle::conversion(method_handle);
942 int num_slots = MethodHandles::adapter_conversion_stack_move(conv);
943 assert(num_slots > 0, "should be");
944
945 remove_vmslots(arg_slot, num_slots, THREAD); // doesn't trap
946 vmslots = stack->sp(); // unused, but let the compiler figure that out
947 }
948 break;
949
950 case MethodHandles::_adapter_opt_swap_1:
951 case MethodHandles::_adapter_opt_swap_2:
952 case MethodHandles::_adapter_opt_rot_1_up:
953 case MethodHandles::_adapter_opt_rot_1_down:
954 case MethodHandles::_adapter_opt_rot_2_up:
955 case MethodHandles::_adapter_opt_rot_2_down:
956 {
957 int arg1 =
958 java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
959 int conv =
960 java_lang_invoke_AdapterMethodHandle::conversion(method_handle);
961 int arg2 = MethodHandles::adapter_conversion_vminfo(conv);
962
963 int swap_bytes = 0, rotate = 0;
964 MethodHandles::get_ek_adapter_opt_swap_rot_info(
965 entry_kind, swap_bytes, rotate);
966 int swap_slots = swap_bytes >> LogBytesPerWord;
967
968 intptr_t tmp;
969 switch (rotate) {
970 case 0: // swap
971 for (int i = 0; i < swap_slots; i++) {
972 tmp = *VMSLOTS_SLOT(arg1 + i);
973 SET_VMSLOTS_SLOT(VMSLOTS_SLOT(arg2 + i), arg1 + i);
974 SET_VMSLOTS_SLOT(&tmp, arg2 + i);
975 }
976 break;
977
978 case 1: // up
979 assert(arg1 - swap_slots > arg2, "should be");
980
981 tmp = *VMSLOTS_SLOT(arg1);
982 for (int i = arg1 - swap_slots; i >= arg2; i--)
983 SET_VMSLOTS_SLOT(VMSLOTS_SLOT(i), i + swap_slots);
984 SET_VMSLOTS_SLOT(&tmp, arg2);
985
986 break;
987
988 case -1: // down
989 assert(arg2 - swap_slots > arg1, "should be");
990
991 tmp = *VMSLOTS_SLOT(arg1);
992 for (int i = arg1 + swap_slots; i <= arg2; i++)
993 SET_VMSLOTS_SLOT(VMSLOTS_SLOT(i), i - swap_slots);
994 SET_VMSLOTS_SLOT(&tmp, arg2);
995 break;
996
997 default:
998 ShouldNotReachHere();
999 }
1000 }
1001 break;
1002
1003 case MethodHandles::_adapter_opt_i2l:
1004 {
1005 int arg_slot =
1006 java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
1007 int arg = VMSLOTS_INT(arg_slot);
1008 intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
1009 insert_vmslots(arg_slot, 1, THREAD);
1010 if (HAS_PENDING_EXCEPTION) {
1011 // all oops trashed
1012 stack->set_sp(unwind_sp);
1013 return;
1014 }
1015 vmslots = stack->sp();
1016 arg_slot++;
1017 SET_VMSLOTS_LONG(arg, arg_slot);
1018 }
1019 break;
1020
1021 case MethodHandles::_adapter_opt_unboxi:
1022 case MethodHandles::_adapter_opt_unboxl:
1023 {
1024 int arg_slot =
1025 java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
1026 oop arg = VMSLOTS_OBJECT(arg_slot);
1027 jvalue arg_value;
1028 if (arg == NULL) {
1029 // queue a nullpointer exception for the caller
1030 stack->set_sp(calculate_unwind_sp(stack, method_handle));
1031 CALL_VM_NOCHECK_NOFIX(
1032 throw_exception(
1033 thread, vmSymbols::java_lang_NullPointerException()));
1034 // NB all oops trashed!
1035 assert(HAS_PENDING_EXCEPTION, "should do");
1036 return;
1037 }
1038 BasicType arg_type = java_lang_boxing_object::get_value(arg, &arg_value);
1039 if (arg_type == T_LONG || arg_type == T_DOUBLE) {
1040 intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
1041 insert_vmslots(arg_slot, 1, THREAD);
1042 if (HAS_PENDING_EXCEPTION) {
1043 // all oops trashed
1044 stack->set_sp(unwind_sp);
1045 return;
1046 }
1047 vmslots = stack->sp();
1048 arg_slot++;
1049 }
1050 switch (arg_type) {
1051 case T_BOOLEAN:
1052 SET_VMSLOTS_INT(arg_value.z, arg_slot);
1053 break;
1054 case T_CHAR:
1055 SET_VMSLOTS_INT(arg_value.c, arg_slot);
1056 break;
1057 case T_BYTE:
1058 SET_VMSLOTS_INT(arg_value.b, arg_slot);
1059 break;
1060 case T_SHORT:
1061 SET_VMSLOTS_INT(arg_value.s, arg_slot);
1062 break;
1063 case T_INT:
1064 SET_VMSLOTS_INT(arg_value.i, arg_slot);
1065 break;
1066 case T_FLOAT:
1067 SET_VMSLOTS_FLOAT(arg_value.f, arg_slot);
1068 break;
1069 case T_LONG:
1070 SET_VMSLOTS_LONG(arg_value.j, arg_slot);
1071 break;
1072 case T_DOUBLE:
1073 SET_VMSLOTS_DOUBLE(arg_value.d, arg_slot);
1074 break;
1075 default:
1076 tty->print_cr("unhandled type %s", type2name(arg_type));
1077 ShouldNotReachHere();
1078 }
1079 }
1080 break;
1081
1082 default:
1083 tty->print_cr("unhandled entry_kind %s",
1084 MethodHandles::entry_name(entry_kind));
1085 ShouldNotReachHere();
1086 }
1087
1088 // Continue along the chain
1089 if (direct_to_method) {
1090 if (method == NULL) {
1091 method =
1092 (Method*) java_lang_invoke_MethodHandle::vmtarget(method_handle);
1093 }
1094 address entry_point = method->from_interpreted_entry();
1095 Interpreter::invoke_method(method, entry_point, THREAD);
1096 }
1097 else {
1098 process_method_handle(
1099 java_lang_invoke_MethodHandle::next_target(method_handle), THREAD);
1100 }
1101 // NB all oops now trashed
1102
1103 // Adapt the result type, if necessary
1104 if (src_rtype != dst_rtype && !HAS_PENDING_EXCEPTION) {
1105 switch (dst_rtype) {
1106 case T_VOID:
1107 for (int i = 0; i < type2size[src_rtype]; i++)
1108 stack->pop();
1109 return;
1110
1111 case T_INT:
1112 switch (src_rtype) {
1113 case T_VOID:
1114 stack->overflow_check(1, CHECK);
1115 stack->push(0);
1116 return;
1117
1118 case T_BOOLEAN:
1119 case T_CHAR:
1120 case T_BYTE:
1121 case T_SHORT:
1122 return;
1123 }
1124 // INT results sometimes need narrowing
1125 case T_BOOLEAN:
1126 case T_CHAR:
1127 case T_BYTE:
1128 case T_SHORT:
1129 switch (src_rtype) {
1130 case T_INT:
1131 return;
1132 }
1133 }
1134
1135 tty->print_cr("unhandled conversion:");
1136 tty->print_cr("src_rtype = %s", type2name(src_rtype));
1137 tty->print_cr("dst_rtype = %s", type2name(dst_rtype));
1138 ShouldNotReachHere();
1139 }
1140 } 611 }
1141 612
1142 // The new slots will be inserted before slot insert_before. 613 // The new slots will be inserted before slot insert_before.
1143 // Slots < insert_before will have the same slot number after the insert. 614 // Slots < insert_before will have the same slot number after the insert.
1144 // Slots >= insert_before will become old_slot + num_slots. 615 // Slots >= insert_before will become old_slot + num_slots.
1378 849
1379 case Interpreter::abstract: 850 case Interpreter::abstract:
1380 entry_point = ((InterpreterGenerator*) this)->generate_abstract_entry(); 851 entry_point = ((InterpreterGenerator*) this)->generate_abstract_entry();
1381 break; 852 break;
1382 853
1383 case Interpreter::method_handle:
1384 entry_point = ((InterpreterGenerator*) this)->generate_method_handle_entry();
1385 break;
1386
1387 case Interpreter::java_lang_math_sin: 854 case Interpreter::java_lang_math_sin:
1388 case Interpreter::java_lang_math_cos: 855 case Interpreter::java_lang_math_cos:
1389 case Interpreter::java_lang_math_tan: 856 case Interpreter::java_lang_math_tan:
1390 case Interpreter::java_lang_math_abs: 857 case Interpreter::java_lang_math_abs:
1391 case Interpreter::java_lang_math_log: 858 case Interpreter::java_lang_math_log:
1392 case Interpreter::java_lang_math_log10: 859 case Interpreter::java_lang_math_log10:
1393 case Interpreter::java_lang_math_sqrt: 860 case Interpreter::java_lang_math_sqrt:
861 case Interpreter::java_lang_math_pow:
862 case Interpreter::java_lang_math_exp:
1394 entry_point = ((InterpreterGenerator*) this)->generate_math_entry(kind); 863 entry_point = ((InterpreterGenerator*) this)->generate_math_entry(kind);
1395 break; 864 break;
1396 865
1397 case Interpreter::java_lang_ref_reference_get: 866 case Interpreter::java_lang_ref_reference_get:
1398 entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); 867 entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry();