Skip to content

Commit

Permalink
8330011: [s390x] update block-comments to make code consistent
Browse files Browse the repository at this point in the history
Reviewed-by: lucy
Backport-of: 01bda278d6a498ca89c0bc5218680cd51a04e9d3
  • Loading branch information
offamitkumar authored and shipilev committed May 6, 2024
1 parent abbad92 commit 3ff5359
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 28 deletions.
34 changes: 18 additions & 16 deletions src/hotspot/cpu/s390/downcallLinker_s390.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -166,10 +166,10 @@ void DowncallStubGenerator::generate() {
locs.set(StubLocations::TARGET_ADDRESS, _abi._scratch2);

if (_captured_state_mask != 0) {
__ block_comment("{ _captured_state_mask is set");
__ block_comment("_captured_state_mask_is_set {");
locs.set_frame_data(StubLocations::CAPTURED_STATE_BUFFER, allocated_frame_size);
allocated_frame_size += BytesPerWord;
__ block_comment("} _captured_state_mask is set");
__ block_comment("} _captured_state_mask_is_set");
}

allocated_frame_size = align_up(allocated_frame_size, StackAlignmentInBytes);
Expand All @@ -184,7 +184,7 @@ void DowncallStubGenerator::generate() {
_frame_complete = __ pc() - start; // frame build complete.

if (_needs_transition) {
__ block_comment("{ thread java2native");
__ block_comment("thread_java2native {");
__ get_PC(Z_R1_scratch);
address the_pc = __ pc();
__ set_last_Java_frame(Z_SP, Z_R1_scratch);
Expand All @@ -194,18 +194,18 @@ void DowncallStubGenerator::generate() {

// State transition
__ set_thread_state(_thread_in_native);
__ block_comment("} thread java2native");
__ block_comment("} thread_java2native");
}
__ block_comment("{ argument shuffle");
__ block_comment("argument_shuffle {");
arg_shuffle.generate(_masm, shuffle_reg, frame::z_jit_out_preserve_size, _abi._shadow_space_bytes, locs);
__ block_comment("} argument shuffle");
__ block_comment("} argument_shuffle");

__ call(as_Register(locs.get(StubLocations::TARGET_ADDRESS)));

//////////////////////////////////////////////////////////////////////////////

if (_captured_state_mask != 0) {
__ block_comment("{ save thread local");
__ block_comment("save_thread_local {");

out_reg_spiller.generate_spill(_masm, spill_offset);

Expand All @@ -216,7 +216,7 @@ void DowncallStubGenerator::generate() {

out_reg_spiller.generate_fill(_masm, spill_offset);

__ block_comment("} save thread local");
__ block_comment("} save_thread_local");
}

//////////////////////////////////////////////////////////////////////////////
Expand All @@ -227,7 +227,7 @@ void DowncallStubGenerator::generate() {
Label L_after_reguard;

if (_needs_transition) {
__ block_comment("{ thread native2java");
__ block_comment("thread_native2java {");
__ set_thread_state(_thread_in_native_trans);

if (!UseSystemMemoryBarrier) {
Expand All @@ -244,14 +244,16 @@ void DowncallStubGenerator::generate() {
// change thread state
__ set_thread_state(_thread_in_Java);

__ block_comment("reguard stack check");
__ z_cli(Address(Z_thread, JavaThread::stack_guard_state_offset() + in_ByteSize(sizeof(StackOverflow::StackGuardState) - 1)),
StackOverflow::stack_guard_yellow_reserved_disabled);
__ block_comment("reguard_stack_check {");
__ z_cli(Address(Z_thread,
JavaThread::stack_guard_state_offset() + in_ByteSize(sizeof(StackOverflow::StackGuardState) - 1)),
StackOverflow::stack_guard_yellow_reserved_disabled);
__ z_bre(L_reguard);
__ block_comment("} reguard_stack_check");
__ bind(L_after_reguard);

__ reset_last_Java_frame();
__ block_comment("} thread native2java");
__ block_comment("} thread_native2java");
}

__ pop_frame();
Expand All @@ -261,7 +263,7 @@ void DowncallStubGenerator::generate() {
//////////////////////////////////////////////////////////////////////////////

if (_needs_transition) {
__ block_comment("{ L_safepoint_poll_slow_path");
__ block_comment("L_safepoint_poll_slow_path {");
__ bind(L_safepoint_poll_slow_path);

// Need to save the native result registers around any runtime calls.
Expand All @@ -277,7 +279,7 @@ void DowncallStubGenerator::generate() {
__ block_comment("} L_safepoint_poll_slow_path");

//////////////////////////////////////////////////////////////////////////////
__ block_comment("{ L_reguard");
__ block_comment("L_reguard {");
__ bind(L_reguard);

// Need to save the native result registers around any runtime calls.
Expand Down
24 changes: 12 additions & 12 deletions src/hotspot/cpu/s390/upcallLinker_s390.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static void preserve_callee_saved_registers(MacroAssembler* _masm, const ABIDesc

int offset = reg_save_area_offset;

__ block_comment("{ preserve_callee_saved_regs ");
__ block_comment("preserve_callee_saved_regs {");
for (int i = 0; i < Register::number_of_registers; i++) {
Register reg = as_Register(i);
// Z_SP saved/restored by prologue/epilogue
Expand All @@ -82,7 +82,7 @@ static void preserve_callee_saved_registers(MacroAssembler* _masm, const ABIDesc
}
}

__ block_comment("} preserve_callee_saved_regs ");
__ block_comment("} preserve_callee_saved_regs");
}

static void restore_callee_saved_registers(MacroAssembler* _masm, const ABIDescriptor& abi, int reg_save_area_offset) {
Expand All @@ -92,7 +92,7 @@ static void restore_callee_saved_registers(MacroAssembler* _masm, const ABIDescr

int offset = reg_save_area_offset;

__ block_comment("{ restore_callee_saved_regs ");
__ block_comment("restore_callee_saved_regs {");
for (int i = 0; i < Register::number_of_registers; i++) {
Register reg = as_Register(i);
// Z_SP saved/restored by prologue/epilogue
Expand All @@ -111,7 +111,7 @@ static void restore_callee_saved_registers(MacroAssembler* _masm, const ABIDescr
}
}

__ block_comment("} restore_callee_saved_regs ");
__ block_comment("} restore_callee_saved_regs");
}

static const int upcall_stub_code_base_size = 1024; // depends on GC (resolve_jobject)
Expand Down Expand Up @@ -199,22 +199,22 @@ address UpcallLinker::make_upcall_stub(jobject receiver, Method* entry,
// Java methods won't preserve them, so save them here:
preserve_callee_saved_registers(_masm, abi, reg_save_area_offset);

__ block_comment("{ on_entry");
__ block_comment("on_entry {");
__ load_const_optimized(call_target_address, CAST_FROM_FN_PTR(uint64_t, UpcallLinker::on_entry));
__ z_aghik(Z_ARG1, Z_SP, frame_data_offset);
__ call(call_target_address);
__ z_lgr(Z_thread, Z_RET);
__ block_comment("} on_entry");

arg_spiller.generate_fill(_masm, arg_save_area_offset);
__ block_comment("{ argument shuffle");
__ block_comment("argument_shuffle {");
arg_shuffle.generate(_masm, shuffle_reg, abi._shadow_space_bytes, frame::z_jit_out_preserve_size, locs);
__ block_comment("} argument shuffle");
__ block_comment("} argument_shuffle");

__ block_comment("{ receiver ");
__ block_comment("receiver {");
__ load_const_optimized(Z_ARG1, (intptr_t)receiver);
__ resolve_jobject(Z_ARG1, Z_tmp_1, Z_tmp_2);
__ block_comment("} receiver ");
__ block_comment("} receiver");

__ load_const_optimized(Z_method, (intptr_t)entry);
__ z_stg(Z_method, Address(Z_thread, in_bytes(JavaThread::callee_target_offset())));
Expand Down Expand Up @@ -250,7 +250,7 @@ address UpcallLinker::make_upcall_stub(jobject receiver, Method* entry,

result_spiller.generate_spill(_masm, res_save_area_offset);

__ block_comment("{ on_exit");
__ block_comment("on_exit {");
__ load_const_optimized(call_target_address, CAST_FROM_FN_PTR(uint64_t, UpcallLinker::on_exit));
__ z_aghik(Z_ARG1, Z_SP, frame_data_offset);
__ call(call_target_address);
Expand All @@ -266,7 +266,7 @@ address UpcallLinker::make_upcall_stub(jobject receiver, Method* entry,

//////////////////////////////////////////////////////////////////////////////

__ block_comment("{ exception handler");
__ block_comment("exception_handler {");

intptr_t exception_handler_offset = __ pc() - start;

Expand All @@ -277,7 +277,7 @@ address UpcallLinker::make_upcall_stub(jobject receiver, Method* entry,
__ call_c(call_target_address);
__ should_not_reach_here();

__ block_comment("} exception handler");
__ block_comment("} exception_handler");

_masm->flush();

Expand Down

1 comment on commit 3ff5359

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.