Skip to content

Commit 10665ba

Browse files
SendaoYanRealFYang
authored andcommitted
8341562: RISC-V: Generate comments in -XX:+PrintInterpreter to link to source code
Backport-of: 8e9f46a0f11829ad4b06822d176d1a3c874ace69
1 parent 6967a6b commit 10665ba

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

src/hotspot/cpu/riscv/methodHandles_riscv.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
44
* Copyright (c) 2020, 2023, Huawei Technologies Co., Ltd. All rights reserved.
55
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,6 +28,7 @@
2828
#include "asm/macroAssembler.hpp"
2929
#include "classfile/javaClasses.inline.hpp"
3030
#include "classfile/vmClasses.hpp"
31+
#include "compiler/disassembler.hpp"
3132
#include "interpreter/interpreter.hpp"
3233
#include "interpreter/interpreterRuntime.hpp"
3334
#include "memory/allocation.inline.hpp"
@@ -37,7 +38,7 @@
3738
#include "runtime/frame.inline.hpp"
3839
#include "runtime/stubRoutines.hpp"
3940

40-
#define __ _masm->
41+
#define __ Disassembler::hook<MacroAssembler>(__FILE__, __LINE__, _masm)->
4142

4243
#ifdef PRODUCT
4344
#define BLOCK_COMMENT(str) /* nothing */

src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
44
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
55
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,6 +27,7 @@
2727
#include "precompiled.hpp"
2828
#include "asm/macroAssembler.inline.hpp"
2929
#include "classfile/javaClasses.hpp"
30+
#include "compiler/disassembler.hpp"
3031
#include "gc/shared/barrierSetAssembler.hpp"
3132
#include "interpreter/bytecodeHistogram.hpp"
3233
#include "interpreter/bytecodeTracer.hpp"
@@ -67,7 +68,7 @@
6768
// Max size with JVMTI
6869
int TemplateInterpreter::InterpreterCodeSize = 256 * 1024;
6970

70-
#define __ _masm->
71+
#define __ Disassembler::hook<InterpreterMacroAssembler>(__FILE__, __LINE__, _masm)->
7172

7273
//-----------------------------------------------------------------------------
7374

@@ -1729,13 +1730,21 @@ void TemplateInterpreterGenerator::set_vtos_entry_points(Template* t,
17291730
address& vep) {
17301731
assert(t != nullptr && t->is_valid() && t->tos_in() == vtos, "illegal template");
17311732
Label L;
1732-
aep = __ pc(); __ push_ptr(); __ j(L);
1733-
fep = __ pc(); __ push_f(); __ j(L);
1734-
dep = __ pc(); __ push_d(); __ j(L);
1735-
lep = __ pc(); __ push_l(); __ j(L);
1736-
bep = cep = sep =
1737-
iep = __ pc(); __ push_i();
1738-
vep = __ pc();
1733+
aep = __ pc(); // atos entry point
1734+
__ push_ptr();
1735+
__ j(L);
1736+
fep = __ pc(); // ftos entry point
1737+
__ push_f();
1738+
__ j(L);
1739+
dep = __ pc(); // dtos entry point
1740+
__ push_d();
1741+
__ j(L);
1742+
lep = __ pc(); // ltos entry point
1743+
__ push_l();
1744+
__ j(L);
1745+
bep = cep = sep = iep = __ pc(); // [bcsi]tos entry point
1746+
__ push_i();
1747+
vep = __ pc(); // vtos entry point
17391748
__ bind(L);
17401749
generate_and_dispatch(t);
17411750
}

src/hotspot/cpu/riscv/templateTable_riscv.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include "precompiled.hpp"
2828
#include "asm/macroAssembler.inline.hpp"
29+
#include "compiler/disassembler.hpp"
2930
#include "gc/shared/barrierSetAssembler.hpp"
3031
#include "gc/shared/collectedHeap.hpp"
3132
#include "gc/shared/tlab_globals.hpp"
@@ -46,7 +47,7 @@
4647
#include "runtime/synchronizer.hpp"
4748
#include "utilities/powerOfTwo.hpp"
4849

49-
#define __ _masm->
50+
#define __ Disassembler::hook<InterpreterMacroAssembler>(__FILE__, __LINE__, _masm)->
5051

5152
// Address computation: local variables
5253

0 commit comments

Comments
 (0)