8143958: CDS Shared flags need constraint function
Implement range constraints for CDS flags. Reviewed-by: iklam, jiangli
This commit is contained in:
parent
3af6c14332
commit
5a7ecbdf94
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016 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
|
||||
@ -130,3 +130,36 @@ Flag::Error PerfDataSamplingIntervalFunc(intx value, bool verbose) {
|
||||
return Flag::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
static inline Flag::Error sharedConstraintFunc(const char *name, size_t value, size_t taken, bool verbose) {
|
||||
size_t available = (MAX_SHARED_DELTA-(taken+SHARED_PAGE));
|
||||
if (value > available) {
|
||||
CommandLineError::print(verbose,
|
||||
"%s (" SIZE_FORMAT ") must be "
|
||||
"smaller than or equal to (" SIZE_FORMAT ")\n",
|
||||
name, value, available);
|
||||
return Flag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return Flag::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
Flag::Error SharedReadWriteSizeConstraintFunc(size_t value, bool verbose) {
|
||||
size_t taken = (SharedReadOnlySize+SharedMiscDataSize+SharedMiscCodeSize);
|
||||
return sharedConstraintFunc("SharedReadWriteSize", value, taken, verbose);
|
||||
}
|
||||
|
||||
Flag::Error SharedReadOnlySizeConstraintFunc(size_t value, bool verbose) {
|
||||
size_t taken = (SharedReadWriteSize+SharedMiscDataSize+SharedMiscCodeSize);
|
||||
return sharedConstraintFunc("SharedReadOnlySize", value, taken, verbose);
|
||||
}
|
||||
|
||||
Flag::Error SharedMiscDataSizeConstraintFunc(size_t value, bool verbose) {
|
||||
size_t taken = (SharedReadWriteSize+SharedReadOnlySize+SharedMiscCodeSize);
|
||||
return sharedConstraintFunc("SharedMiscDataSize", value, taken, verbose);
|
||||
}
|
||||
|
||||
Flag::Error SharedMiscCodeSizeConstraintFunc(size_t value, bool verbose) {
|
||||
size_t taken = (SharedReadWriteSize+SharedReadOnlySize+SharedMiscDataSize);
|
||||
return sharedConstraintFunc("SharedMiscCodeSize", value, taken, verbose);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2016 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
|
||||
@ -45,4 +45,9 @@ Flag::Error BiasedLockingDecayTimeFunc(intx value, bool verbose);
|
||||
|
||||
Flag::Error PerfDataSamplingIntervalFunc(intx value, bool verbose);
|
||||
|
||||
Flag::Error SharedReadWriteSizeConstraintFunc(size_t value, bool verbose);
|
||||
Flag::Error SharedReadOnlySizeConstraintFunc(size_t value, bool verbose);
|
||||
Flag::Error SharedMiscDataSizeConstraintFunc(size_t value, bool verbose);
|
||||
Flag::Error SharedMiscCodeSizeConstraintFunc(size_t value, bool verbose);
|
||||
|
||||
#endif /* SHARE_VM_RUNTIME_COMMANDLINEFLAGCONSTRAINTSRUNTIME_HPP */
|
||||
|
@ -3961,18 +3961,22 @@ public:
|
||||
product(size_t, SharedReadWriteSize, DEFAULT_SHARED_READ_WRITE_SIZE, \
|
||||
"Size of read-write space for metadata (in bytes)") \
|
||||
range(MIN_SHARED_READ_WRITE_SIZE, MAX_SHARED_READ_WRITE_SIZE) \
|
||||
constraint(SharedReadWriteSizeConstraintFunc,AfterErgo) \
|
||||
\
|
||||
product(size_t, SharedReadOnlySize, DEFAULT_SHARED_READ_ONLY_SIZE, \
|
||||
"Size of read-only space for metadata (in bytes)") \
|
||||
range(MIN_SHARED_READ_ONLY_SIZE, MAX_SHARED_READ_ONLY_SIZE) \
|
||||
constraint(SharedReadOnlySizeConstraintFunc,AfterErgo) \
|
||||
\
|
||||
product(size_t, SharedMiscDataSize, DEFAULT_SHARED_MISC_DATA_SIZE, \
|
||||
"Size of the shared miscellaneous data area (in bytes)") \
|
||||
range(MIN_SHARED_MISC_DATA_SIZE, MAX_SHARED_MISC_DATA_SIZE) \
|
||||
constraint(SharedMiscDataSizeConstraintFunc,AfterErgo) \
|
||||
\
|
||||
product(size_t, SharedMiscCodeSize, DEFAULT_SHARED_MISC_CODE_SIZE, \
|
||||
"Size of the shared miscellaneous code area (in bytes)") \
|
||||
range(MIN_SHARED_MISC_CODE_SIZE, MAX_SHARED_MISC_CODE_SIZE) \
|
||||
constraint(SharedMiscCodeSizeConstraintFunc,AfterErgo) \
|
||||
\
|
||||
product(size_t, SharedBaseAddress, LP64_ONLY(32*G) \
|
||||
NOT_LP64(LINUX_ONLY(2*G) NOT_LINUX(0)), \
|
||||
|
@ -96,15 +96,6 @@ public class TestOptionsWithRanges {
|
||||
*/
|
||||
excludeTestRange("ThreadStackSize");
|
||||
|
||||
/*
|
||||
* JDK-8143958
|
||||
* Temporarily exclude testing of max range for Shared* flags
|
||||
*/
|
||||
excludeTestMaxRange("SharedReadWriteSize");
|
||||
excludeTestMaxRange("SharedReadOnlySize");
|
||||
excludeTestMaxRange("SharedMiscDataSize");
|
||||
excludeTestMaxRange("SharedMiscCodeSize");
|
||||
|
||||
/*
|
||||
* Remove the flag controlling the size of the stack because the
|
||||
* flag has direct influence on the physical memory usage of
|
||||
|
Loading…
Reference in New Issue
Block a user