From 160ca7b38d4cacd3e6d1a0f8209982fd524b14c4 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Fri, 2 Jul 2021 13:06:20 +0200 Subject: [PATCH] Backport 66c8794c8141632d730a87643e898c6d4951daee --- src/hotspot/share/code/dependencyContext.cpp | 5 ++--- src/hotspot/share/code/dependencyContext.hpp | 4 ++-- test/hotspot/gtest/code/test_dependencyContext.cpp | 14 ++++++-------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/hotspot/share/code/dependencyContext.cpp b/src/hotspot/share/code/dependencyContext.cpp index b4943252947..879e3af9e9d 100644 --- a/src/hotspot/share/code/dependencyContext.cpp +++ b/src/hotspot/share/code/dependencyContext.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, 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 @@ -246,6 +246,7 @@ void DependencyContext::print_dependent_nmethods(bool verbose) { } } } +#endif //PRODUCT bool DependencyContext::is_dependent_nmethod(nmethod* nm) { for (nmethodBucket* b = dependencies(); b != NULL; b = b->next()) { @@ -267,8 +268,6 @@ bool DependencyContext::find_stale_entries() { return false; } -#endif //PRODUCT - int nmethodBucket::decrement() { return Atomic::sub(1, &_count); } diff --git a/src/hotspot/share/code/dependencyContext.hpp b/src/hotspot/share/code/dependencyContext.hpp index e8312ad8e9c..b1e2f1695ac 100644 --- a/src/hotspot/share/code/dependencyContext.hpp +++ b/src/hotspot/share/code/dependencyContext.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, 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 @@ -147,8 +147,8 @@ class DependencyContext : public StackObj { #ifndef PRODUCT void print_dependent_nmethods(bool verbose); +#endif //PRODUCT bool is_dependent_nmethod(nmethod* nm); bool find_stale_entries(); -#endif //PRODUCT }; #endif // SHARE_VM_CODE_DEPENDENCYCONTEXT_HPP diff --git a/test/hotspot/gtest/code/test_dependencyContext.cpp b/test/hotspot/gtest/code/test_dependencyContext.cpp index fec730f9637..65a45574cb9 100644 --- a/test/hotspot/gtest/code/test_dependencyContext.cpp +++ b/test/hotspot/gtest/code/test_dependencyContext.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2020, 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 @@ -58,32 +58,30 @@ class TestDependencyContext { return ctx.has_stale_entries(); } -#ifndef PRODUCT static bool find_stale_entries(DependencyContext ctx) { return ctx.find_stale_entries(); } -#endif }; static void test_remove_dependent_nmethod(int id, bool delete_immediately) { TestDependencyContext c; DependencyContext depContext = c.dependencies(); - NOT_PRODUCT(ASSERT_FALSE(TestDependencyContext::find_stale_entries(depContext))); + ASSERT_FALSE(TestDependencyContext::find_stale_entries(depContext)); ASSERT_FALSE(TestDependencyContext::has_stale_entries(depContext)); nmethod* nm = c._nmethods[id]; depContext.remove_dependent_nmethod(nm, delete_immediately); if (!delete_immediately) { - NOT_PRODUCT(ASSERT_TRUE(TestDependencyContext::find_stale_entries(depContext))); + ASSERT_TRUE(TestDependencyContext::find_stale_entries(depContext)); ASSERT_TRUE(TestDependencyContext::has_stale_entries(depContext)); - NOT_PRODUCT(ASSERT_TRUE(depContext.is_dependent_nmethod(nm))); + ASSERT_TRUE(depContext.is_dependent_nmethod(nm)); depContext.expunge_stale_entries(); } - NOT_PRODUCT(ASSERT_FALSE(TestDependencyContext::find_stale_entries(depContext))); + ASSERT_FALSE(TestDependencyContext::find_stale_entries(depContext)); ASSERT_FALSE(TestDependencyContext::has_stale_entries(depContext)); - NOT_PRODUCT(ASSERT_FALSE(depContext.is_dependent_nmethod(nm))); + ASSERT_FALSE(depContext.is_dependent_nmethod(nm)); } TEST_VM(code, dependency_context) {