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 "oops/objArrayOop.hpp"
25 #include "unittest.hpp"
26 #include "utilities/globalDefinitions.hpp"
27
28 TEST_VM(objArrayOop, osize) {
29 static const struct {
30 int objal; bool ccp; bool coops; bool coh; int result;
31 } x[] = {
32 // ObjAligInB, UseCCP, UseCoops, UseCOH, object size in heap words
33 #ifdef _LP64
34 { 8, false, false, false, 4 }, // 20 byte header, 8 byte oops
35 { 8, false, true, false, 3 }, // 20 byte header, 4 byte oops
36 { 8, true, false, false, 3 }, // 16 byte header, 8 byte oops
37 { 8, true, true, false, 3 }, // 16 byte header, 4 byte oops
38 { 8, true, false, true, 3 }, // 12 byte header, 8 byte oops
39 { 8, true, true, true, 2 }, // 12 byte header, 4 byte oops
40 { 16, false, false, false, 4 }, // 20 byte header, 8 byte oops, 16-byte align
41 { 16, false, true, false, 4 }, // 20 byte header, 4 byte oops, 16-byte align
42 { 16, true, false, false, 4 }, // 16 byte header, 8 byte oops, 16-byte align
43 { 16, true, true, false, 4 }, // 16 byte header, 4 byte oops, 16-byte align
44 { 16, true, false, true, 4 }, // 12 byte header, 8 byte oops, 16-byte align
45 { 16, true, true, true, 2 }, // 12 byte header, 4 byte oops, 16-byte align
46 { 256, false, false, false, 32 }, // 20 byte header, 8 byte oops, 256-byte align
47 { 256, false, true, false, 32 }, // 20 byte header, 4 byte oops, 256-byte align
48 { 256, true, false, false, 32 }, // 16 byte header, 8 byte oops, 256-byte align
49 { 256, true, true, false, 32 }, // 16 byte header, 4 byte oops, 256-byte align
50 { 256, true, false, true, 32 }, // 12 byte header, 8 byte oops, 256-byte align
51 { 256, true, true, true, 32 }, // 12 byte header, 4 byte oops, 256-byte align
52 #else
53 { 8, false, false, false, 4 }, // 12 byte header, 4 byte oops, wordsize 4
54 #endif
55 { -1, false, false, false, -1 }
56 };
57 for (int i = 0; x[i].result != -1; i++) {
58 if (x[i].objal == (int)ObjectAlignmentInBytes && x[i].ccp == UseCompressedClassPointers && x[i].coops == UseCompressedOops &&
59 x[i].coh == UseCompactObjectHeaders) {
60 EXPECT_EQ(objArrayOopDesc::object_size(1), (size_t)x[i].result);
61 }
62 }
63 }
|
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 "oops/objArrayOop.hpp"
25 #include "oops/refArrayOop.hpp"
26 #include "unittest.hpp"
27 #include "utilities/globalDefinitions.hpp"
28
29 // TODO FIXME This test needs to be rewritten after objArray/refArray/flatArray rework
30
31 TEST_VM(objArrayOop, osize) {
32 static const struct {
33 int objal; bool ccp; bool coops; bool coh; int result;
34 } x[] = {
35 // ObjAligInB, UseCCP, UseCoops, UseCOH, object size in heap words
36 #ifdef _LP64
37 { 8, false, false, false, 4 }, // 20 byte header, 8 byte oops
38 { 8, false, true, false, 3 }, // 20 byte header, 4 byte oops
39 { 8, true, false, false, 3 }, // 16 byte header, 8 byte oops
40 { 8, true, true, false, 3 }, // 16 byte header, 4 byte oops
41 { 8, true, false, true, 3 }, // 12 byte header, 8 byte oops
42 { 8, true, true, true, 2 }, // 12 byte header, 4 byte oops
43 { 16, false, false, false, 4 }, // 20 byte header, 8 byte oops, 16-byte align
44 { 16, false, true, false, 4 }, // 20 byte header, 4 byte oops, 16-byte align
45 { 16, true, false, false, 4 }, // 16 byte header, 8 byte oops, 16-byte align
46 { 16, true, true, false, 4 }, // 16 byte header, 4 byte oops, 16-byte align
47 { 16, true, false, true, 4 }, // 12 byte header, 8 byte oops, 16-byte align
48 { 16, true, true, true, 2 }, // 12 byte header, 4 byte oops, 16-byte align
49 { 256, false, false, false, 32 }, // 20 byte header, 8 byte oops, 256-byte align
50 { 256, false, true, false, 32 }, // 20 byte header, 4 byte oops, 256-byte align
51 { 256, true, false, false, 32 }, // 16 byte header, 8 byte oops, 256-byte align
52 { 256, true, true, false, 32 }, // 16 byte header, 4 byte oops, 256-byte align
53 { 256, true, false, true, 32 }, // 12 byte header, 8 byte oops, 256-byte align
54 { 256, true, true, true, 32 }, // 12 byte header, 4 byte oops, 256-byte align
55 #else
56 { 8, false, false, false, 4 }, // 12 byte header, 4 byte oops, wordsize 4
57 #endif
58 { -1, false, false, false, -1 }
59 };
60 for (int i = 0; x[i].result != -1; i++) {
61 if (x[i].objal == (int)ObjectAlignmentInBytes && x[i].ccp == UseCompressedClassPointers && x[i].coops == UseCompressedOops &&
62 x[i].coh == UseCompactObjectHeaders) {
63 EXPECT_EQ(refArrayOopDesc::object_size(1), (size_t)x[i].result);
64 }
65 }
66 }
|