< 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::boolArrayKlassObj());







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 #ifdef _LP64
40   if (UseCompactObjectHeaders) {
41     o->set_mark(Universe::boolArrayKlassObj()->prototype_header());
42   } else
43 #endif
44   {
45     o->set_klass(Universe::boolArrayKlassObj());
46   }
47   o->set_length(10);
48 
49 
50   ASSERT_EQ((jboolean)0, o->bool_at(0));
51   ASSERT_EQ((jboolean)0, o->bool_at(1));
52   ASSERT_EQ((jboolean)0, o->bool_at(2));
53   ASSERT_EQ((jboolean)0, o->bool_at(3));
54   ASSERT_EQ((jboolean)0, o->bool_at(4));
55   ASSERT_EQ((jboolean)0, o->bool_at(5));
56   ASSERT_EQ((jboolean)0, o->bool_at(6));
57   ASSERT_EQ((jboolean)0, o->bool_at(7));
58 
59   o->bool_at_put(3, 255); // Check for masking store.
60   o->bool_at_put(2, 1);
61   o->bool_at_put(1, 1);
62   o->bool_at_put(0, 1);
63 
64   ASSERT_EQ((jboolean)1, o->bool_at(0));
65   ASSERT_EQ((jboolean)1, o->bool_at(1));
66   ASSERT_EQ((jboolean)1, o->bool_at(2));
< prev index next >