Skip to content
Closed
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
4 changes: 2 additions & 2 deletions src/hotspot/share/classfile/modules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ void Modules::define_module(Handle module, jboolean is_open, jstring version,
ClassLoader::add_to_exploded_build_list(THREAD, module_symbol);
}

#ifdef COMPILER2
#if COMPILER2_OR_JVMCI
// Special handling of jdk.incubator.vector
if (strcmp(module_name, "jdk.incubator.vector") == 0) {
if (FLAG_IS_DEFAULT(EnableVectorSupport)) {
Expand All @@ -473,7 +473,7 @@ void Modules::define_module(Handle module, jboolean is_open, jstring version,
log_info(compilation)("EnableVectorAggressiveReboxing=%s", (EnableVectorAggressiveReboxing ? "true" : "false"));
log_info(compilation)("UseVectorStubs=%s", (UseVectorStubs ? "true" : "false"));
}
#endif // COMPILER2
#endif // COMPILER2_OR_JVMCI
}

#if INCLUDE_CDS_JAVA_HEAP
Expand Down
10 changes: 7 additions & 3 deletions src/hotspot/share/jvmci/jvmciCodeInstaller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,8 @@ ScopeValue* CodeInstaller::get_scope_value(HotSpotCompiledCodeStream* stream, u1
}
case REGISTER_PRIMITIVE:
case REGISTER_NARROW_OOP:
case REGISTER_OOP: {
case REGISTER_OOP:
case REGISTER_VECTOR: {
u2 number = stream->read_u2("register");
VMReg hotspotRegister = get_hotspot_reg(number, JVMCI_CHECK_NULL);
if (is_general_purpose_reg(hotspotRegister)) {
Expand All @@ -422,6 +423,8 @@ ScopeValue* CodeInstaller::get_scope_value(HotSpotCompiledCodeStream* stream, u1
locationType = Location::normal;
} else if (type == T_DOUBLE) {
locationType = Location::dbl;
} else if (type == T_OBJECT && tag == REGISTER_VECTOR) {
locationType = Location::vector;
} else {
JVMCI_ERROR_NULL("unexpected type %s in floating point register%s", basictype_to_str(type), stream->context());
}
Expand All @@ -434,14 +437,15 @@ ScopeValue* CodeInstaller::get_scope_value(HotSpotCompiledCodeStream* stream, u1
}
case STACK_SLOT_PRIMITIVE:
case STACK_SLOT_NARROW_OOP:
case STACK_SLOT_OOP: {
case STACK_SLOT_OOP:
case STACK_SLOT_VECTOR: {
jint offset = (jshort) stream->read_s2("offset");
if (stream->read_bool("addRawFrameSize")) {
offset += _total_frame_size;
}
Location::Type locationType;
if (type == T_OBJECT) {
locationType = tag == STACK_SLOT_NARROW_OOP ? Location::narrowoop : Location::oop;
locationType = tag == STACK_SLOT_VECTOR ? Location::vector : tag == STACK_SLOT_NARROW_OOP ? Location::narrowoop : Location::oop;
} else if (type == T_LONG) {
locationType = Location::lng;
} else if (type == T_DOUBLE) {
Expand Down
4 changes: 3 additions & 1 deletion src/hotspot/share/jvmci/jvmciCodeInstaller.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -185,9 +185,11 @@ class CodeInstaller : public StackObj {
REGISTER_PRIMITIVE,
REGISTER_OOP,
REGISTER_NARROW_OOP,
REGISTER_VECTOR,
STACK_SLOT_PRIMITIVE,
STACK_SLOT_OOP,
STACK_SLOT_NARROW_OOP,
STACK_SLOT_VECTOR,
VIRTUAL_OBJECT_ID,
VIRTUAL_OBJECT_ID2,
NULL_CONSTANT,
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/jvmci/vmStructs_jvmci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,11 @@
declare_constant(CodeInstaller::REGISTER_PRIMITIVE) \
declare_constant(CodeInstaller::REGISTER_OOP) \
declare_constant(CodeInstaller::REGISTER_NARROW_OOP) \
declare_constant(CodeInstaller::REGISTER_VECTOR) \
declare_constant(CodeInstaller::STACK_SLOT_PRIMITIVE) \
declare_constant(CodeInstaller::STACK_SLOT_OOP) \
declare_constant(CodeInstaller::STACK_SLOT_NARROW_OOP) \
declare_constant(CodeInstaller::STACK_SLOT_VECTOR) \
declare_constant(CodeInstaller::VIRTUAL_OBJECT_ID) \
declare_constant(CodeInstaller::VIRTUAL_OBJECT_ID2) \
declare_constant(CodeInstaller::NULL_CONSTANT) \
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/runtime/arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4041,7 +4041,7 @@ jint Arguments::apply_ergo() {
JVMFlag::printSetFlags(tty);
}

#ifdef COMPILER2
#if COMPILER2_OR_JVMCI
if (!FLAG_IS_DEFAULT(EnableVectorSupport) && !EnableVectorSupport) {
if (!FLAG_IS_DEFAULT(EnableVectorReboxing) && EnableVectorReboxing) {
warning("Disabling EnableVectorReboxing since EnableVectorSupport is turned off.");
Expand All @@ -4062,7 +4062,7 @@ jint Arguments::apply_ergo() {
}
FLAG_SET_DEFAULT(UseVectorStubs, false);
}
#endif // COMPILER2
#endif // COMPILER2_OR_JVMCI

if (FLAG_IS_CMDLINE(DiagnoseSyncOnValueBasedClasses)) {
if (DiagnoseSyncOnValueBasedClasses == ObjectSynchronizer::LOG_WARNING && !log_is_enabled(Info, valuebasedclasses)) {
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/runtime/deoptimization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1235,15 +1235,15 @@ bool Deoptimization::realloc_objects(JavaThread* thread, frame* fr, RegisterMap*

InstanceKlass* ik = InstanceKlass::cast(k);
if (obj == nullptr && !cache_init_error) {
#ifdef COMPILER2
#if COMPILER2_OR_JVMCI
if (EnableVectorSupport && VectorSupport::is_vector(ik)) {
obj = VectorSupport::allocate_vector(ik, fr, reg_map, sv, THREAD);
} else {
obj = ik->allocate_instance(THREAD);
}
#else
obj = ik->allocate_instance(THREAD);
#endif // COMPILER2
#endif // COMPILER2_OR_JVMCI
}
} else if (k->is_typeArray_klass()) {
TypeArrayKlass* ak = TypeArrayKlass::cast(k);
Expand Down Expand Up @@ -1585,7 +1585,7 @@ void Deoptimization::reassign_fields(frame* fr, RegisterMap* reg_map, GrowableAr
continue;
}
#endif // INCLUDE_JVMCI
#ifdef COMPILER2
#if COMPILER2_OR_JVMCI
if (EnableVectorSupport && VectorSupport::is_vector(k)) {
assert(sv->field_size() == 1, "%s not a vector", k->name()->as_C_string());
ScopeValue* payload = sv->field_at(0);
Expand All @@ -1605,7 +1605,7 @@ void Deoptimization::reassign_fields(frame* fr, RegisterMap* reg_map, GrowableAr
// Else fall-through to do assignment for scalar-replaced boxed vector representation
// which could be restored after vector object allocation.
}
#endif /* !COMPILER2 */
#endif /* !COMPILER2_OR_JVMCI */
if (k->is_instance_klass()) {
InstanceKlass* ik = InstanceKlass::cast(k);
reassign_fields_by_klass(ik, fr, reg_map, sv, 0, obj(), skip_internal);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -48,6 +48,7 @@
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.REGISTER_NARROW_OOP;
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.REGISTER_OOP;
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.REGISTER_PRIMITIVE;
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.REGISTER_VECTOR;
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.SITE_CALL;
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.SITE_DATA_PATCH;
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.SITE_EXCEPTION_HANDLER;
Expand All @@ -61,6 +62,7 @@
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT_NARROW_OOP;
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT_OOP;
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT_PRIMITIVE;
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.STACK_SLOT_VECTOR;
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.VIRTUAL_OBJECT_ID;
import static jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag.VIRTUAL_OBJECT_ID2;

Expand Down Expand Up @@ -171,9 +173,11 @@ enum Tag {
REGISTER_PRIMITIVE,
REGISTER_OOP,
REGISTER_NARROW_OOP,
REGISTER_VECTOR,
STACK_SLOT_PRIMITIVE,
STACK_SLOT_OOP,
STACK_SLOT_NARROW_OOP,
STACK_SLOT_VECTOR,
VIRTUAL_OBJECT_ID,
VIRTUAL_OBJECT_ID2,
NULL_CONSTANT,
Expand Down Expand Up @@ -1029,6 +1033,10 @@ private boolean isNarrowOop(Value oopValue) {
return oopValue.getPlatformKind() != runtime.getHostJVMCIBackend().getTarget().arch.getWordKind();
}

private boolean isVector(Value value) {
return value.getPlatformKind().getVectorLength() > 1;
}

private void writeJavaValue(JavaValue value, JavaKind kind) {
if (value == Value.ILLEGAL) {
writeTag(ILLEGAL);
Expand All @@ -1039,12 +1047,30 @@ private void writeJavaValue(JavaValue value, JavaKind kind) {
writeTag(NULL_CONSTANT);
} else if (value instanceof RegisterValue) {
RegisterValue reg = (RegisterValue) value;
Tag tag = kind == JavaKind.Object ? (isNarrowOop(reg) ? REGISTER_NARROW_OOP : REGISTER_OOP) : REGISTER_PRIMITIVE;
Tag tag;
if (kind == JavaKind.Object) {
if (isVector(reg)) {
tag = REGISTER_VECTOR;
} else {
tag = isNarrowOop(reg) ? REGISTER_NARROW_OOP : REGISTER_OOP;
}
} else {
tag = REGISTER_PRIMITIVE;
}
writeTag(tag);
writeRegister(reg.getRegister());
} else if (value instanceof StackSlot) {
StackSlot slot = (StackSlot) value;
Tag tag = kind == JavaKind.Object ? (isNarrowOop(slot) ? STACK_SLOT_NARROW_OOP : STACK_SLOT_OOP) : STACK_SLOT_PRIMITIVE;
Tag tag;
if (kind == JavaKind.Object) {
if (isVector(slot)) {
tag = STACK_SLOT_VECTOR;
} else {
tag = isNarrowOop(slot) ? STACK_SLOT_NARROW_OOP : STACK_SLOT_OOP;
}
} else {
tag = STACK_SLOT_PRIMITIVE;
}
writeTag(tag);
writeS2("offset", slot.getRawOffset());
writeBoolean("addRawFrameSize", slot.getRawAddFrameSize());
Expand Down