Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/hotspot/share/classfile/vmSymbols.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,6 @@ class SerializeClosure;
template(encodeThrowable_name, "encodeThrowable") \
template(encodeThrowable_signature, "(Ljava/lang/Throwable;JI)I") \
template(decodeAndThrowThrowable_name, "decodeAndThrowThrowable") \
template(encodeAnnotations_name, "encodeAnnotations") \
template(encodeAnnotations_signature, "([BLjava/lang/Class;Ljdk/internal/reflect/ConstantPool;Z[Ljava/lang/Class;)[B")\
template(decodeAndThrowThrowable_signature, "(IJZZ)V") \
template(classRedefinedCount_name, "classRedefinedCount") \
template(classLoader_name, "classLoader") \
Expand Down
421 changes: 224 additions & 197 deletions src/hotspot/share/jvmci/jvmciCompilerToVM.cpp

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion src/hotspot/share/jvmci/jvmciCompilerToVM.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ class JVMCIObjectArray;

class CompilerToVM {
public:
// Keep in sync with constants in CompilerToVM.java
static const int DECLARED_ANNOTATIONS = 0;
static const int PARAMETER_ANNOTATIONS = 1;
static const int TYPE_ANNOTATIONS = 2;
static const int ANNOTATION_MEMBER_VALUE = 3;

class Data {
friend class JVMCIVMStructs;

Expand Down Expand Up @@ -94,7 +100,7 @@ class CompilerToVM {
static HeapWord** _heap_end_addr;
static HeapWord* volatile* _heap_top_addr;
static int _max_oop_map_stack_offset;
static int _fields_annotations_base_offset;
static int _annotation_array_array_base_offset;

static CardTable::CardValue* cardtable_start_address;
static int cardtable_shift;
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ bool CompilerToVM::Data::_supports_inline_contig_alloc;
HeapWord** CompilerToVM::Data::_heap_end_addr;
HeapWord* volatile* CompilerToVM::Data::_heap_top_addr;
int CompilerToVM::Data::_max_oop_map_stack_offset;
int CompilerToVM::Data::_fields_annotations_base_offset;
int CompilerToVM::Data::_annotation_array_array_base_offset;

CardTable::CardValue* CompilerToVM::Data::cardtable_start_address;
int CompilerToVM::Data::cardtable_shift;
Expand Down Expand Up @@ -226,7 +226,7 @@ void CompilerToVM::Data::initialize(JVMCI_TRAPS) {
symbol_init = (address) vmSymbols::object_initializer_name();
symbol_clinit = (address) vmSymbols::class_initializer_name();

_fields_annotations_base_offset = Array<AnnotationArray*>::base_offset_in_bytes();
_annotation_array_array_base_offset = Array<AnnotationArray*>::base_offset_in_bytes();

data_section_item_alignment = relocInfo::addr_unit();

Expand Down
25 changes: 25 additions & 0 deletions src/hotspot/share/jvmci/jvmciEnv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/recordComponent.hpp"
#include "oops/typeArrayOop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/arguments.hpp"
Expand Down Expand Up @@ -1609,6 +1610,30 @@ JVMCIObject JVMCIEnv::new_FieldInfo(FieldInfo* fieldinfo, JVMCI_TRAPS) {
}
}

JVMCIObject JVMCIEnv::new_HotSpotResolvedJavaRecordComponent(JVMCIObject declaringRecord, int index, RecordComponent* rc, JVMCI_TRAPS) {
JavaThread* THREAD = JavaThread::current();
if (is_hotspot()) {
JavaCallArguments args;
args.push_oop(Handle(THREAD, HotSpotJVMCI::resolve(declaringRecord)));
args.push_int(index);
args.push_int(rc->name_index());
args.push_int(rc->descriptor_index());
Handle obj_h = JavaCalls::construct_new_instance(HotSpotJVMCI::HotSpotResolvedJavaRecordComponent::klass(),
vmSymbols::HotSpotResolvedJavaRecordComponent_constructor_signature(),
&args,
THREAD);
return wrap(obj_h());
} else {
JNIAccessMark jni(this, THREAD);
jobject result = jni()->NewObject(JNIJVMCI::HotSpotResolvedJavaRecordComponent::clazz(),
JNIJVMCI::HotSpotResolvedJavaRecordComponent::constructor(),
(jint)rc->name_index(),
(jint)rc->descriptor_index());

return wrap(result);
}
}

JVMCIObject JVMCIEnv::get_object_constant(oop objOop, bool compressed, bool dont_register) {
JavaThread* THREAD = JavaThread::current(); // For exception macros.
Handle obj = Handle(THREAD, objOop);
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/jvmci/jvmciEnv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ class JVMCIEnv : public ResourceObj {
JVMCIObject new_HotSpotStackFrameReference(JVMCI_TRAPS);
JVMCIObject new_JVMCIError(JVMCI_TRAPS);
JVMCIObject new_FieldInfo(FieldInfo* fieldinfo, JVMCI_TRAPS);
JVMCIObject new_HotSpotResolvedJavaRecordComponent(JVMCIObject declaringRecord, int index, RecordComponent* rc, JVMCI_TRAPS);

// Makes a handle to a HotSpot heap object. These handles are
// individually reclaimed by JVMCIRuntime::destroy_oop_handle and
Expand Down
13 changes: 12 additions & 1 deletion src/hotspot/share/jvmci/jvmciJavaClasses.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@
start_class(HotSpotResolvedJavaMethodImpl, jdk_vm_ci_hotspot_HotSpotResolvedJavaMethodImpl) \
long_field(HotSpotResolvedJavaMethodImpl, methodHandle) \
end_class \
start_class(HotSpotResolvedJavaRecordComponent, jdk_vm_ci_hotspot_HotSpotResolvedJavaRecordComponent) \
jvmci_constructor(HotSpotResolvedJavaRecordComponent, "(Ljdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl;III)V") \
end_class \
start_class(HotSpotMethodData, jdk_vm_ci_hotspot_HotSpotMethodData) \
long_field(HotSpotMethodData, methodDataPointer) \
end_class \
Expand Down Expand Up @@ -165,6 +168,8 @@
end_class \
start_class(ResolvedJavaMethod, jdk_vm_ci_meta_ResolvedJavaMethod) \
end_class \
start_class(ResolvedJavaRecordComponent, jdk_vm_ci_meta_ResolvedJavaRecordComponent) \
end_class \
start_class(PrimitiveConstant, jdk_vm_ci_meta_PrimitiveConstant) \
object_field(PrimitiveConstant, kind, "Ljdk/vm/ci/meta/JavaKind;") \
long_field(PrimitiveConstant, primitive) \
Expand Down Expand Up @@ -211,12 +216,18 @@
jvmci_method(CallStaticObjectMethod, GetStaticMethodID, call_static, JVMCIObject, HotSpotJVMCIRuntime, exceptionToString, exceptionToString_signature) \
jvmci_method(CallStaticVoidMethod, GetStaticMethodID, call_static, void, HotSpotJVMCIRuntime, postTranslation, object_void_signature) \
end_class \
start_class(CompilerToVM, jdk_vm_ci_hotspot_CompilerToVM) \
static_int_field(CompilerToVM, DECLARED_ANNOTATIONS) \
static_int_field(CompilerToVM, PARAMETER_ANNOTATIONS) \
static_int_field(CompilerToVM, TYPE_ANNOTATIONS) \
static_int_field(CompilerToVM, ANNOTATION_MEMBER_VALUE) \
end_class \
start_class(JVMCIError, jdk_vm_ci_common_JVMCIError) \
jvmci_constructor(JVMCIError, "(Ljava/lang/String;)V") \
end_class \
start_class(InspectedFrameVisitor, jdk_vm_ci_code_stack_InspectedFrameVisitor) \
end_class \
start_class(Services, jdk_vm_ci_services_Services) \
start_class(Services, jdk_vm_ci_services_Services) \
end_class \
start_class(JVMCI, jdk_vm_ci_runtime_JVMCI) \
jvmci_method(CallStaticObjectMethod, GetStaticMethodID, call_static, JVMCIObject, JVMCI, getRuntime, getRuntime_signature) \
Expand Down
11 changes: 11 additions & 0 deletions src/hotspot/share/jvmci/jvmciRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1419,6 +1419,12 @@ class JavaVMRefsInitialization: public StackObj {
}
};

#ifdef ASSERT
static void assert_equals(const char* desc, int expect, int actual) {
assert(expect == actual, "%s: %d != %d", desc, expect, actual);
}
#endif

void JVMCIRuntime::initialize(JVMCI_TRAPS) {
// Check first without _lock
if (_init_state == fully_initialized) {
Expand Down Expand Up @@ -1489,6 +1495,11 @@ void JVMCIRuntime::initialize(JVMCI_TRAPS) {
create_jvmci_primitive_type(T_VOID, JVMCI_CHECK_EXIT_((void)0));

DEBUG_ONLY(CodeInstaller::verify_bci_constants(JVMCIENV);)

DEBUG_ONLY(assert_equals("DECLARED_ANNOTATIONS", CompilerToVM::DECLARED_ANNOTATIONS, JVMCIENV->get_CompilerToVM_DECLARED_ANNOTATIONS()));
DEBUG_ONLY(assert_equals("PARAMETER_ANNOTATIONS", CompilerToVM::PARAMETER_ANNOTATIONS, JVMCIENV->get_CompilerToVM_PARAMETER_ANNOTATIONS()));
DEBUG_ONLY(assert_equals("TYPE_ANNOTATIONS", CompilerToVM::TYPE_ANNOTATIONS, JVMCIENV->get_CompilerToVM_TYPE_ANNOTATIONS()));
DEBUG_ONLY(assert_equals("ANNOTATION_MEMBER_VALUE", CompilerToVM::ANNOTATION_MEMBER_VALUE, JVMCIENV->get_CompilerToVM_ANNOTATION_MEMBER_VALUE()));
}

_init_state = fully_initialized;
Expand Down
7 changes: 6 additions & 1 deletion src/hotspot/share/jvmci/vmStructs_jvmci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
static_field(CompilerToVM::Data, _heap_top_addr, HeapWord* volatile*) \
\
static_field(CompilerToVM::Data, _max_oop_map_stack_offset, int) \
static_field(CompilerToVM::Data, _fields_annotations_base_offset, int) \
static_field(CompilerToVM::Data, _annotation_array_array_base_offset, int) \
\
static_field(CompilerToVM::Data, cardtable_start_address, CardTable::CardValue*) \
static_field(CompilerToVM::Data, cardtable_shift, int) \
Expand Down Expand Up @@ -158,7 +158,9 @@
static_field(Abstract_VM_Version, _features, uint64_t) \
\
nonstatic_field(Annotations, _class_annotations, AnnotationArray*) \
nonstatic_field(Annotations, _class_type_annotations, AnnotationArray*) \
nonstatic_field(Annotations, _fields_annotations, Array<AnnotationArray*>*) \
nonstatic_field(Annotations, _fields_type_annotations, Array<AnnotationArray*>*) \
\
nonstatic_field(Array<int>, _length, int) \
unchecked_nonstatic_field(Array<u1>, _data, sizeof(u1)) \
Expand Down Expand Up @@ -224,6 +226,7 @@
nonstatic_field(InstanceKlass, _misc_flags._flags, u2) \
nonstatic_field(InstanceKlass, _annotations, Annotations*) \
nonstatic_field(InstanceKlass, _permitted_subclasses, Array<jushort>*) \
nonstatic_field(InstanceKlass, _record_components, Array<RecordComponent*>*) \
\
volatile_nonstatic_field(JavaFrameAnchor, _last_Java_sp, intptr_t*) \
volatile_nonstatic_field(JavaFrameAnchor, _last_Java_pc, address) \
Expand Down Expand Up @@ -689,7 +692,9 @@
declare_constant(ConstMethodFlags::_misc_has_localvariable_table) \
declare_constant(ConstMethodFlags::_misc_has_exception_table) \
declare_constant(ConstMethodFlags::_misc_has_method_annotations) \
declare_constant(ConstMethodFlags::_misc_has_type_annotations) \
declare_constant(ConstMethodFlags::_misc_has_parameter_annotations) \
declare_constant(ConstMethodFlags::_misc_has_default_annotations) \
declare_constant(ConstMethodFlags::_misc_caller_sensitive) \
declare_constant(ConstMethodFlags::_misc_is_hidden) \
declare_constant(ConstMethodFlags::_misc_intrinsic_candidate) \
Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/share/jvmci/vmSymbols_jvmci.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
template(jdk_vm_ci_hotspot_HotSpotInstalledCode, "jdk/vm/ci/hotspot/HotSpotInstalledCode") \
template(jdk_vm_ci_hotspot_HotSpotNmethod, "jdk/vm/ci/hotspot/HotSpotNmethod") \
template(jdk_vm_ci_hotspot_HotSpotResolvedJavaMethodImpl, "jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl") \
template(jdk_vm_ci_hotspot_HotSpotResolvedJavaRecordComponent, "jdk/vm/ci/hotspot/HotSpotResolvedJavaRecordComponent") \
template(jdk_vm_ci_hotspot_HotSpotResolvedObjectTypeImpl, "jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl") \
template(jdk_vm_ci_hotspot_HotSpotResolvedObjectTypeImpl_FieldInfo, "jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl$FieldInfo") \
template(jdk_vm_ci_hotspot_HotSpotResolvedPrimitiveType, "jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType") \
Expand All @@ -55,6 +56,7 @@
template(jdk_vm_ci_hotspot_VMFlag, "jdk/vm/ci/hotspot/VMFlag") \
template(jdk_vm_ci_hotspot_VMIntrinsicMethod, "jdk/vm/ci/hotspot/VMIntrinsicMethod") \
template(jdk_vm_ci_meta_ResolvedJavaMethod, "jdk/vm/ci/meta/ResolvedJavaMethod") \
template(jdk_vm_ci_meta_ResolvedJavaRecordComponent, "jdk/vm/ci/meta/ResolvedJavaRecordComponent") \
template(jdk_vm_ci_meta_JavaConstant, "jdk/vm/ci/meta/JavaConstant") \
template(jdk_vm_ci_meta_PrimitiveConstant, "jdk/vm/ci/meta/PrimitiveConstant") \
template(jdk_vm_ci_meta_RawConstant, "jdk/vm/ci/meta/RawConstant") \
Expand Down Expand Up @@ -97,6 +99,7 @@
template(getCompiler_signature, "()Ljdk/vm/ci/runtime/JVMCICompiler;") \
template(exceptionToString_name, "exceptionToString") \
template(exceptionToString_signature, "(Ljava/lang/Throwable;ZZ)[Ljava/lang/String;") \
template(HotSpotResolvedJavaRecordComponent_constructor_signature, "(Ljdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl;III)V") \
template(postTranslation_name, "postTranslation") \
template(getName_name, "getName") \
template(bootstrapFinished_name, "bootstrapFinished") \
Expand Down
Loading
Loading