44ec501a41
Co-authored-by: Sandhya Viswanathan <sviswanathan@openjdk.org> Co-authored-by: Martin Doerr <mdoerr@openjdk.org> Co-authored-by: Hamlin Li <mli@openjdk.org> Co-authored-by: Thomas Stuefe <stuefe@openjdk.org> Co-authored-by: Amit Kumar <amitkumar@openjdk.org> Co-authored-by: Stefan Karlsson <stefank@openjdk.org> Co-authored-by: Coleen Phillimore <coleenp@openjdk.org> Co-authored-by: Axel Boldt-Christmas <aboldtch@openjdk.org> Reviewed-by: coleenp, stefank, stuefe, phh, ihse, lmesnik, tschatzl, matsaave, rcastanedalo, vpaprotski, yzheng, egahlin
65 lines
3.4 KiB
C++
65 lines
3.4 KiB
C++
/*
|
|
* Copyright Amazon.com Inc. or its affiliates. All rights reserved.
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
*
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
* accompanied this code).
|
|
*
|
|
* You should have received a copy of the GNU General Public License version
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
* questions.
|
|
*/
|
|
|
|
#include "precompiled.hpp"
|
|
#include "oops/objArrayOop.hpp"
|
|
#include "unittest.hpp"
|
|
#include "utilities/globalDefinitions.hpp"
|
|
|
|
TEST_VM(objArrayOop, osize) {
|
|
static const struct {
|
|
int objal; bool ccp; bool coops; bool coh; int result;
|
|
} x[] = {
|
|
// ObjAligInB, UseCCP, UseCoops, UseCOH, object size in heap words
|
|
#ifdef _LP64
|
|
{ 8, false, false, false, 4 }, // 20 byte header, 8 byte oops
|
|
{ 8, false, true, false, 3 }, // 20 byte header, 4 byte oops
|
|
{ 8, true, false, false, 3 }, // 16 byte header, 8 byte oops
|
|
{ 8, true, true, false, 3 }, // 16 byte header, 4 byte oops
|
|
{ 8, true, false, true, 3 }, // 12 byte header, 8 byte oops
|
|
{ 8, true, true, true, 2 }, // 12 byte header, 4 byte oops
|
|
{ 16, false, false, false, 4 }, // 20 byte header, 8 byte oops, 16-byte align
|
|
{ 16, false, true, false, 4 }, // 20 byte header, 4 byte oops, 16-byte align
|
|
{ 16, true, false, false, 4 }, // 16 byte header, 8 byte oops, 16-byte align
|
|
{ 16, true, true, false, 4 }, // 16 byte header, 4 byte oops, 16-byte align
|
|
{ 16, true, false, true, 4 }, // 12 byte header, 8 byte oops, 16-byte align
|
|
{ 16, true, true, true, 2 }, // 12 byte header, 4 byte oops, 16-byte align
|
|
{ 256, false, false, false, 32 }, // 20 byte header, 8 byte oops, 256-byte align
|
|
{ 256, false, true, false, 32 }, // 20 byte header, 4 byte oops, 256-byte align
|
|
{ 256, true, false, false, 32 }, // 16 byte header, 8 byte oops, 256-byte align
|
|
{ 256, true, true, false, 32 }, // 16 byte header, 4 byte oops, 256-byte align
|
|
{ 256, true, false, true, 32 }, // 12 byte header, 8 byte oops, 256-byte align
|
|
{ 256, true, true, true, 32 }, // 12 byte header, 4 byte oops, 256-byte align
|
|
#else
|
|
{ 8, false, false, false, 4 }, // 12 byte header, 4 byte oops, wordsize 4
|
|
#endif
|
|
{ -1, false, false, false, -1 }
|
|
};
|
|
for (int i = 0; x[i].result != -1; i++) {
|
|
if (x[i].objal == (int)ObjectAlignmentInBytes && x[i].ccp == UseCompressedClassPointers && x[i].coops == UseCompressedOops &&
|
|
x[i].coh == UseCompactObjectHeaders) {
|
|
EXPECT_EQ(objArrayOopDesc::object_size(1), (size_t)x[i].result);
|
|
}
|
|
}
|
|
}
|