Skip to content

Commit

Permalink
Update (2024.10.31, 2nd)
Browse files Browse the repository at this point in the history
34933: LA port of 8339849: Enumerate opto and C1 stubs, generate enums, names, fields and generator calls
  • Loading branch information
loongson-jvm authored Oct 31, 2024
1 parent 26a2aee commit 8c74573
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 97 deletions.
46 changes: 23 additions & 23 deletions src/hotspot/cpu/loongarch/c1_CodeStubs_loongarch_64.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2023, Loongson Technology. All rights reserved.
* Copyright (c) 2021, 2024, Loongson Technology. 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 @@ -56,7 +56,7 @@ void CounterOverflowStub::emit_code(LIR_Assembler* ce) {
__ mov_metadata(SCR2, m);
ce->store_parameter(SCR2, 1);
ce->store_parameter(_bci, 0);
__ call(Runtime1::entry_for(Runtime1::counter_overflow_id), relocInfo::runtime_call_type);
__ call(Runtime1::entry_for(C1StubId::counter_overflow_id), relocInfo::runtime_call_type);
ce->add_call_info_here(_info);
ce->verify_oop_map(_info);
__ b(_continuation);
Expand All @@ -65,7 +65,7 @@ void CounterOverflowStub::emit_code(LIR_Assembler* ce) {
void RangeCheckStub::emit_code(LIR_Assembler* ce) {
__ bind(_entry);
if (_info->deoptimize_on_exception()) {
address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
address a = Runtime1::entry_for(C1StubId::predicate_failed_trap_id);
__ call(a, relocInfo::runtime_call_type);
ce->add_call_info_here(_info);
ce->verify_oop_map(_info);
Expand All @@ -78,13 +78,13 @@ void RangeCheckStub::emit_code(LIR_Assembler* ce) {
} else {
__ li(SCR1, _index->as_jint());
}
Runtime1::StubID stub_id;
C1StubId stub_id;
if (_throw_index_out_of_bounds_exception) {
stub_id = Runtime1::throw_index_exception_id;
stub_id = C1StubId::throw_index_exception_id;
} else {
assert(_array != LIR_Opr::nullOpr(), "sanity");
__ move(SCR2, _array->as_pointer_register());
stub_id = Runtime1::throw_range_check_failed_id;
stub_id = C1StubId::throw_range_check_failed_id;
}
__ call(Runtime1::entry_for(stub_id), relocInfo::runtime_call_type);
ce->add_call_info_here(_info);
Expand All @@ -98,7 +98,7 @@ PredicateFailedStub::PredicateFailedStub(CodeEmitInfo* info) {

void PredicateFailedStub::emit_code(LIR_Assembler* ce) {
__ bind(_entry);
address a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
address a = Runtime1::entry_for(C1StubId::predicate_failed_trap_id);
__ call(a, relocInfo::runtime_call_type);
ce->add_call_info_here(_info);
ce->verify_oop_map(_info);
Expand All @@ -110,7 +110,7 @@ void DivByZeroStub::emit_code(LIR_Assembler* ce) {
ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
}
__ bind(_entry);
__ call(Runtime1::entry_for(Runtime1::throw_div0_exception_id), relocInfo::runtime_call_type);
__ call(Runtime1::entry_for(C1StubId::throw_div0_exception_id), relocInfo::runtime_call_type);
ce->add_call_info_here(_info);
ce->verify_oop_map(_info);
#ifdef ASSERT
Expand All @@ -121,14 +121,14 @@ void DivByZeroStub::emit_code(LIR_Assembler* ce) {
// Implementation of NewInstanceStub

NewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass,
CodeEmitInfo* info, Runtime1::StubID stub_id) {
CodeEmitInfo* info, C1StubId stub_id) {
_result = result;
_klass = klass;
_klass_reg = klass_reg;
_info = new CodeEmitInfo(info);
assert(stub_id == Runtime1::new_instance_id ||
stub_id == Runtime1::fast_new_instance_id ||
stub_id == Runtime1::fast_new_instance_init_check_id,
assert(stub_id == C1StubId::new_instance_id ||
stub_id == C1StubId::fast_new_instance_id ||
stub_id == C1StubId::fast_new_instance_init_check_id,
"need new_instance id");
_stub_id = stub_id;
}
Expand Down Expand Up @@ -159,7 +159,7 @@ void NewTypeArrayStub::emit_code(LIR_Assembler* ce) {
__ bind(_entry);
assert(_length->as_register() == S0, "length must in S0,");
assert(_klass_reg->as_register() == A3, "klass_reg must in A3");
__ call(Runtime1::entry_for(Runtime1::new_type_array_id), relocInfo::runtime_call_type);
__ call(Runtime1::entry_for(C1StubId::new_type_array_id), relocInfo::runtime_call_type);
ce->add_call_info_here(_info);
ce->verify_oop_map(_info);
assert(_result->as_register() == A0, "result must in A0");
Expand All @@ -181,7 +181,7 @@ void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
__ bind(_entry);
assert(_length->as_register() == S0, "length must in S0,");
assert(_klass_reg->as_register() == A3, "klass_reg must in A3");
__ call(Runtime1::entry_for(Runtime1::new_object_array_id), relocInfo::runtime_call_type);
__ call(Runtime1::entry_for(C1StubId::new_object_array_id), relocInfo::runtime_call_type);
ce->add_call_info_here(_info);
ce->verify_oop_map(_info);
assert(_result->as_register() == A0, "result must in A0");
Expand All @@ -193,11 +193,11 @@ void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
__ bind(_entry);
ce->store_parameter(_obj_reg->as_register(), 1);
ce->store_parameter(_lock_reg->as_register(), 0);
Runtime1::StubID enter_id;
C1StubId enter_id;
if (ce->compilation()->has_fpu_code()) {
enter_id = Runtime1::monitorenter_id;
enter_id = C1StubId::monitorenter_id;
} else {
enter_id = Runtime1::monitorenter_nofpu_id;
enter_id = C1StubId::monitorenter_nofpu_id;
}
__ call(Runtime1::entry_for(enter_id), relocInfo::runtime_call_type);
ce->add_call_info_here(_info);
Expand All @@ -213,11 +213,11 @@ void MonitorExitStub::emit_code(LIR_Assembler* ce) {
}
ce->store_parameter(_lock_reg->as_register(), 0);
// note: non-blocking leaf routine => no call info needed
Runtime1::StubID exit_id;
C1StubId exit_id;
if (ce->compilation()->has_fpu_code()) {
exit_id = Runtime1::monitorexit_id;
exit_id = C1StubId::monitorexit_id;
} else {
exit_id = Runtime1::monitorexit_nofpu_id;
exit_id = C1StubId::monitorexit_nofpu_id;
}
__ lipc(RA, _continuation);
__ jmp(Runtime1::entry_for(exit_id), relocInfo::runtime_call_type);
Expand All @@ -243,7 +243,7 @@ void PatchingStub::emit_code(LIR_Assembler* ce) {
void DeoptimizeStub::emit_code(LIR_Assembler* ce) {
__ bind(_entry);
ce->store_parameter(_trap_request, 0);
__ call(Runtime1::entry_for(Runtime1::deoptimize_id), relocInfo::runtime_call_type);
__ call(Runtime1::entry_for(C1StubId::deoptimize_id), relocInfo::runtime_call_type);
ce->add_call_info_here(_info);
DEBUG_ONLY(__ should_not_reach_here());
}
Expand All @@ -252,9 +252,9 @@ void ImplicitNullCheckStub::emit_code(LIR_Assembler* ce) {
address a;
if (_info->deoptimize_on_exception()) {
// Deoptimize, do not throw the exception, because it is probably wrong to do it here.
a = Runtime1::entry_for(Runtime1::predicate_failed_trap_id);
a = Runtime1::entry_for(C1StubId::predicate_failed_trap_id);
} else {
a = Runtime1::entry_for(Runtime1::throw_null_pointer_exception_id);
a = Runtime1::entry_for(C1StubId::throw_null_pointer_exception_id);
}

ce->compilation()->implicit_exception_table()->append(_offset, __ offset());
Expand Down
34 changes: 17 additions & 17 deletions src/hotspot/cpu/loongarch/c1_LIRAssembler_loongarch_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,16 @@ void LIR_Assembler::deoptimize_trap(CodeEmitInfo *info) {

switch (patching_id(info)) {
case PatchingStub::access_field_id:
target = Runtime1::entry_for(Runtime1::access_field_patching_id);
target = Runtime1::entry_for(C1StubId::access_field_patching_id);
break;
case PatchingStub::load_klass_id:
target = Runtime1::entry_for(Runtime1::load_klass_patching_id);
target = Runtime1::entry_for(C1StubId::load_klass_patching_id);
break;
case PatchingStub::load_mirror_id:
target = Runtime1::entry_for(Runtime1::load_mirror_patching_id);
target = Runtime1::entry_for(C1StubId::load_mirror_patching_id);
break;
case PatchingStub::load_appendix_id:
target = Runtime1::entry_for(Runtime1::load_appendix_patching_id);
target = Runtime1::entry_for(C1StubId::load_appendix_patching_id);
break;
default: ShouldNotReachHere();
}
Expand Down Expand Up @@ -325,7 +325,7 @@ int LIR_Assembler::emit_exception_handler() {
__ verify_not_null_oop(A0);

// search an exception handler (A0: exception oop, A1: throwing pc)
__ call(Runtime1::entry_for(Runtime1::handle_exception_from_callee_id), relocInfo::runtime_call_type);
__ call(Runtime1::entry_for(C1StubId::handle_exception_from_callee_id), relocInfo::runtime_call_type);
__ should_not_reach_here();
guarantee(code_offset() - offset <= exception_handler_size(), "overflow");
__ end_a_stub();
Expand Down Expand Up @@ -379,7 +379,7 @@ int LIR_Assembler::emit_unwind_handler() {
// remove the activation and dispatch to the unwind handler
__ block_comment("remove_frame and dispatch to the unwind handler");
__ remove_frame(initial_frame_size_in_bytes());
__ jmp(Runtime1::entry_for(Runtime1::unwind_exception_id), relocInfo::runtime_call_type);
__ jmp(Runtime1::entry_for(C1StubId::unwind_exception_id), relocInfo::runtime_call_type);

// Emit the slow path assembly
if (stub != nullptr) {
Expand Down Expand Up @@ -760,16 +760,16 @@ void LIR_Assembler::klass2reg_with_patching(Register reg, CodeEmitInfo* info) {

switch (patching_id(info)) {
case PatchingStub::access_field_id:
target = Runtime1::entry_for(Runtime1::access_field_patching_id);
target = Runtime1::entry_for(C1StubId::access_field_patching_id);
break;
case PatchingStub::load_klass_id:
target = Runtime1::entry_for(Runtime1::load_klass_patching_id);
target = Runtime1::entry_for(C1StubId::load_klass_patching_id);
break;
case PatchingStub::load_mirror_id:
target = Runtime1::entry_for(Runtime1::load_mirror_patching_id);
target = Runtime1::entry_for(C1StubId::load_mirror_patching_id);
break;
case PatchingStub::load_appendix_id:
target = Runtime1::entry_for(Runtime1::load_appendix_patching_id);
target = Runtime1::entry_for(C1StubId::load_appendix_patching_id);
break;
default: ShouldNotReachHere();
}
Expand Down Expand Up @@ -1337,7 +1337,7 @@ void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck *op, Label* success,
__ addi_d(SP, SP, -2 * wordSize);
__ st_d(k_RInfo, Address(SP, 0 * wordSize));
__ st_d(klass_RInfo, Address(SP, 1 * wordSize));
__ call(Runtime1::entry_for(Runtime1::slow_subtype_check_id), relocInfo::runtime_call_type);
__ call(Runtime1::entry_for(C1StubId::slow_subtype_check_id), relocInfo::runtime_call_type);
__ ld_d(klass_RInfo, Address(SP, 0 * wordSize));
__ addi_d(SP, SP, 2 * wordSize);
// result is a boolean
Expand All @@ -1351,7 +1351,7 @@ void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck *op, Label* success,
__ addi_d(SP, SP, -2 * wordSize);
__ st_d(k_RInfo, Address(SP, 0 * wordSize));
__ st_d(klass_RInfo, Address(SP, 1 * wordSize));
__ call(Runtime1::entry_for(Runtime1::slow_subtype_check_id), relocInfo::runtime_call_type);
__ call(Runtime1::entry_for(C1StubId::slow_subtype_check_id), relocInfo::runtime_call_type);
__ ld_d(k_RInfo, Address(SP, 0 * wordSize));
__ ld_d(klass_RInfo, Address(SP, 1 * wordSize));
__ addi_d(SP, SP, 2 * wordSize);
Expand Down Expand Up @@ -1431,7 +1431,7 @@ void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) {
__ addi_d(SP, SP, -2 * wordSize);
__ st_d(k_RInfo, Address(SP, 0 * wordSize));
__ st_d(klass_RInfo, Address(SP, 1 * wordSize));
__ call(Runtime1::entry_for(Runtime1::slow_subtype_check_id), relocInfo::runtime_call_type);
__ call(Runtime1::entry_for(C1StubId::slow_subtype_check_id), relocInfo::runtime_call_type);
__ ld_d(k_RInfo, Address(SP, 0 * wordSize));
__ ld_d(klass_RInfo, Address(SP, 1 * wordSize));
__ addi_d(SP, SP, 2 * wordSize);
Expand Down Expand Up @@ -2319,7 +2319,7 @@ void LIR_Assembler::throw_op(LIR_Opr exceptionPC, LIR_Opr exceptionOop, CodeEmit
// exception object is not added to oop map by LinearScan
// (LinearScan assumes that no oops are in fixed registers)
info->add_register_oop(exceptionOop);
Runtime1::StubID unwind_id;
C1StubId unwind_id;

// get current pc information
// pc is only needed if the method has an exception handler, the unwind code does not need it.
Expand All @@ -2339,9 +2339,9 @@ void LIR_Assembler::throw_op(LIR_Opr exceptionPC, LIR_Opr exceptionOop, CodeEmit
__ verify_not_null_oop(A0);
// search an exception handler (A0: exception oop, A1: throwing pc)
if (compilation()->has_fpu_code()) {
unwind_id = Runtime1::handle_exception_id;
unwind_id = C1StubId::handle_exception_id;
} else {
unwind_id = Runtime1::handle_exception_nofpu_id;
unwind_id = C1StubId::handle_exception_nofpu_id;
}
__ call(Runtime1::entry_for(unwind_id), relocInfo::runtime_call_type);

Expand Down Expand Up @@ -2600,7 +2600,7 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
__ addi_d(SP, SP, -2 * wordSize);
__ st_d(dst, Address(SP, 0 * wordSize));
__ st_d(src, Address(SP, 1 * wordSize));
__ call(Runtime1::entry_for(Runtime1::slow_subtype_check_id), relocInfo::runtime_call_type);
__ call(Runtime1::entry_for(C1StubId::slow_subtype_check_id), relocInfo::runtime_call_type);
__ ld_d(dst, Address(SP, 0 * wordSize));
__ ld_d(src, Address(SP, 1 * wordSize));
__ addi_d(SP, SP, 2 * wordSize);
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/cpu/loongarch/c1_LIRGenerator_loongarch_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ void LIRGenerator::do_NewMultiArray(NewMultiArray* x) {
args->append(rank);
args->append(varargs);
LIR_Opr reg = result_register_for(x->type());
__ call_runtime(Runtime1::entry_for(Runtime1::new_multi_array_id),
__ call_runtime(Runtime1::entry_for(C1StubId::new_multi_array_id),
LIR_OprFact::illegalOpr,
reg, args, info);

Expand Down Expand Up @@ -1274,15 +1274,15 @@ void LIRGenerator::do_CheckCast(CheckCast* x) {
CodeStub* stub;
if (x->is_incompatible_class_change_check()) {
assert(patching_info == nullptr, "can't patch this");
stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id,
stub = new SimpleExceptionStub(C1StubId::throw_incompatible_class_change_error_id,
LIR_OprFact::illegalOpr, info_for_exception);
} else if (x->is_invokespecial_receiver_check()) {
assert(patching_info == nullptr, "can't patch this");
stub = new DeoptimizeStub(info_for_exception,
Deoptimization::Reason_class_check,
Deoptimization::Action_none);
} else {
stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id,
stub = new SimpleExceptionStub(C1StubId::throw_class_cast_exception_id,
obj.result(), info_for_exception);
}
LIR_Opr reg = rlock_result(x);
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/loongarch/c1_MacroAssembler_loongarch_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void C1_MacroAssembler::initialize_object(Register obj, Register klass, Register

if (CURRENT_ENV->dtrace_alloc_probes()) {
assert(obj == A0, "must be");
call(Runtime1::entry_for(Runtime1::dtrace_object_alloc_id), relocInfo::runtime_call_type);
call(Runtime1::entry_for(C1StubId::dtrace_object_alloc_id), relocInfo::runtime_call_type);
}

verify_oop(obj);
Expand Down Expand Up @@ -286,7 +286,7 @@ void C1_MacroAssembler::allocate_array(Register obj, Register len, Register t1,

if (CURRENT_ENV->dtrace_alloc_probes()) {
assert(obj == A0, "must be");
call(Runtime1::entry_for(Runtime1::dtrace_object_alloc_id), relocInfo::runtime_call_type);
call(Runtime1::entry_for(C1StubId::dtrace_object_alloc_id), relocInfo::runtime_call_type);
}

verify_oop(obj);
Expand Down
Loading

0 comments on commit 8c74573

Please sign in to comment.