This has been observed with the latest changes to the JTreg test case test/hotspot/jtreg/compiler/intrinsics/TestRotate.java.
Make sure to use the following version of this test case, as it has been changed with JDK-8256438:
https://github.com/openjdk/jdk/blob/382e38dd246596ec94a1f1ce0e0f9e87f53366c7/test/hotspot/jtreg/compiler/intrinsics/TestRotate.java
I don't believe the problem has been introduced with this change, but the change to the test triggers this behavior.
JIT compilation of the main method of this JTreg test consumes an unusual amount of memory and takes a very long time.
Judging from NMT, C2 consumes up to 2978MB of memory (on x86_64 linux):
Total: reserved=12595MB, committed=3576MB
- Java Heap (reserved=7952MB, committed=500MB)
(mmap: reserved=7952MB, committed=500MB)
- Thread (reserved=30MB, committed=1MB)
(thread #30)
(stack: reserved=30MB, committed=1MB)
- Code (reserved=242MB, committed=8MB)
(mmap: reserved=242MB, committed=7MB)
- GC (reserved=355MB, committed=79MB)
(malloc=27MB #851)
(mmap: reserved=328MB, committed=51MB)
- Compiler (reserved=2978MB, committed=2978MB)
(arena=2978MB #13)
- Symbol (reserved=2MB, committed=2MB)
(malloc=1MB #24825)
(arena=1MB #1)
- Native Memory Tracking (reserved=2MB, committed=2MB)
(tracking overhead=1MB)
- Arena Chunk (reserved=1MB, committed=1MB)
(malloc=1MB)
- Metaspace (reserved=8MB, committed=4MB)
(mmap: reserved=8MB, committed=4MB)
- Unknown (reserved=1024MB, committed=0MB)
(mmap: reserved=1024MB, committed=0MB)
Judging from the compilation log, compilation of the main method takes a huge amount of time (if compilation is restricted to this main method, using -XX:CompileCommand):
<task compile_id="41" compile_kind="osr" method="compiler.intrinsics.TestRotate main ([Ljava/lang/String;)V" bytes="1568" count="1" backedge_count="101377" iicount="1" osr_bci="774" stamp="18.349">
<task_done success="1" nmsize="719360" count="1" backedge_count="1093588" inlined_bytes="59937" stamp="194.437"/>
You can compile and run the test case directly, without JTreg:
$ javac test/hotspot/jtreg/compiler/intrinsics/TestRotate.java
$ java -cp test/hotspot/jtreg compiler.intrinsics.TestRotate
Compilation can be limited to only the main methoid using -XX:CompileCommand='compileonly compiler.intrinsics.TestRotate::main'