93 System.exit(97); |
93 System.exit(97); |
94 } |
94 } |
95 |
95 |
96 obj = getRef3(unsafe, t, referent_offset); |
96 obj = getRef3(unsafe, t, referent_offset); |
97 if (obj != o) { |
97 if (obj != o) { |
98 System.out.println("FAILED: unsafe.getObject(Object, " + referent_offset + ") " + obj + " != " + o); |
98 System.out.println("FAILED: unsafe.getReference(Object, " + referent_offset + ") " + obj + " != " + o); |
99 System.exit(97); |
99 System.exit(97); |
100 } |
100 } |
101 obj = getRef4(unsafe, t, referent_offset); |
101 obj = getRef4(unsafe, t, referent_offset); |
102 if (obj != o) { |
102 if (obj != o) { |
103 System.out.println("FAILED: unsafe.getObject(Test7190310, " + referent_offset + ") " + obj + " != " + o); |
103 System.out.println("FAILED: unsafe.getReference(Test7190310, " + referent_offset + ") " + obj + " != " + o); |
104 System.exit(97); |
104 System.exit(97); |
105 } |
105 } |
106 } |
106 } |
107 |
107 |
108 static boolean verifyGet(long referent_offset, Unsafe unsafe) throws Exception { |
108 static boolean verifyGet(long referent_offset, Unsafe unsafe) throws Exception { |
113 System.out.println("FAILED: weakRef.get() " + obj + " != " + str); |
113 System.out.println("FAILED: weakRef.get() " + obj + " != " + str); |
114 return false; |
114 return false; |
115 } |
115 } |
116 obj = getRef1(unsafe, ref, referent_offset); |
116 obj = getRef1(unsafe, ref, referent_offset); |
117 if (obj != str) { |
117 if (obj != str) { |
118 System.out.println("FAILED: unsafe.getObject(weakRef, " + referent_offset + ") " + obj + " != " + str); |
118 System.out.println("FAILED: unsafe.getReference(weakRef, " + referent_offset + ") " + obj + " != " + str); |
119 return false; |
119 return false; |
120 } |
120 } |
121 obj = getRef2(unsafe, ref, referent_offset); |
121 obj = getRef2(unsafe, ref, referent_offset); |
122 if (obj != str) { |
122 if (obj != str) { |
123 System.out.println("FAILED: unsafe.getObject(abstRef, " + referent_offset + ") " + obj + " != " + str); |
123 System.out.println("FAILED: unsafe.getReference(abstRef, " + referent_offset + ") " + obj + " != " + str); |
124 return false; |
124 return false; |
125 } |
125 } |
126 obj = getRef3(unsafe, ref, referent_offset); |
126 obj = getRef3(unsafe, ref, referent_offset); |
127 if (obj != str) { |
127 if (obj != str) { |
128 System.out.println("FAILED: unsafe.getObject(Object, " + referent_offset + ") " + obj + " != " + str); |
128 System.out.println("FAILED: unsafe.getReference(Object, " + referent_offset + ") " + obj + " != " + str); |
129 return false; |
129 return false; |
130 } |
130 } |
131 return true; |
131 return true; |
132 } |
132 } |
133 |
133 |
134 static Object getRef0(WeakReference ref) throws Exception { |
134 static Object getRef0(WeakReference ref) throws Exception { |
135 return ref.get(); |
135 return ref.get(); |
136 } |
136 } |
137 |
137 |
138 static Object getRef1(Unsafe unsafe, WeakReference ref, long referent_offset) throws Exception { |
138 static Object getRef1(Unsafe unsafe, WeakReference ref, long referent_offset) throws Exception { |
139 return unsafe.getObject(ref, referent_offset); |
139 return unsafe.getReference(ref, referent_offset); |
140 } |
140 } |
141 |
141 |
142 static Object getRef2(Unsafe unsafe, Reference ref, long referent_offset) throws Exception { |
142 static Object getRef2(Unsafe unsafe, Reference ref, long referent_offset) throws Exception { |
143 return unsafe.getObject(ref, referent_offset); |
143 return unsafe.getReference(ref, referent_offset); |
144 } |
144 } |
145 |
145 |
146 static Object getRef3(Unsafe unsafe, Object ref, long referent_offset) throws Exception { |
146 static Object getRef3(Unsafe unsafe, Object ref, long referent_offset) throws Exception { |
147 return unsafe.getObject(ref, referent_offset); |
147 return unsafe.getReference(ref, referent_offset); |
148 } |
148 } |
149 |
149 |
150 static Object getRef4(Unsafe unsafe, Test7190310_unsafe ref, long referent_offset) throws Exception { |
150 static Object getRef4(Unsafe unsafe, Test7190310_unsafe ref, long referent_offset) throws Exception { |
151 return unsafe.getObject(ref, referent_offset); |
151 return unsafe.getReference(ref, referent_offset); |
152 } |
152 } |
153 } |
153 } |
154 |
154 |