Skip to content

Commit 35fcac6

Browse files
committed
8168304: Make all of DependencyContext_test available in product mode
Enable the utility inspection function `DependencyContext::is_dependent_method` and therefore the test in the product mode. Reviewed-by: phh Backport-of: 66c8794
1 parent cf2cf25 commit 35fcac6

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

src/hotspot/share/code/dependencyContext.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2022, 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
@@ -246,6 +246,7 @@ void DependencyContext::print_dependent_nmethods(bool verbose) {
246246
}
247247
}
248248
}
249+
#endif //PRODUCT
249250

250251
bool DependencyContext::is_dependent_nmethod(nmethod* nm) {
251252
for (nmethodBucket* b = dependencies(); b != NULL; b = b->next()) {
@@ -267,8 +268,6 @@ bool DependencyContext::find_stale_entries() {
267268
return false;
268269
}
269270

270-
#endif //PRODUCT
271-
272271
int nmethodBucket::decrement() {
273272
return Atomic::sub(1, &_count);
274273
}

src/hotspot/share/code/dependencyContext.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2020, 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
@@ -147,8 +147,8 @@ class DependencyContext : public StackObj {
147147

148148
#ifndef PRODUCT
149149
void print_dependent_nmethods(bool verbose);
150+
#endif //PRODUCT
150151
bool is_dependent_nmethod(nmethod* nm);
151152
bool find_stale_entries();
152-
#endif //PRODUCT
153153
};
154154
#endif // SHARE_VM_CODE_DEPENDENCYCONTEXT_HPP

test/hotspot/gtest/code/test_dependencyContext.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2020, 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
@@ -58,32 +58,30 @@ class TestDependencyContext {
5858
return ctx.has_stale_entries();
5959
}
6060

61-
#ifndef PRODUCT
6261
static bool find_stale_entries(DependencyContext ctx) {
6362
return ctx.find_stale_entries();
6463
}
65-
#endif
6664
};
6765

6866
static void test_remove_dependent_nmethod(int id, bool delete_immediately) {
6967
TestDependencyContext c;
7068
DependencyContext depContext = c.dependencies();
71-
NOT_PRODUCT(ASSERT_FALSE(TestDependencyContext::find_stale_entries(depContext)));
69+
ASSERT_FALSE(TestDependencyContext::find_stale_entries(depContext));
7270
ASSERT_FALSE(TestDependencyContext::has_stale_entries(depContext));
7371

7472
nmethod* nm = c._nmethods[id];
7573
depContext.remove_dependent_nmethod(nm, delete_immediately);
7674

7775
if (!delete_immediately) {
78-
NOT_PRODUCT(ASSERT_TRUE(TestDependencyContext::find_stale_entries(depContext)));
76+
ASSERT_TRUE(TestDependencyContext::find_stale_entries(depContext));
7977
ASSERT_TRUE(TestDependencyContext::has_stale_entries(depContext));
80-
NOT_PRODUCT(ASSERT_TRUE(depContext.is_dependent_nmethod(nm)));
78+
ASSERT_TRUE(depContext.is_dependent_nmethod(nm));
8179
depContext.expunge_stale_entries();
8280
}
8381

84-
NOT_PRODUCT(ASSERT_FALSE(TestDependencyContext::find_stale_entries(depContext)));
82+
ASSERT_FALSE(TestDependencyContext::find_stale_entries(depContext));
8583
ASSERT_FALSE(TestDependencyContext::has_stale_entries(depContext));
86-
NOT_PRODUCT(ASSERT_FALSE(depContext.is_dependent_nmethod(nm)));
84+
ASSERT_FALSE(depContext.is_dependent_nmethod(nm));
8785
}
8886

8987
TEST_VM(code, dependency_context) {

0 commit comments

Comments
 (0)