Skip to content

Commit

Permalink
8292590: Product JVM crashes with FLAG_SET_XXX on non-product Flag
Browse files Browse the repository at this point in the history
Reviewed-by: dholmes, coleenp
  • Loading branch information
iklam committed Aug 30, 2022
1 parent 6335150 commit 1cf245d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/hotspot/share/runtime/arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3880,11 +3880,13 @@ static void apply_debugger_ergo() {
}
#endif

#ifndef PRODUCT
if (UseDebuggerErgo) {
// Turn on sub-flags
FLAG_SET_ERGO_IF_DEFAULT(UseDebuggerErgo1, true);
FLAG_SET_ERGO_IF_DEFAULT(UseDebuggerErgo2, true);
}
#endif

if (UseDebuggerErgo2) {
// Debugging with limited number of CPUs
Expand Down
12 changes: 11 additions & 1 deletion src/hotspot/share/runtime/globals_extension.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
Expand Down Expand Up @@ -59,13 +59,23 @@ enum JVMFlagsEnum : int {

#define DEFINE_FLAG_MEMBER_SETTER(type, name, ...) FLAG_MEMBER_SETTER_(type, name)

#ifdef PRODUCT
ALL_FLAGS(IGNORE_FLAG, // develop : declared as const
IGNORE_FLAG, // develop-pd : declared as const
DEFINE_FLAG_MEMBER_SETTER,
DEFINE_FLAG_MEMBER_SETTER,
IGNORE_FLAG, // not-product : is not declared
IGNORE_RANGE,
IGNORE_CONSTRAINT)
#else
ALL_FLAGS(DEFINE_FLAG_MEMBER_SETTER,
DEFINE_FLAG_MEMBER_SETTER,
DEFINE_FLAG_MEMBER_SETTER,
DEFINE_FLAG_MEMBER_SETTER,
DEFINE_FLAG_MEMBER_SETTER,
IGNORE_RANGE,
IGNORE_CONSTRAINT)
#endif

#define FLAG_IS_DEFAULT(name) (JVMFlag::is_default(FLAG_MEMBER_ENUM(name)))
#define FLAG_IS_ERGO(name) (JVMFlag::is_ergo(FLAG_MEMBER_ENUM(name)))
Expand Down

1 comment on commit 1cf245d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.