From 3dd07b91bbf644aa867452806e9388089fa97548 Mon Sep 17 00:00:00 2001 From: Qizheng Xing Date: Wed, 14 Aug 2024 06:28:34 +0000 Subject: [PATCH] 8336163: Remove declarations of some debug-only methods in release build Reviewed-by: dholmes, eliu, kvn --- src/hotspot/share/cds/heapShared.hpp | 4 ++++ src/hotspot/share/compiler/compilationPolicy.hpp | 2 ++ src/hotspot/share/opto/node.hpp | 2 ++ src/hotspot/share/runtime/frame.hpp | 6 ++++++ src/hotspot/share/runtime/registerMap.hpp | 10 +++++----- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/hotspot/share/cds/heapShared.hpp b/src/hotspot/share/cds/heapShared.hpp index fa34289a38e..2c87b050ca6 100644 --- a/src/hotspot/share/cds/heapShared.hpp +++ b/src/hotspot/share/cds/heapShared.hpp @@ -371,7 +371,9 @@ private: KlassSubGraphInfo* subgraph_info, oop orig_obj); +#ifndef PRODUCT static ResourceBitMap calculate_oopmap(MemRegion region); // marks all the oop pointers +#endif static void add_to_dumped_interned_strings(oop string); // Scratch objects for archiving Klass::java_mirror() @@ -426,7 +428,9 @@ private: static void init_roots(oop roots_oop) NOT_CDS_JAVA_HEAP_RETURN; static void serialize_tables(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN; +#ifndef PRODUCT static bool is_a_test_class_in_unnamed_module(Klass* ik) NOT_CDS_JAVA_HEAP_RETURN_(false); +#endif }; #if INCLUDE_CDS_JAVA_HEAP diff --git a/src/hotspot/share/compiler/compilationPolicy.hpp b/src/hotspot/share/compiler/compilationPolicy.hpp index 3ec60cd89c7..fe33fb8cfba 100644 --- a/src/hotspot/share/compiler/compilationPolicy.hpp +++ b/src/hotspot/share/compiler/compilationPolicy.hpp @@ -179,8 +179,10 @@ class CompilationPolicy : AllStatic { // Set carry flags in the counters (in Method* and MDO). inline static void handle_counter_overflow(const methodHandle& method); +#ifdef ASSERT // Verify that a level is consistent with the compilation mode static bool verify_level(CompLevel level); +#endif // Clamp the request level according to various constraints. inline static CompLevel limit_level(CompLevel level); // Common transition function. Given a predicate determines if a method should transition to another level. diff --git a/src/hotspot/share/opto/node.hpp b/src/hotspot/share/opto/node.hpp index 10e1e7b1006..3e39e1ed2fb 100644 --- a/src/hotspot/share/opto/node.hpp +++ b/src/hotspot/share/opto/node.hpp @@ -834,7 +834,9 @@ private: juint _class_id; juint _flags; +#ifdef ASSERT static juint max_flags(); +#endif protected: // These methods should be called from constructors only. diff --git a/src/hotspot/share/runtime/frame.hpp b/src/hotspot/share/runtime/frame.hpp index 4113360724d..468437a6484 100644 --- a/src/hotspot/share/runtime/frame.hpp +++ b/src/hotspot/share/runtime/frame.hpp @@ -387,7 +387,9 @@ class frame { static int interpreter_frame_monitor_size(); static int interpreter_frame_monitor_size_in_bytes(); +#ifdef ASSERT void interpreter_frame_verify_monitor(BasicObjectLock* value) const; +#endif // Return/result value from this interpreter frame // If the method return type is T_OBJECT or T_ARRAY populates oop_result @@ -438,8 +440,10 @@ class frame { void print_on_error(outputStream* st, char* buf, int buflen, bool verbose = false) const; static void print_C_frame(outputStream* st, char* buf, int buflen, address pc); +#ifndef PRODUCT // Add annotated descriptions of memory locations belonging to this frame to values void describe(FrameValues& values, int frame_no, const RegisterMap* reg_map=nullptr); +#endif // Conversion from a VMReg to physical stack location template @@ -492,9 +496,11 @@ class frame { // Verification void verify(const RegisterMap* map) const; +#ifdef ASSERT static bool verify_return_pc(address x); // Usage: // assert(frame::verify_return_pc(return_address), "must be a return pc"); +#endif #include CPU_HEADER(frame) diff --git a/src/hotspot/share/runtime/registerMap.hpp b/src/hotspot/share/runtime/registerMap.hpp index 5cf68a87b71..a63a25cbb35 100644 --- a/src/hotspot/share/runtime/registerMap.hpp +++ b/src/hotspot/share/runtime/registerMap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -153,19 +153,19 @@ class RegisterMap : public StackObj { const RegisterMap* as_RegisterMap() const { return this; } RegisterMap* as_RegisterMap() { return this; } +#ifndef PRODUCT void print_on(outputStream* st) const; void print() const; - void set_async(bool value) { NOT_PRODUCT(_async = value;) } - void set_skip_missing(bool value) { NOT_PRODUCT(_skip_missing = value;) } - -#ifndef PRODUCT bool is_async() const { return _async; } bool should_skip_missing() const { return _skip_missing; } VMReg find_register_spilled_here(void* p, intptr_t* sp); #endif + void set_async(bool value) { NOT_PRODUCT(_async = value;) } + void set_skip_missing(bool value) { NOT_PRODUCT(_skip_missing = value;) } + // the following contains the definition of pd_xxx methods #include CPU_HEADER(registerMap)