Skip to content

Commit 3c10b5d

Browse files
committed
8278104: C1 should support the compiler directive 'BreakAtExecute'
Reviewed-by: xliu, phh, kvn
1 parent cc44e13 commit 3c10b5d

File tree

8 files changed

+26
-14
lines changed

8 files changed

+26
-14
lines changed

src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ void C1_MacroAssembler::remove_frame(int framesize) {
304304
}
305305

306306

307-
void C1_MacroAssembler::verified_entry() {
307+
void C1_MacroAssembler::verified_entry(bool breakAtEntry) {
308308
// If we have to make this method not-entrant we'll overwrite its
309309
// first instruction with a jump. For this action to be legal we
310310
// must ensure that this first instruction is a B, BL, NOP, BKPT,

src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ void C1_MacroAssembler::remove_frame(int frame_size_in_bytes) {
6969
raw_pop(FP, LR);
7070
}
7171

72-
void C1_MacroAssembler::verified_entry() {
73-
if (C1Breakpoint) {
72+
void C1_MacroAssembler::verified_entry(bool breakAtEntry) {
73+
if (breakAtEntry) {
7474
breakpoint();
7575
}
7676
}

src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ void C1_MacroAssembler::build_frame(int frame_size_in_bytes, int bang_size_in_by
8686
}
8787

8888

89-
void C1_MacroAssembler::verified_entry() {
90-
if (C1Breakpoint) illtrap();
89+
void C1_MacroAssembler::verified_entry(bool breakAtEntry) {
90+
if (breakAtEntry) illtrap();
9191
// build frame
9292
}
9393

src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ void C1_MacroAssembler::build_frame(int frame_size_in_bytes, int bang_size_in_by
7373
push_frame(frame_size_in_bytes);
7474
}
7575

76-
void C1_MacroAssembler::verified_entry() {
77-
if (C1Breakpoint) z_illtrap(0xC1);
76+
void C1_MacroAssembler::verified_entry(bool breakAtEntry) {
77+
if (breakAtEntry) z_illtrap(0xC1);
7878
}
7979

8080
void C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr, Label& slow_case) {

src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,18 +331,18 @@ void C1_MacroAssembler::remove_frame(int frame_size_in_bytes) {
331331
}
332332

333333

334-
void C1_MacroAssembler::verified_entry() {
335-
if (C1Breakpoint || VerifyFPU) {
334+
void C1_MacroAssembler::verified_entry(bool breakAtEntry) {
335+
if (breakAtEntry || VerifyFPU) {
336336
// Verified Entry first instruction should be 5 bytes long for correct
337337
// patching by patch_verified_entry().
338338
//
339-
// C1Breakpoint and VerifyFPU have one byte first instruction.
339+
// Breakpoint and VerifyFPU have one byte first instruction.
340340
// Also first instruction will be one byte "push(rbp)" if stack banging
341341
// code is not generated (see build_frame() above).
342342
// For all these cases generate long instruction first.
343343
fat_nop();
344344
}
345-
if (C1Breakpoint)int3();
345+
if (breakAtEntry) int3();
346346
// build frame
347347
IA32_ONLY( verify_FPU(0, "method_entry"); )
348348
}

src/hotspot/share/c1/c1_LIRAssembler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ void LIR_Assembler::emit_op0(LIR_Op0* op) {
607607
check_icache();
608608
}
609609
offsets()->set_value(CodeOffsets::Verified_Entry, _masm->offset());
610-
_masm->verified_entry();
610+
_masm->verified_entry(compilation()->directive()->BreakAtExecuteOption);
611611
if (needs_clinit_barrier_on_entry(compilation()->method())) {
612612
clinit_barrier(compilation()->method());
613613
}

src/hotspot/share/c1/c1_MacroAssembler.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@ class C1_MacroAssembler: public MacroAssembler {
4242
void build_frame(int frame_size_in_bytes, int bang_size_in_bytes);
4343
void remove_frame(int frame_size_in_bytes);
4444

45-
void verified_entry();
45+
void verified_entry(bool breakAtEntry);
4646
void verify_stack_oop(int offset) PRODUCT_RETURN;
4747
void verify_not_null_oop(Register r) PRODUCT_RETURN;
4848

src/hotspot/share/compiler/compilerDirectives.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,21 @@ DirectiveSet* DirectiveSet::compilecommand_compatibility_init(const methodHandle
334334
if (!CompilerDirectivesIgnoreCompileCommandsOption && CompilerOracle::has_any_command_set()) {
335335
DirectiveSetPtr set(this);
336336

337+
#ifdef COMPILER1
338+
if (C1Breakpoint) {
339+
// If the directives didn't have 'BreakAtExecute',
340+
// the command 'C1Breakpoint' would become effective.
341+
if (!_modified[BreakAtExecuteIndex]) {
342+
set.cloned()->BreakAtExecuteOption = true;
343+
}
344+
}
345+
#endif
346+
337347
// All CompileCommands are not equal so this gets a bit verbose
338348
// When CompileCommands have been refactored less clutter will remain.
339349
if (CompilerOracle::should_break_at(method)) {
350+
// If the directives didn't have 'BreakAtCompile' or 'BreakAtExecute',
351+
// the sub-command 'Break' of the 'CompileCommand' would become effective.
340352
if (!_modified[BreakAtCompileIndex]) {
341353
set.cloned()->BreakAtCompileOption = true;
342354
}

0 commit comments

Comments
 (0)