Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
8e0fbfd
initial support for inline types
MichaelHaas99 Sep 18, 2024
f3efd5c
adaption of isIdentity check
MichaelHaas99 Sep 30, 2024
6c74193
added markWord prototype to jvmci
MichaelHaas99 Oct 2, 2024
093fe26
making acmp profile information available over jvmci
MichaelHaas99 Oct 8, 2024
5fa64b0
fixed wrong access to klass object
MichaelHaas99 Oct 9, 2024
a00ca75
refactor jvmci code for acmp profile data
MichaelHaas99 Oct 10, 2024
bd0f11c
expanding interface for acmp profiling data
MichaelHaas99 Oct 11, 2024
2f5c935
bug fixing and refactoring
MichaelHaas99 Oct 15, 2024
a5e4058
refactoring of acmp data profiling interface
MichaelHaas99 Oct 17, 2024
443eaca
support for hashCode on inline types
MichaelHaas99 Oct 29, 2024
838d4e2
support for getfield and putfield on null-restricted flattened fields
MichaelHaas99 Nov 8, 2024
e5cddc2
first approach to support nullable flattened inline types
MichaelHaas99 Nov 12, 2024
bc97d22
first approach to support access on flattened arrays with a constant …
MichaelHaas99 Nov 15, 2024
06baad1
make access to flat array pattern in klass object available for jvmci
MichaelHaas99 Nov 23, 2024
b560b11
make access to null free array attributes in klass object available f…
MichaelHaas99 Nov 23, 2024
3f77ad4
provide access to flat array classes
MichaelHaas99 Nov 25, 2024
a5a1a24
modifications of jtreg testcases to get them working with Graal
MichaelHaas99 Dec 10, 2024
1a9bf07
support a runtime call for flat arrays with an unknown type
MichaelHaas99 Dec 12, 2024
7107f8c
fixed wrong signature of flat array runtime call
MichaelHaas99 Dec 12, 2024
62e08d2
flat array runtime call produces error, try to fix it
MichaelHaas99 Dec 12, 2024
6ae5569
make mask value for flat and null-free arrays available over JVMCI
MichaelHaas99 Dec 14, 2024
30257c3
no safepoint needed for store in flat array
MichaelHaas99 Dec 17, 2024
4ee39c3
allow jtreg test cases to test graal with additional options
MichaelHaas99 Dec 17, 2024
a2dbe6d
Extend JVMCI such that Graal can handle null-restricted, non-flat inl…
MichaelHaas99 Dec 19, 2024
3edbd38
Declared new entry points
MichaelHaas99 Dec 23, 2024
6fdc233
Made scalarized calling convention available over JVMCI
MichaelHaas99 Dec 23, 2024
8f532a5
Small adaptions on interface for new calling convention
MichaelHaas99 Dec 23, 2024
d047d51
Extended the amd64 register interface for the new return convention (…
MichaelHaas99 Dec 26, 2024
2704d03
First basic implementations to support the scalarized return conventi…
MichaelHaas99 Dec 30, 2024
42f2bf3
Changed interface that checks for a scalarized return
MichaelHaas99 Dec 31, 2024
a31a07c
Fixed bug in code which computes the floating point return registers
MichaelHaas99 Dec 31, 2024
7dbe6f8
Undo wrong changes on return convention interface again. Doesn't deli…
MichaelHaas99 Jan 1, 2025
fe455ec
Refactored interface for scalarized return
MichaelHaas99 Jan 1, 2025
1f04746
Fixed bug, isInit information should be int no oop
MichaelHaas99 Jan 4, 2025
b4a6492
Renamed non null information in debug info to isNotNull
MichaelHaas99 Jan 4, 2025
824afbe
Updated test framework, include TestCallingConvention test
MichaelHaas99 Jan 7, 2025
c57d9e5
Some changes on interface for new calling convention
MichaelHaas99 Jan 10, 2025
8d2ec55
Include the receiver in utility functions for new calling convention.…
MichaelHaas99 Jan 13, 2025
a601bf2
Fixed bug in interface responsible for retrieving scalarized parameters
MichaelHaas99 Jan 14, 2025
1ecef2e
Use the verified_inline_entry point for calls from the interpreter to…
MichaelHaas99 Jan 18, 2025
3ec246d
Fix access to static field in class object
MichaelHaas99 Jan 20, 2025
03e2ee8
Avoid null check for virtual calls with jvmci as caller and a scalari…
MichaelHaas99 Jan 20, 2025
8b44917
Include jvmci in condition
MichaelHaas99 Jan 20, 2025
48cb2ab
Do an extra case check for JVMCI at the moment because method attache…
MichaelHaas99 Jan 20, 2025
e3d9a78
Avoid null check on receiver for invokeinterface with scalarized argu…
MichaelHaas99 Jan 22, 2025
65bcc81
frame::sender_for_compiled_frame in frame_x86.inline.hpp causes SIGSE…
MichaelHaas99 Jan 22, 2025
f3eb699
Don't try to initialize holder class when doing a check if static fie…
MichaelHaas99 Jan 29, 2025
47636b7
Undo changes made because JIT method was not attached in by Graal
MichaelHaas99 Jan 29, 2025
06d853a
Attach a JIT method during relocation if the method has a scalarized …
MichaelHaas99 Jan 29, 2025
2a56481
Enable inlining of methods with scalarized parameters again.
MichaelHaas99 Feb 3, 2025
7bb56ba
Refactored interface for calling convention
MichaelHaas99 Feb 8, 2025
98000f5
Fixed bug in calling convention interface after refactoring.
MichaelHaas99 Feb 12, 2025
db70238
Make SharedRuntime::store_inline_type_fields_to_buf accessible for Gr…
MichaelHaas99 Feb 20, 2025
df0442e
Set return_scalarized in debug recorder.
MichaelHaas99 Feb 20, 2025
834b804
Commit before rebase.
MichaelHaas99 Feb 20, 2025
2558e99
Fixed bugs after rebasing.
MichaelHaas99 Feb 22, 2025
00d454f
Set outer declaring class for flat fields correctly.
MichaelHaas99 Feb 25, 2025
48c2442
Adaptions on jtreg test case scenarios.
MichaelHaas99 Feb 25, 2025
3f5b908
Pull-request review.
MichaelHaas99 Mar 5, 2025
2d41b6f
Correct identity check.
MichaelHaas99 Mar 5, 2025
53fd54f
Provide a runtime function for the identity exception.
MichaelHaas99 Mar 7, 2025
13e6ba3
The base offset of flat arrays is now the same as that used for objec…
MichaelHaas99 Mar 7, 2025
ef79f27
Renamed calling convention function.
MichaelHaas99 Mar 7, 2025
16399db
Adapted isIdentity implementation.
MichaelHaas99 Mar 9, 2025
1930442
Fix bug causing Graal annotation processor to fail.
MichaelHaas99 Mar 10, 2025
ced28d6
Reinstall old Field constructor in reflection for libgraal.
MichaelHaas99 Mar 10, 2025
fdb1690
Use the valhalla enabled option when retrieving instance fields.
MichaelHaas99 Mar 11, 2025
7c00b05
Renamed isNotNull to nonNull.
MichaelHaas99 Mar 11, 2025
22cdadd
Added comments in jvmciCodeInstaller.
MichaelHaas99 Mar 11, 2025
8da6804
Don't scalarize parameters if there is a mismatch.
MichaelHaas99 Mar 20, 2025
9446b94
Include the outer declaring class in the equals method of the Resolve…
MichaelHaas99 Mar 24, 2025
8d5a1fe
Fixed bug during constant folding of load field. Sanity check for an …
MichaelHaas99 Mar 29, 2025
a8af251
Use a JavaType array to avoid error, some types may not be resolved.
MichaelHaas99 Mar 30, 2025
8b96ff3
Added jdk internal exports to microbenchmark makefile, to get master …
MichaelHaas99 Apr 8, 2025
484646a
Started with some prototype benchmarks for the master thesis.
MichaelHaas99 Apr 8, 2025
9e690d4
Additional verified entry points for the calling convention are initi…
MichaelHaas99 Apr 11, 2025
2a72f89
Avoid sanity check when computing hash code in libgraal.
MichaelHaas99 Apr 11, 2025
373cf95
Primitive type of void class is not found, avoid an error for the mom…
MichaelHaas99 Apr 11, 2025
8f895ce
Adapted implementation of getIdentityHashCode in compilerToVm to also…
MichaelHaas99 Apr 11, 2025
0fe0119
Valhalla extended the BasicType by T_FLAT_ELEMENT, which has the valu…
MichaelHaas99 Apr 11, 2025
9b64c8f
Use the object handle to compute a hashcode for hotspot objects in li…
MichaelHaas99 Apr 15, 2025
a69010b
Search for an existing inline type oop during handle creation.
MichaelHaas99 Apr 15, 2025
86a557d
Made acmp profiling method default.
MichaelHaas99 Apr 22, 2025
f296c79
Jtreg test case adaptions.
MichaelHaas99 Apr 22, 2025
5ae4805
Benchmark adaptions.
MichaelHaas99 Apr 22, 2025
a70d96f
Use default methods in JVMCI.
MichaelHaas99 Apr 22, 2025
de5a48d
Updated location of value class jar.
MichaelHaas99 Apr 22, 2025
0d10821
Restore deleted JVMCI method.
MichaelHaas99 Apr 23, 2025
052d130
Don't constant fold the equality comparison of two value objects in l…
MichaelHaas99 Apr 29, 2025
caa8444
Benchmark updates for master thesis.
MichaelHaas99 Apr 29, 2025
74a4522
Provide functionality to check for mismatches on the calling convention.
MichaelHaas99 May 27, 2025
30acc74
Replace raw arrays with List in JVMCI.
MichaelHaas99 May 28, 2025
a39472e
Renamed firstFieldOffset to payloadOffset.
MichaelHaas99 May 28, 2025
d987be7
Renamed outerDeclaringClass to containerClass.
MichaelHaas99 Jun 2, 2025
b9c697b
Refactored JVMCI changes.
MichaelHaas99 Jun 3, 2025
3823b2a
Provide access to the ValueObjectMethods class over JVMCI.
MichaelHaas99 Jun 26, 2025
1728fe5
Changed absolute to relative path.
MichaelHaas99 Jul 1, 2025
4bf3091
Fixed trailing whitespace.
MichaelHaas99 Jul 1, 2025
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
6 changes: 6 additions & 0 deletions make/test/BuildMicrobenchmark.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,20 @@ $(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
--add-exports java.base/sun.security.util=ALL-UNNAMED \
--add-exports java.base/sun.security.util.math=ALL-UNNAMED \
--add-exports java.base/sun.security.util.math.intpoly=ALL-UNNAMED \
--add-exports java.base/jdk.internal.vm.annotation=ALL-UNNAMED \
--enable-preview \
--patch-module java.base=$(JAVA_HOME)/lib/valueclasses/java.base-valueclasses.jar \
--add-exports java.base/jdk.internal.value=ALL-UNNAMED \
-XDsuppressNotes \
-processor org.openjdk.jmh.generators.BenchmarkProcessor \
-s $(MICROBENCHMARK_GENSRC), \
JAVA_FLAGS := \
--add-exports java.base/jdk.internal.vm=ALL-UNNAMED \
--add-modules jdk.unsupported \
--add-modules java.base \
--add-exports java.base/jdk.internal.vm.annotation=ALL-UNNAMED \
--enable-preview \
--add-exports java.base/jdk.internal.value=ALL-UNNAMED \
--limit-modules java.management, \
))

Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,23 @@ void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &cbuf, methodHandle& metho
case INVOKEINTERFACE: {
assert(!method->is_static(), "cannot call static method with invokeinterface");
call = nativeCall_at(_instructions->start() + pc_offset);
// TODO: attach method for valhalla calling convention see jvmciCodeInstaller_x86.cpp
_instructions->relocate(call->instruction_address(), virtual_call_Relocation::spec(_invoke_mark_pc));
call->trampoline_jump(cbuf, SharedRuntime::get_resolve_virtual_call_stub(), JVMCI_CHECK);
break;
}
case INVOKESTATIC: {
assert(method->is_static(), "cannot call non-static method with invokestatic");
call = nativeCall_at(_instructions->start() + pc_offset);
// TODO: attach method for valhalla calling convention see jvmciCodeInstaller_x86.cpp
_instructions->relocate(call->instruction_address(), relocInfo::static_call_type);
call->trampoline_jump(cbuf, SharedRuntime::get_resolve_static_call_stub(), JVMCI_CHECK);
break;
}
case INVOKESPECIAL: {
assert(!method->is_static(), "cannot call static method with invokespecial");
call = nativeCall_at(_instructions->start() + pc_offset);
// TODO: attach method for valhalla calling convention see jvmciCodeInstaller_x86.cpp
_instructions->relocate(call->instruction_address(), relocInfo::opt_virtual_call_type);
call->trampoline_jump(cbuf, SharedRuntime::get_resolve_opt_virtual_call_stub(), JVMCI_CHECK);
break;
Expand Down
29 changes: 26 additions & 3 deletions src/hotspot/cpu/x86/jvmciCodeInstaller_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,26 +164,49 @@ void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &, methodHandle& method, j

call = nativeCall_at(_instructions->start() + pc_offset);
call->set_destination(SharedRuntime::get_resolve_virtual_call_stub());
if (method->has_scalarized_args() && !method->mismatch()) {
_instructions->relocate(call->instruction_address(),
virtual_call_Relocation::spec(_invoke_mark_pc),
virtual_call_Relocation::spec(_invoke_mark_pc, _oop_recorder->find_index(method())),
Assembler::call32_operand);
} else {
_instructions->relocate(call->instruction_address(),
virtual_call_Relocation::spec(_invoke_mark_pc),
Assembler::call32_operand);
}
break;
}
case INVOKESTATIC: {
assert(method->is_static(), "cannot call non-static method with invokestatic");

call = nativeCall_at(_instructions->start() + pc_offset);
call->set_destination(SharedRuntime::get_resolve_static_call_stub());
_instructions->relocate(call->instruction_address(),
// calls to the ValueObjectMethods class do not exist in bytecode, need to attach them
if (method->has_scalarized_args() || method() == Universe::is_substitutable_method() || method() == Universe::value_object_hash_code_method()) {
_instructions->relocate(call->instruction_address(),
relocInfo::static_call_type, Assembler::call32_operand,_oop_recorder->find_index(method()));
}else{
_instructions->relocate(call->instruction_address(),
relocInfo::static_call_type, Assembler::call32_operand);
}

break;
}
case INVOKESPECIAL: {
assert(!method->is_static(), "cannot call static method with invokespecial");
call = nativeCall_at(_instructions->start() + pc_offset);
call->set_destination(SharedRuntime::get_resolve_opt_virtual_call_stub());
_instructions->relocate(call->instruction_address(),

// attach the target method only for scalarized args to avoid a null check on the receiver if receiver was optimized from non-scalarized to scalarized
// attach only for scalarized args otherwise assert(attached_method->has_scalarized_args(), "invalid use of attached method"); will trigger
// see resolved_method_index in machnode.hpp
if (method->has_scalarized_args() && !method->mismatch()) {
_instructions->relocate(call->instruction_address(),
relocInfo::opt_virtual_call_type, Assembler::call32_operand, _oop_recorder->find_index(method()));
} else {
_instructions->relocate(call->instruction_address(),
relocInfo::opt_virtual_call_type, Assembler::call32_operand);
}

break;
}
default:
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/code/nmethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ void nmethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map

// If inline types are passed as fields, use the extended signature
// which contains the types of all (oop) fields of the inline type.
if (is_compiled_by_c2() && callee->has_scalarized_args()) {
if ((is_compiled_by_c2() || is_compiled_by_jvmci()) && callee->has_scalarized_args()) {
const GrowableArray<SigEntry>* sig = callee->adapter()->get_sig_cc();
assert(sig != nullptr, "sig should never be null");
TempNewSymbol tmp_sig = SigEntry::create_symbol(sig);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/code/nmethod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ class nmethod : public CodeBlob {
bool needs_stack_repair() const {
if (is_compiled_by_c1()) {
return method()->c1_needs_stack_repair();
} else if (is_compiled_by_c2()) {
} else if (is_compiled_by_c2() || is_compiled_by_jvmci()) {
return method()->c2_needs_stack_repair();
} else {
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/interpreter/linkResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,7 @@ void LinkResolver::resolve_invokevirtual(CallInfo& result, Handle recv,
void LinkResolver::resolve_invokeinterface(CallInfo& result, Handle recv, const constantPoolHandle& pool, int index, TRAPS) {
LinkInfo link_info(pool, index, Bytecodes::_invokeinterface, CHECK);
Klass* recvrKlass = recv.is_null() ? (Klass*)nullptr : recv->klass();
resolve_interface_call(result, recv, recvrKlass, link_info, true, CHECK);
resolve_interface_call(result, recv, recvrKlass, link_info, /*check_null_or_abstract*/true, CHECK);
}

bool LinkResolver::resolve_previously_linked_invokehandle(CallInfo& result, const LinkInfo& link_info, const constantPoolHandle& pool, int index, TRAPS) {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/interpreter/linkResolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class LinkResolver: AllStatic {
// runtime resolving from attached method
static void resolve_invoke(CallInfo& result, Handle& recv,
const methodHandle& attached_method,
Bytecodes::Code byte, bool check_null_and_abstract, TRAPS);
Bytecodes::Code byte, bool check_null_or_abstract, TRAPS);

// Only resolved method known.
static void throw_abstract_method_error(const methodHandle& resolved_method, TRAPS) {
Expand Down
44 changes: 42 additions & 2 deletions src/hotspot/share/jvmci/jvmciCodeInstaller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
#include "runtime/os.hpp"
#include "runtime/sharedRuntime.hpp"
#include "utilities/align.hpp"
#include "ci/ciSignature.hpp"
#include "oops/inlineKlass.hpp"
#include "runtime/globals.hpp"

// frequently used constants
// Allocate them with new so they are never destroyed (otherwise, a
Expand Down Expand Up @@ -778,6 +781,14 @@ JVMCI::CodeInstallResult CodeInstaller::install(JVMCICompiler* compiler,
JVMCI_THROW_MSG_(IllegalArgumentException, "nmethod entry barrier is missing", JVMCI::ok);
}

if(_offsets.value(CodeOffsets::Verified_Inline_Entry) == -1) {
_offsets.set_value(CodeOffsets::Verified_Inline_Entry, _offsets.value(CodeOffsets::Verified_Entry));
}

if(_offsets.value(CodeOffsets::Verified_Inline_Entry_RO) == -1) {
_offsets.set_value(CodeOffsets::Verified_Inline_Entry_RO, _offsets.value(CodeOffsets::Verified_Entry));
}

JVMCIObject mirror = installed_code;
nmethod* nm = nullptr; // nm is an out parameter of register_method
result = runtime()->register_method(jvmci_env(),
Expand Down Expand Up @@ -1098,9 +1109,19 @@ void CodeInstaller::read_virtual_objects(HotSpotCompiledCodeStream* stream, JVMC
if (is_auto_box) {
_has_auto_box = true;
}
// see code in output.cpp line 812 (PhaseOutput::FillLocArray line)
bool check_is_not_null = stream->read_bool("nonNull");
ScopeValue *is_init = nullptr;
if (check_is_not_null) {
ScopeValue* cur_second = nullptr;
BasicType type = (BasicType) stream->read_u1("basicType");
ScopeValue* value;
u1 tag = stream->read_u1("tag");
is_init = get_scope_value(stream, tag, type, cur_second, JVMCI_CHECK);
}
oop javaMirror = klass->java_mirror();
ScopeValue *klass_sv = new ConstantOopWriteValue(JNIHandles::make_local(javaMirror));
ObjectValue* sv = is_auto_box ? new AutoBoxObjectValue(id, klass_sv) : new ObjectValue(id, klass_sv);
ObjectValue* sv = is_auto_box ? new AutoBoxObjectValue(id, klass_sv) : new ObjectValue(id, klass_sv, true, is_init);
objects->at_put(id, sv);
}
// All the values which could be referenced by the VirtualObjects
Expand Down Expand Up @@ -1128,6 +1149,18 @@ int CodeInstaller::map_jvmci_bci(int bci) {
return bci;
}

bool has_scalarized_return(methodHandle& methodHandle){
if (!InlineTypeReturnedAsFields) {
return false;
}
Method* method = methodHandle();
InlineKlass* klass = method->returns_inline_type(Thread::current());
if (klass != nullptr) {
return !method->is_native() && klass->can_be_returned_as_fields();
}
return false;
}

void CodeInstaller::record_scope(jint pc_offset, HotSpotCompiledCodeStream* stream, u1 debug_info_flags, bool full_info, bool is_mh_invoke, bool return_oop, JVMCI_TRAPS) {
if (full_info) {
read_virtual_objects(stream, JVMCI_CHECK);
Expand Down Expand Up @@ -1169,7 +1202,7 @@ void CodeInstaller::record_scope(jint pc_offset, HotSpotCompiledCodeStream* stre
}

// has_ea_local_in_scope and arg_escape should be added to JVMCI
const bool return_scalarized = false;
const bool return_scalarized = has_scalarized_return(method);
const bool has_ea_local_in_scope = false;
const bool arg_escape = false;
_debug_recorder->describe_scope(pc_offset, method, nullptr, bci, reexecute, rethrow_exception, is_mh_invoke, return_oop,
Expand Down Expand Up @@ -1315,9 +1348,16 @@ void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, HotSpotCompile
case UNVERIFIED_ENTRY:
_offsets.set_value(CodeOffsets::Entry, pc_offset);
break;
case INLINE_ENTRY:
_offsets.set_value(CodeOffsets::Inline_Entry, pc_offset);
break;
case VERIFIED_ENTRY:
_offsets.set_value(CodeOffsets::Verified_Entry, pc_offset);
break;
case VERIFIED_INLINE_ENTRY:
_offsets.set_value(CodeOffsets::Verified_Inline_Entry, pc_offset);
break;
case VERIFIED_INLINE_ENTRY_RO:
_offsets.set_value(CodeOffsets::Verified_Inline_Entry_RO, pc_offset);
break;
case OSR_ENTRY:
Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/share/jvmci/jvmciCodeInstaller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ class CodeInstaller : public StackObj {
enum MarkId {
INVALID_MARK,
VERIFIED_ENTRY,
VERIFIED_INLINE_ENTRY,
VERIFIED_INLINE_ENTRY_RO,
UNVERIFIED_ENTRY,
INLINE_ENTRY,
OSR_ENTRY,
EXCEPTION_HANDLER_ENTRY,
DEOPT_HANDLER_ENTRY,
Expand Down
Loading
Loading