< prev index next >

test/hotspot/jtreg/runtime/valhalla/valuetypes/ValueOops.java

Print this page




 305      * Check forcing GC for combination of VT on stack/LVT etc works
 306      */
 307     public static void testOverGc() {
 308         try {
 309             Class<?> vtClass = Person.class;
 310 
 311             doGc();
 312 
 313             // VT on stack and lvt, null refs, see if GC flies
 314             MethodHandle moveValueThroughStackAndLvt = MethodHandleBuilder.loadCode(
 315                 LOOKUP,
 316                 "gcOverPerson",
 317                 MethodType.methodType(vtClass, vtClass),
 318                 CODE->{
 319                 CODE
 320                 .vload(0)
 321                 .invokestatic(ValueOops.class, "doGc", "()V", false) // Stack
 322                 .vstore(0)
 323                 .invokestatic(ValueOops.class, "doGc", "()V", false) // LVT
 324                 .vload(0)


 325                 .iconst_1()  // push a litte further down
 326                 .invokestatic(ValueOops.class, "doGc", "()V", false) // Stack,LVT
 327                 .pop()
 328                 .vreturn();
 329             });
 330             Person person = (Person) moveValueThroughStackAndLvt.invokeExact(createDefaultPerson());
 331             validateDefaultPerson(person);
 332             doGc();
 333 
 334             int index = 4711;
 335             person = (Person) moveValueThroughStackAndLvt.invokeExact(createIndexedPerson(index));
 336             validateIndexedPerson(person, index);
 337             doGc();
 338             person = createDefaultPerson();
 339             doGc();
 340         }
 341         catch (Throwable t) { fail("testOverGc", t); }
 342     }
 343 
 344     static void submitNewWork(ForkJoinPool fjPool, int size) {




 305      * Check forcing GC for combination of VT on stack/LVT etc works
 306      */
 307     public static void testOverGc() {
 308         try {
 309             Class<?> vtClass = Person.class;
 310 
 311             doGc();
 312 
 313             // VT on stack and lvt, null refs, see if GC flies
 314             MethodHandle moveValueThroughStackAndLvt = MethodHandleBuilder.loadCode(
 315                 LOOKUP,
 316                 "gcOverPerson",
 317                 MethodType.methodType(vtClass, vtClass),
 318                 CODE->{
 319                 CODE
 320                 .vload(0)
 321                 .invokestatic(ValueOops.class, "doGc", "()V", false) // Stack
 322                 .vstore(0)
 323                 .invokestatic(ValueOops.class, "doGc", "()V", false) // LVT
 324                 .vload(0)
 325                 .vstore(1024) // LVT wide index
 326                 .vload(1024)
 327                 .iconst_1()  // push a litte further down
 328                 .invokestatic(ValueOops.class, "doGc", "()V", false) // Stack,LVT
 329                 .pop()
 330                 .vreturn();
 331             });
 332             Person person = (Person) moveValueThroughStackAndLvt.invokeExact(createDefaultPerson());
 333             validateDefaultPerson(person);
 334             doGc();
 335 
 336             int index = 4711;
 337             person = (Person) moveValueThroughStackAndLvt.invokeExact(createIndexedPerson(index));
 338             validateIndexedPerson(person, index);
 339             doGc();
 340             person = createDefaultPerson();
 341             doGc();
 342         }
 343         catch (Throwable t) { fail("testOverGc", t); }
 344     }
 345 
 346     static void submitNewWork(ForkJoinPool fjPool, int size) {


< prev index next >