< prev index next >

test/hotspot/gtest/oops/test_typeArrayOop.cpp

Print this page

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 
25 #include "precompiled.hpp"
26 #include "memory/universe.hpp"
27 #include "oops/oop.inline.hpp"
28 #include "oops/typeArrayOop.inline.hpp"
29 #include "unittest.hpp"
30 #include "utilities/globalDefinitions.hpp"
31 
32 TEST_VM(typeArrayOopDesc, bool_at_put) {
33   char mem[100];
34   memset(mem, 0, ARRAY_SIZE(mem));
35 
36   char* addr = align_up(mem, 16);
37 
38   typeArrayOop o = (typeArrayOop) cast_to_oop(addr);
39   o->set_klass(Universe::boolArrayKlass());




40   o->set_length(10);
41 
42 
43   ASSERT_EQ((jboolean)0, o->bool_at(0));
44   ASSERT_EQ((jboolean)0, o->bool_at(1));
45   ASSERT_EQ((jboolean)0, o->bool_at(2));
46   ASSERT_EQ((jboolean)0, o->bool_at(3));
47   ASSERT_EQ((jboolean)0, o->bool_at(4));
48   ASSERT_EQ((jboolean)0, o->bool_at(5));
49   ASSERT_EQ((jboolean)0, o->bool_at(6));
50   ASSERT_EQ((jboolean)0, o->bool_at(7));
51 
52   o->bool_at_put(3, 255); // Check for masking store.
53   o->bool_at_put(2, 1);
54   o->bool_at_put(1, 1);
55   o->bool_at_put(0, 1);
56 
57   ASSERT_EQ((jboolean)1, o->bool_at(0));
58   ASSERT_EQ((jboolean)1, o->bool_at(1));
59   ASSERT_EQ((jboolean)1, o->bool_at(2));

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 
25 #include "precompiled.hpp"
26 #include "memory/universe.hpp"
27 #include "oops/oop.inline.hpp"
28 #include "oops/typeArrayOop.inline.hpp"
29 #include "unittest.hpp"
30 #include "utilities/globalDefinitions.hpp"
31 
32 TEST_VM(typeArrayOopDesc, bool_at_put) {
33   char mem[100];
34   memset(mem, 0, ARRAY_SIZE(mem));
35 
36   char* addr = align_up(mem, 16);
37 
38   typeArrayOop o = (typeArrayOop) cast_to_oop(addr);
39   if (UseCompactObjectHeaders) {
40     o->set_mark(Universe::boolArrayKlass()->prototype_header());
41   } else {
42     o->set_klass(Universe::boolArrayKlass());
43   }
44   o->set_length(10);
45 
46 
47   ASSERT_EQ((jboolean)0, o->bool_at(0));
48   ASSERT_EQ((jboolean)0, o->bool_at(1));
49   ASSERT_EQ((jboolean)0, o->bool_at(2));
50   ASSERT_EQ((jboolean)0, o->bool_at(3));
51   ASSERT_EQ((jboolean)0, o->bool_at(4));
52   ASSERT_EQ((jboolean)0, o->bool_at(5));
53   ASSERT_EQ((jboolean)0, o->bool_at(6));
54   ASSERT_EQ((jboolean)0, o->bool_at(7));
55 
56   o->bool_at_put(3, 255); // Check for masking store.
57   o->bool_at_put(2, 1);
58   o->bool_at_put(1, 1);
59   o->bool_at_put(0, 1);
60 
61   ASSERT_EQ((jboolean)1, o->bool_at(0));
62   ASSERT_EQ((jboolean)1, o->bool_at(1));
63   ASSERT_EQ((jboolean)1, o->bool_at(2));
< prev index next >