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