977 return JVMCIENV->get_jobject(result);
978 C2V_END
979
980 C2V_VMENTRY_NULL(jobject, resolveFieldInPool, (JNIEnv* env, jobject, ARGUMENT_PAIR(cp), jint index, ARGUMENT_PAIR(method), jbyte opcode, jintArray info_handle))
981 constantPoolHandle cp(THREAD, UNPACK_PAIR(ConstantPool, cp));
982 Bytecodes::Code code = (Bytecodes::Code)(((int) opcode) & 0xFF);
983 fieldDescriptor fd;
984 methodHandle mh(THREAD, UNPACK_PAIR(Method, method));
985
986 Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF);
987 int holder_index = cp->klass_ref_index_at(index, bc);
988 if (!cp->tag_at(holder_index).is_klass() && !THREAD->can_call_java()) {
989 // If the holder is not resolved in the constant pool and the current
990 // thread cannot call Java, return null. This avoids a Java call
991 // in LinkInfo to load the holder.
992 Symbol* klass_name = cp->klass_ref_at_noresolve(index, bc);
993 return nullptr;
994 }
995
996 LinkInfo link_info(cp, index, mh, code, CHECK_NULL);
997 LinkResolver::resolve_field(fd, link_info, Bytecodes::java_code(code), false, CHECK_NULL);
998 JVMCIPrimitiveArray info = JVMCIENV->wrap(info_handle);
999 if (info.is_null() || JVMCIENV->get_length(info) != 4) {
1000 JVMCI_ERROR_NULL("info must not be null and have a length of 4");
1001 }
1002 JVMCIENV->put_int_at(info, 0, fd.access_flags().as_field_flags());
1003 JVMCIENV->put_int_at(info, 1, fd.offset());
1004 JVMCIENV->put_int_at(info, 2, fd.index());
1005 JVMCIENV->put_int_at(info, 3, fd.field_flags().as_uint());
1006 JVMCIKlassHandle handle(THREAD, fd.field_holder());
1007 JVMCIObject field_holder = JVMCIENV->get_jvmci_type(handle, JVMCI_CHECK_NULL);
1008 return JVMCIENV->get_jobject(field_holder);
1009 C2V_END
1010
1011 C2V_VMENTRY_0(jint, getVtableIndexForInterfaceMethod, (JNIEnv* env, jobject, ARGUMENT_PAIR(klass), ARGUMENT_PAIR(method)))
1012 Klass* klass = UNPACK_PAIR(Klass, klass);
1013 methodHandle method(THREAD, UNPACK_PAIR(Method, method));
1014 InstanceKlass* holder = method->method_holder();
1015 if (klass->is_interface()) {
1016 JVMCI_THROW_MSG_0(InternalError, err_msg("Interface %s should be handled in Java code", klass->external_name()));
1017 }
|
977 return JVMCIENV->get_jobject(result);
978 C2V_END
979
980 C2V_VMENTRY_NULL(jobject, resolveFieldInPool, (JNIEnv* env, jobject, ARGUMENT_PAIR(cp), jint index, ARGUMENT_PAIR(method), jbyte opcode, jintArray info_handle))
981 constantPoolHandle cp(THREAD, UNPACK_PAIR(ConstantPool, cp));
982 Bytecodes::Code code = (Bytecodes::Code)(((int) opcode) & 0xFF);
983 fieldDescriptor fd;
984 methodHandle mh(THREAD, UNPACK_PAIR(Method, method));
985
986 Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF);
987 int holder_index = cp->klass_ref_index_at(index, bc);
988 if (!cp->tag_at(holder_index).is_klass() && !THREAD->can_call_java()) {
989 // If the holder is not resolved in the constant pool and the current
990 // thread cannot call Java, return null. This avoids a Java call
991 // in LinkInfo to load the holder.
992 Symbol* klass_name = cp->klass_ref_at_noresolve(index, bc);
993 return nullptr;
994 }
995
996 LinkInfo link_info(cp, index, mh, code, CHECK_NULL);
997 LinkResolver::resolve_field(fd, link_info, Bytecodes::java_code(code), StaticMode::dont_initialize_klass, CHECK_NULL);
998 JVMCIPrimitiveArray info = JVMCIENV->wrap(info_handle);
999 if (info.is_null() || JVMCIENV->get_length(info) != 4) {
1000 JVMCI_ERROR_NULL("info must not be null and have a length of 4");
1001 }
1002 JVMCIENV->put_int_at(info, 0, fd.access_flags().as_field_flags());
1003 JVMCIENV->put_int_at(info, 1, fd.offset());
1004 JVMCIENV->put_int_at(info, 2, fd.index());
1005 JVMCIENV->put_int_at(info, 3, fd.field_flags().as_uint());
1006 JVMCIKlassHandle handle(THREAD, fd.field_holder());
1007 JVMCIObject field_holder = JVMCIENV->get_jvmci_type(handle, JVMCI_CHECK_NULL);
1008 return JVMCIENV->get_jobject(field_holder);
1009 C2V_END
1010
1011 C2V_VMENTRY_0(jint, getVtableIndexForInterfaceMethod, (JNIEnv* env, jobject, ARGUMENT_PAIR(klass), ARGUMENT_PAIR(method)))
1012 Klass* klass = UNPACK_PAIR(Klass, klass);
1013 methodHandle method(THREAD, UNPACK_PAIR(Method, method));
1014 InstanceKlass* holder = method->method_holder();
1015 if (klass->is_interface()) {
1016 JVMCI_THROW_MSG_0(InternalError, err_msg("Interface %s should be handled in Java code", klass->external_name()));
1017 }
|