hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp
changeset 13391 30245956af37
parent 12726 0a3b759f8109
child 13728 882756847a04
equal deleted inserted replaced
13309:50c604cb0d5f 13391:30245956af37
   644     p = *(address*)(p + (*pc));
   644     p = *(address*)(p + (*pc));
   645   }
   645   }
   646   oop method_type = (oop) p;
   646   oop method_type = (oop) p;
   647 
   647 
   648   // The MethodHandle is in the slot after the arguments
   648   // The MethodHandle is in the slot after the arguments
   649   oop form = java_lang_invoke_MethodType::form(method_type);
   649   int num_vmslots = argument_slots - 1;
   650   int num_vmslots = java_lang_invoke_MethodTypeForm::vmslots(form);
       
   651   assert(argument_slots == num_vmslots + 1, "should be");
       
   652   oop method_handle = VMSLOTS_OBJECT(num_vmslots);
   650   oop method_handle = VMSLOTS_OBJECT(num_vmslots);
   653 
   651 
   654   // InvokeGeneric requires some extra shuffling
   652   // InvokeGeneric requires some extra shuffling
   655   oop mhtype = java_lang_invoke_MethodHandle::type(method_handle);
   653   oop mhtype = java_lang_invoke_MethodHandle::type(method_handle);
   656   bool is_exact = mhtype == method_type;
   654   bool is_exact = mhtype == method_type;
   657   if (!is_exact) {
   655   if (!is_exact) {
   658     if (method->intrinsic_id() == vmIntrinsics::_invokeExact) {
   656     if (true || // FIXME
       
   657         method->intrinsic_id() == vmIntrinsics::_invokeExact) {
   659       CALL_VM_NOCHECK_NOFIX(
   658       CALL_VM_NOCHECK_NOFIX(
   660         SharedRuntime::throw_WrongMethodTypeException(
   659         SharedRuntime::throw_WrongMethodTypeException(
   661           thread, method_type, mhtype));
   660           thread, method_type, mhtype));
   662       // NB all oops trashed!
   661       // NB all oops trashed!
   663       assert(HAS_PENDING_EXCEPTION, "should do");
   662       assert(HAS_PENDING_EXCEPTION, "should do");
   668 
   667 
   669     // Load up an adapter from the calling type
   668     // Load up an adapter from the calling type
   670     // NB the x86 code for this (in methodHandles_x86.cpp, search for
   669     // NB the x86 code for this (in methodHandles_x86.cpp, search for
   671     // "genericInvoker") is really really odd.  I'm hoping it's trying
   670     // "genericInvoker") is really really odd.  I'm hoping it's trying
   672     // to accomodate odd VM/class library combinations I can ignore.
   671     // to accomodate odd VM/class library combinations I can ignore.
   673     oop adapter = java_lang_invoke_MethodTypeForm::genericInvoker(form);
   672     oop adapter = NULL; //FIXME: load the adapter from the CP cache
   674     if (adapter == NULL) {
   673     IF (adapter == NULL) {
   675       CALL_VM_NOCHECK_NOFIX(
   674       CALL_VM_NOCHECK_NOFIX(
   676         SharedRuntime::throw_WrongMethodTypeException(
   675         SharedRuntime::throw_WrongMethodTypeException(
   677           thread, method_type, mhtype));
   676           thread, method_type, mhtype));
   678       // NB all oops trashed!
   677       // NB all oops trashed!
   679       assert(HAS_PENDING_EXCEPTION, "should do");
   678       assert(HAS_PENDING_EXCEPTION, "should do");
   759           // NB all oops trashed!
   758           // NB all oops trashed!
   760           assert(HAS_PENDING_EXCEPTION, "should do");
   759           assert(HAS_PENDING_EXCEPTION, "should do");
   761           return;
   760           return;
   762       }
   761       }
   763       if (entry_kind != MethodHandles::_invokespecial_mh) {
   762       if (entry_kind != MethodHandles::_invokespecial_mh) {
   764         int index = java_lang_invoke_DirectMethodHandle::vmindex(method_handle);
   763         intptr_t index = java_lang_invoke_DirectMethodHandle::vmindex(method_handle);
   765         instanceKlass* rcvrKlass =
   764         instanceKlass* rcvrKlass =
   766           (instanceKlass *) receiver->klass()->klass_part();
   765           (instanceKlass *) receiver->klass()->klass_part();
   767         if (entry_kind == MethodHandles::_invokevirtual_mh) {
   766         if (entry_kind == MethodHandles::_invokevirtual_mh) {
   768           method = (methodOop) rcvrKlass->start_of_vtable()[index];
   767           method = (methodOop) rcvrKlass->start_of_vtable()[index];
   769         }
   768         }
  1177 }
  1176 }
  1178 
  1177 
  1179 intptr_t* CppInterpreter::calculate_unwind_sp(ZeroStack* stack,
  1178 intptr_t* CppInterpreter::calculate_unwind_sp(ZeroStack* stack,
  1180                                               oop method_handle) {
  1179                                               oop method_handle) {
  1181   oop method_type = java_lang_invoke_MethodHandle::type(method_handle);
  1180   oop method_type = java_lang_invoke_MethodHandle::type(method_handle);
  1182   oop form = java_lang_invoke_MethodType::form(method_type);
  1181   int argument_slots = java_lang_invoke_MethodType::ptype_slot_count(method_type);
  1183   int argument_slots = java_lang_invoke_MethodTypeForm::vmslots(form);
       
  1184 
  1182 
  1185   return stack->sp() + argument_slots;
  1183   return stack->sp() + argument_slots;
  1186 }
  1184 }
  1187 
  1185 
  1188 IRT_ENTRY(void, CppInterpreter::throw_exception(JavaThread* thread,
  1186 IRT_ENTRY(void, CppInterpreter::throw_exception(JavaThread* thread,