Skip to content

Commit

Permalink
8340792: With -XX:+PrintInterpreter the interpreter should be printed…
Browse files Browse the repository at this point in the history
… just once at startup
  • Loading branch information
reinrich committed Sep 24, 2024
1 parent 9176f68 commit 09b92b8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/hotspot/share/interpreter/abstractInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ void AbstractInterpreter::print() {
tty->print_cr("avg codelet size = %6d bytes", _code->used_space() / _code->number_of_stubs());
tty->cr();
}
_should_print_instructions = PrintInterpreter;
_code->print();
_should_print_instructions = false;
tty->print_cr("----------------------------------------------------------------------");
tty->cr();
}
Expand All @@ -91,6 +93,8 @@ address AbstractInterpreter::_slow_signature_handler;
address AbstractInterpreter::_entry_table [AbstractInterpreter::number_of_method_entries];
address AbstractInterpreter::_native_abi_to_tosca [AbstractInterpreter::number_of_result_handlers];

bool AbstractInterpreter::_should_print_instructions = false;

//------------------------------------------------------------------------------------------------------------------------
// Generation of complete interpreter

Expand Down
5 changes: 4 additions & 1 deletion src/hotspot/share/interpreter/abstractInterpreter.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. 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 @@ -125,13 +125,16 @@ class AbstractInterpreter: AllStatic {

static address _rethrow_exception_entry; // rethrows an activation in previous frame

static bool _should_print_instructions; // print also instructions if PrintInterpreter is enabled

friend class AbstractInterpreterGenerator;
friend class InterpreterMacroAssembler;

public:
// Initialization/debugging
static void initialize();
static StubQueue* code() { return _code; }
static bool should_print_instructions() { return _should_print_instructions; }


// Method activation
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/interpreter/interpreter.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. 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 @@ -66,7 +66,7 @@ void InterpreterCodelet::verify() {}
void InterpreterCodelet::print_on(outputStream* st) const {
ttyLocker ttyl;

if (PrintInterpreter) {
if (AbstractInterpreter::should_print_instructions()) {
st->cr();
st->print_cr("----------------------------------------------------------------------");
}
Expand All @@ -76,7 +76,7 @@ void InterpreterCodelet::print_on(outputStream* st) const {
st->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "] %d bytes",
p2i(code_begin()), p2i(code_end()), code_size());

if (PrintInterpreter) {
if (AbstractInterpreter::should_print_instructions()) {
st->cr();
Disassembler::decode(code_begin(), code_end(), st NOT_PRODUCT(COMMA &_asm_remarks));
}
Expand Down

0 comments on commit 09b92b8

Please sign in to comment.