5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 #include "precompiled.hpp"
25 #include "gc/shared/collectorPolicy.hpp"
26 #include "runtime/arguments.hpp"
27 #include "runtime/globals_extension.hpp"
28 #include "utilities/align.hpp"
29 #include "utilities/globalDefinitions.hpp"
30 #include "utilities/macros.hpp"
31 #include "unittest.hpp"
32
33 class TestGenCollectorPolicy {
34 public:
35
36 class Executor {
37 public:
38 virtual void execute() = 0;
39 };
40
41 class UnaryExecutor : public Executor {
42 protected:
43 const size_t param;
44 public:
45 UnaryExecutor(size_t val) : param(val) { }
46 };
47
48 class BinaryExecutor : public Executor {
49 protected:
50 const size_t param1;
51 const size_t param2;
52 public:
267 // If OldSize is set on the command line, it should be used
268 // for both min and initial old size if less than min heap.
269 TestGenCollectorPolicy::SetOldSizeCmd setter(20 * M);
270
271 TestGenCollectorPolicy::CheckOldMin checker_min(20 * M);
272 TestGenCollectorPolicy::TestWrapper::test(&setter, &checker_min);
273
274 TestGenCollectorPolicy::CheckOldInitial checker_initial;
275 TestGenCollectorPolicy::TestWrapper::test(&setter, &checker_initial);
276
277 // If MaxNewSize is large, the maximum OldSize will be less than
278 // what's requested on the command line and it should be reset
279 // ergonomically.
280 // We intentionally set MaxNewSize + OldSize > MaxHeapSize
281 TestGenCollectorPolicy::SetOldSizeCmd setter_old_size(30 * M);
282 TestGenCollectorPolicy::SetMaxNewSizeCmd setter_max_new_size(30 * M, 20 * M);
283 TestGenCollectorPolicy::CheckOldInitialMaxNewSize checker_large(30 * M, 20 * M);
284
285 TestGenCollectorPolicy::TestWrapper::test(&setter_old_size, &setter_max_new_size, &checker_large);
286 }
|
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 #include "precompiled.hpp"
25 #include "runtime/arguments.hpp"
26 #include "runtime/globals_extension.hpp"
27 #include "utilities/align.hpp"
28 #include "utilities/globalDefinitions.hpp"
29 #include "utilities/macros.hpp"
30 #include "unittest.hpp"
31
32 #if 0
33 class TestGenCollectorPolicy {
34 public:
35
36 class Executor {
37 public:
38 virtual void execute() = 0;
39 };
40
41 class UnaryExecutor : public Executor {
42 protected:
43 const size_t param;
44 public:
45 UnaryExecutor(size_t val) : param(val) { }
46 };
47
48 class BinaryExecutor : public Executor {
49 protected:
50 const size_t param1;
51 const size_t param2;
52 public:
267 // If OldSize is set on the command line, it should be used
268 // for both min and initial old size if less than min heap.
269 TestGenCollectorPolicy::SetOldSizeCmd setter(20 * M);
270
271 TestGenCollectorPolicy::CheckOldMin checker_min(20 * M);
272 TestGenCollectorPolicy::TestWrapper::test(&setter, &checker_min);
273
274 TestGenCollectorPolicy::CheckOldInitial checker_initial;
275 TestGenCollectorPolicy::TestWrapper::test(&setter, &checker_initial);
276
277 // If MaxNewSize is large, the maximum OldSize will be less than
278 // what's requested on the command line and it should be reset
279 // ergonomically.
280 // We intentionally set MaxNewSize + OldSize > MaxHeapSize
281 TestGenCollectorPolicy::SetOldSizeCmd setter_old_size(30 * M);
282 TestGenCollectorPolicy::SetMaxNewSizeCmd setter_max_new_size(30 * M, 20 * M);
283 TestGenCollectorPolicy::CheckOldInitialMaxNewSize checker_large(30 * M, 20 * M);
284
285 TestGenCollectorPolicy::TestWrapper::test(&setter_old_size, &setter_max_new_size, &checker_large);
286 }
287 #endif
|