Skip to content

Commit 4faa720

Browse files
committedMay 29, 2024
Added checks for G1GC during new workflow training run

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed
 

‎README.md

+42-2
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,47 @@ $ ls -l JavacBenchApp.cds*
169169

170170
Note that the `JavacBenchApp.cds.code` file is no longer created.
171171

172-
## 4. Benchmarking
172+
## 4. Limitations of the Leyden Prototype
173+
174+
When trying out the Leyden, please pay attention to the following limitations.
175+
176+
### Only the G1 collector is supported
177+
178+
G1 is the default collector used by the JDK. Many of the optimizations in the Leyden only work with G1.
179+
180+
A collector other than G1 may be used under the following conditions:
181+
182+
- You have explicitly specified a different collector, e.g., `-XX:+UseSerialGC`; or
183+
- You are using a container that has a very small amount of memory. As a result, the JVM automatically
184+
picks a different collector such as Serial.
185+
186+
In these cases, you can run into the following problems:
187+
188+
(a) During the training run, you will see an error like this, and the CDS archive will not be created:
189+
190+
```
191+
$ rm -fv JavacBenchApp.cds*
192+
$ java -XX:CacheDataStore=JavacBenchApp.cds -XX:+UseSerialGC -cp JavacBenchApp.jar JavacBenchApp 50
193+
Error occurred during initialization of VM
194+
(Temporary) Cannot create the CacheDataStore: -XX:UseG1GC must be specified
195+
```
196+
197+
(b) During the production run, you will see an error like the following. The CDS archive will
198+
not be loaded. As a result, your application will not benefit from the Leyden optimizations:
199+
200+
201+
```
202+
$ ls -l JavacBenchApp.cds*
203+
-r--r--r-- 1 iklam iklam 30900224 May 20 19:21 JavacBenchApp.cds
204+
-r--r--r-- 1 iklam iklam 16895736 May 20 19:21 JavacBenchApp.cds.code
205+
$ java -XX:CacheDataStore=JavacBenchApp.cds -cp JavacBenchApp.jar JavacBenchApp 50
206+
Generated source code for 51 classes and compiled them in 423 ms
207+
$ java -XX:CacheDataStore=JavacBenchApp.cds -cp JavacBenchApp.jar -XX:+UseSerialGC JavacBenchApp 50
208+
[0.180s][error][cds] CDS archive has preloaded classes. It cannot be used because GC used during dump time (G1) is not the same as runtime (Serial)
209+
Generated source code for 51 classes and compiled them in 890 ms
210+
```
211+
212+
## 5. Benchmarking
173213

174214
We use a small set of benchmarks to demonstrate the performance of the optimizations in the Leyden repo.
175215

@@ -340,6 +380,6 @@ gantt
340380
premain CDS + AOT : 0, 368
341381
```
342382

343-
## 5. More Documentation
383+
## 6. More Documentation
344384

345385
Please see [test/hotspot/jtreg/premain/](test/hotspot/jtreg/premain) for more information.

‎src/hotspot/share/cds/metaspaceShared.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,14 @@ static char* compute_shared_base(size_t cds_max) {
262262

263263
void MetaspaceShared::initialize_for_static_dump() {
264264
assert(CDSConfig::is_dumping_static_archive(), "sanity");
265+
266+
if (CDSConfig::is_dumping_preimage_static_archive() || CDSConfig::is_dumping_final_static_archive()) {
267+
if (!UseG1GC) { // See JDK-8333222
268+
vm_exit_during_initialization("(Temporary) Cannot create the CacheDataStore", "-XX:UseG1GC must be specified");
269+
}
270+
}
271+
272+
265273
log_info(cds)("Core region alignment: " SIZE_FORMAT, core_region_alignment());
266274
// The max allowed size for CDS archive. We use this to limit SharedBaseAddress
267275
// to avoid address space wrap around.

0 commit comments

Comments
 (0)
Please sign in to comment.