mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 04:24:49 +02:00
Merge
This commit is contained in:
commit
5e6ae86ef2
1 changed files with 7 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015,2016 Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -70,7 +70,7 @@ public class TestHumongousThreshold {
|
||||||
private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
|
private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
|
||||||
private static final int REGION_SIZE = WHITE_BOX.g1RegionSize();
|
private static final int REGION_SIZE = WHITE_BOX.g1RegionSize();
|
||||||
private static final int MAX_CONTINUOUS_SIZE_CHECK = 129;
|
private static final int MAX_CONTINUOUS_SIZE_CHECK = 129;
|
||||||
private static final int NON_HUMONGOUS_DIVIDER = 10;
|
private static final int NON_HUMONGOUS_STEPS = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The method allocates byte[] with specified size and checks that:
|
* The method allocates byte[] with specified size and checks that:
|
||||||
|
@ -84,7 +84,7 @@ public class TestHumongousThreshold {
|
||||||
* @return allocated byte array
|
* @return allocated byte array
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private static byte[] allocateAndCheck(int arraySize, boolean expectedHumongous) {
|
private static void allocateAndCheck(int arraySize, boolean expectedHumongous) {
|
||||||
byte[] storage = new byte[arraySize];
|
byte[] storage = new byte[arraySize];
|
||||||
long objectSize = WHITE_BOX.getObjectSize(storage);
|
long objectSize = WHITE_BOX.getObjectSize(storage);
|
||||||
boolean shouldBeHumongous = objectSize > (REGION_SIZE / 2);
|
boolean shouldBeHumongous = objectSize > (REGION_SIZE / 2);
|
||||||
|
@ -98,7 +98,6 @@ public class TestHumongousThreshold {
|
||||||
"Object should be allocated as " + (shouldBeHumongous ? "humongous"
|
"Object should be allocated as " + (shouldBeHumongous ? "humongous"
|
||||||
: "non-humongous") + " but it wasn't; Allocation size = " + arraySize + "; Object size = "
|
: "non-humongous") + " but it wasn't; Allocation size = " + arraySize + "; Object size = "
|
||||||
+ objectSize + "; region size = " + REGION_SIZE);
|
+ objectSize + "; region size = " + REGION_SIZE);
|
||||||
return storage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -108,7 +107,7 @@ public class TestHumongousThreshold {
|
||||||
int maxByteArrayNonHumongousSize = (REGION_SIZE / 2) - byteArrayMemoryOverhead;
|
int maxByteArrayNonHumongousSize = (REGION_SIZE / 2) - byteArrayMemoryOverhead;
|
||||||
|
|
||||||
// Increment for non-humongous testing
|
// Increment for non-humongous testing
|
||||||
int nonHumongousStep = maxByteArrayNonHumongousSize / NON_HUMONGOUS_DIVIDER;
|
int nonHumongousStep = maxByteArrayNonHumongousSize / NON_HUMONGOUS_STEPS;
|
||||||
|
|
||||||
// Maximum byte[] that takes one region
|
// Maximum byte[] that takes one region
|
||||||
int maxByteArrayOneRegionSize = REGION_SIZE - byteArrayMemoryOverhead;
|
int maxByteArrayOneRegionSize = REGION_SIZE - byteArrayMemoryOverhead;
|
||||||
|
@ -131,10 +130,10 @@ public class TestHumongousThreshold {
|
||||||
allocateAndCheck(i, false);
|
allocateAndCheck(i, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Testing allocations with byte[] with length from 0 to nonHumongousStep * NON_HUMONGOUS_DIVIDER
|
// Testing allocations with byte[] with length from 0 to nonHumongousStep * NON_HUMONGOUS_STEPS
|
||||||
System.out.format("Testing allocations with byte[] with length from 0 to %d with step %d%n",
|
System.out.format("Testing allocations with byte[] with length from 0 to %d with step %d%n",
|
||||||
nonHumongousStep * NON_HUMONGOUS_DIVIDER, nonHumongousStep);
|
nonHumongousStep * NON_HUMONGOUS_STEPS, nonHumongousStep);
|
||||||
for (int i = 0; i < NON_HUMONGOUS_DIVIDER; ++i) {
|
for (int i = 0; i < NON_HUMONGOUS_STEPS; ++i) {
|
||||||
allocateAndCheck(i * nonHumongousStep, false);
|
allocateAndCheck(i * nonHumongousStep, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue