From 8f88207206fe39f6dcb4e76e24716c81566f26cc Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Tue, 9 Apr 2019 20:11:19 +0000 Subject: Revert "Remove support for moving GC collector transitions" This reverts commit 66a655029c98de9492570f4cfd06476c0fde9cd1. Bug: 78286368 Bug: 130236304 Reason for revert: Causes tombstones in AOSP walleye Change-Id: I41c27d119f82490b68a01f85d92d22d0961d2af6 --- test/1337-gc-coverage/src/Main.java | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'test/1337-gc-coverage/src/Main.java') diff --git a/test/1337-gc-coverage/src/Main.java b/test/1337-gc-coverage/src/Main.java index 128ad4d83c..7875eb1824 100644 --- a/test/1337-gc-coverage/src/Main.java +++ b/test/1337-gc-coverage/src/Main.java @@ -22,6 +22,7 @@ public class Main { public static void main(String[] args) { System.loadLibrary(args[0]); testHomogeneousCompaction(); + testCollectorTransitions(); System.out.println("Done."); } @@ -67,10 +68,40 @@ public class Main { } } + private static void testCollectorTransitions() { + if (supportCollectorTransition()) { + Object o = new Object(); + // Transition to semi-space collector. + allocateStuff(); + transitionToSS(); + allocateStuff(); + long addressBefore = objectAddress(o); + Runtime.getRuntime().gc(); + long addressAfter = objectAddress(o); + if (addressBefore == addressAfter) { + System.out.println("error: Expected different adddress " + addressBefore + " vs " + + addressAfter); + } + // Transition back to CMS. + transitionToCMS(); + allocateStuff(); + addressBefore = objectAddress(o); + Runtime.getRuntime().gc(); + addressAfter = objectAddress(o); + if (addressBefore != addressAfter) { + System.out.println("error: Expected same adddress " + addressBefore + " vs " + + addressAfter); + } + } + } + // Methods to get access to ART internals. private static native boolean supportHomogeneousSpaceCompact(); private static native boolean performHomogeneousSpaceCompact(); private static native void incrementDisableMovingGC(); private static native void decrementDisableMovingGC(); private static native long objectAddress(Object object); + private static native boolean supportCollectorTransition(); + private static native void transitionToSS(); + private static native void transitionToCMS(); } -- cgit v1.2.3-59-g8ed1b