author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 41671 | hotspot/test/native/oops/test_arrayOop.cpp@9e0c6db4918a |
permissions | -rw-r--r-- |
1 | 1 |
/* |
41290 | 2 |
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
21 |
* questions. |
1 | 22 |
*/ |
23 |
||
7397 | 24 |
#include "precompiled.hpp" |
25 |
#include "oops/arrayOop.hpp" |
|
11637
030466036615
7013347: allow crypto functions to be called inline to enhance performance
never
parents:
11247
diff
changeset
|
26 |
#include "oops/oop.inline.hpp" |
41290 | 27 |
#include "unittest.hpp" |
10994
fc93bca9c720
7102044: G1: VM crashes with assert(old_end != new_end) failed: don't call this otherwise
brutisso
parents:
8921
diff
changeset
|
28 |
#include "utilities/globalDefinitions.hpp" |
fc93bca9c720
7102044: G1: VM crashes with assert(old_end != new_end) failed: don't call this otherwise
brutisso
parents:
8921
diff
changeset
|
29 |
|
41290 | 30 |
class arrayOopDescTest { |
31 |
public: |
|
32 |
||
33 |
static int header_size_in_bytes() { |
|
34 |
return arrayOopDesc::header_size_in_bytes(); |
|
35 |
} |
|
36 |
}; |
|
37 |
||
38 |
static bool check_max_length_overflow(BasicType type) { |
|
39 |
julong length = arrayOopDesc::max_array_length(type); |
|
10994
fc93bca9c720
7102044: G1: VM crashes with assert(old_end != new_end) failed: don't call this otherwise
brutisso
parents:
8921
diff
changeset
|
40 |
julong bytes_per_element = type2aelembytes(type); |
41290 | 41 |
julong bytes = length * bytes_per_element |
42 |
+ arrayOopDescTest::header_size_in_bytes(); |
|
43 |
return (julong) (size_t) bytes == bytes; |
|
44 |
} |
|
45 |
||
41671
9e0c6db4918a
8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents:
41290
diff
changeset
|
46 |
TEST_VM(arrayOopDesc, boolean) { |
41290 | 47 |
ASSERT_PRED1(check_max_length_overflow, T_BOOLEAN); |
48 |
} |
|
49 |
||
41671
9e0c6db4918a
8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents:
41290
diff
changeset
|
50 |
TEST_VM(arrayOopDesc, char) { |
41290 | 51 |
ASSERT_PRED1(check_max_length_overflow, T_CHAR); |
52 |
} |
|
53 |
||
41671
9e0c6db4918a
8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents:
41290
diff
changeset
|
54 |
TEST_VM(arrayOopDesc, float) { |
41290 | 55 |
ASSERT_PRED1(check_max_length_overflow, T_FLOAT); |
10994
fc93bca9c720
7102044: G1: VM crashes with assert(old_end != new_end) failed: don't call this otherwise
brutisso
parents:
8921
diff
changeset
|
56 |
} |
fc93bca9c720
7102044: G1: VM crashes with assert(old_end != new_end) failed: don't call this otherwise
brutisso
parents:
8921
diff
changeset
|
57 |
|
41671
9e0c6db4918a
8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents:
41290
diff
changeset
|
58 |
TEST_VM(arrayOopDesc, double) { |
41290 | 59 |
ASSERT_PRED1(check_max_length_overflow, T_DOUBLE); |
60 |
} |
|
10994
fc93bca9c720
7102044: G1: VM crashes with assert(old_end != new_end) failed: don't call this otherwise
brutisso
parents:
8921
diff
changeset
|
61 |
|
41671
9e0c6db4918a
8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents:
41290
diff
changeset
|
62 |
TEST_VM(arrayOopDesc, byte) { |
41290 | 63 |
ASSERT_PRED1(check_max_length_overflow, T_BYTE); |
64 |
} |
|
65 |
||
41671
9e0c6db4918a
8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents:
41290
diff
changeset
|
66 |
TEST_VM(arrayOopDesc, short) { |
41290 | 67 |
ASSERT_PRED1(check_max_length_overflow, T_SHORT); |
68 |
} |
|
69 |
||
41671
9e0c6db4918a
8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents:
41290
diff
changeset
|
70 |
TEST_VM(arrayOopDesc, int) { |
41290 | 71 |
ASSERT_PRED1(check_max_length_overflow, T_INT); |
10994
fc93bca9c720
7102044: G1: VM crashes with assert(old_end != new_end) failed: don't call this otherwise
brutisso
parents:
8921
diff
changeset
|
72 |
} |
fc93bca9c720
7102044: G1: VM crashes with assert(old_end != new_end) failed: don't call this otherwise
brutisso
parents:
8921
diff
changeset
|
73 |
|
41671
9e0c6db4918a
8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents:
41290
diff
changeset
|
74 |
TEST_VM(arrayOopDesc, long) { |
41290 | 75 |
ASSERT_PRED1(check_max_length_overflow, T_LONG); |
76 |
} |
|
77 |
||
41671
9e0c6db4918a
8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents:
41290
diff
changeset
|
78 |
TEST_VM(arrayOopDesc, object) { |
41290 | 79 |
ASSERT_PRED1(check_max_length_overflow, T_OBJECT); |
35529 | 80 |
} |
10994
fc93bca9c720
7102044: G1: VM crashes with assert(old_end != new_end) failed: don't call this otherwise
brutisso
parents:
8921
diff
changeset
|
81 |
|
41671
9e0c6db4918a
8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents:
41290
diff
changeset
|
82 |
TEST_VM(arrayOopDesc, array) { |
41290 | 83 |
ASSERT_PRED1(check_max_length_overflow, T_ARRAY); |
84 |
} |
|
85 |
||
41671
9e0c6db4918a
8166925: several native TESTs should be changed to TEST_VM
iignatyev
parents:
41290
diff
changeset
|
86 |
TEST_VM(arrayOopDesc, narrowOop) { |
41290 | 87 |
ASSERT_PRED1(check_max_length_overflow, T_NARROWOOP); |
88 |
} |
|
89 |
// T_VOID and T_ADDRESS are not supported by max_array_length() |