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 25 #include "precompiled.hpp" 26 #include "gc/shared/barrierSet.hpp" 27 #include "gc/shared/barrierSetAssembler.hpp" 28 #include "gc/shared/barrierSetNMethod.hpp" 29 #include "gc/shared/collectedHeap.hpp" 30 #include "interpreter/interp_masm.hpp" 31 #include "memory/universe.hpp" 32 #include "runtime/jniHandles.hpp" 33 #include "runtime/sharedRuntime.hpp" 34 #include "runtime/thread.hpp" 35 36 #define __ masm-> 37 38 void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, 39 Register dst, Address src, Register tmp1, Register tmp_thread) { 40 bool in_heap = (decorators & IN_HEAP) != 0; 41 bool in_native = (decorators & IN_NATIVE) != 0; 42 bool is_not_null = (decorators & IS_NOT_NULL) != 0; 43 bool atomic = (decorators & MO_RELAXED) != 0; 44 45 assert(type != T_VALUETYPE, "Not supported yet"); 46 switch (type) { 47 case T_OBJECT: 48 case T_ARRAY: { 177 } else { 178 __ movptr(dst, rax); 179 __ movptr(dst.plus_disp(wordSize), rdx); 180 } 181 #endif 182 break; 183 case T_FLOAT: 184 assert(val == noreg, "only tos"); 185 __ store_float(dst); 186 break; 187 case T_DOUBLE: 188 assert(val == noreg, "only tos"); 189 __ store_double(dst); 190 break; 191 case T_ADDRESS: 192 __ movptr(dst, val); 193 break; 194 default: Unimplemented(); 195 } 196 } 197 198 #ifndef _LP64 199 void BarrierSetAssembler::obj_equals(MacroAssembler* masm, 200 Address obj1, jobject obj2) { 201 __ cmpoop_raw(obj1, obj2); 202 } 203 204 void BarrierSetAssembler::obj_equals(MacroAssembler* masm, 205 Register obj1, jobject obj2) { 206 __ cmpoop_raw(obj1, obj2); 207 } 208 #endif 209 void BarrierSetAssembler::obj_equals(MacroAssembler* masm, 210 Register obj1, Address obj2) { 211 __ cmpptr(obj1, obj2); 212 } 213 214 void BarrierSetAssembler::obj_equals(MacroAssembler* masm, 215 Register obj1, Register obj2) { 216 __ cmpptr(obj1, obj2); | 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 25 #include "precompiled.hpp" 26 #include "asm/macroAssembler.inline.hpp" 27 #include "gc/shared/barrierSet.hpp" 28 #include "gc/shared/barrierSetAssembler.hpp" 29 #include "gc/shared/barrierSetNMethod.hpp" 30 #include "gc/shared/barrierSetRuntime.hpp" 31 #include "gc/shared/collectedHeap.hpp" 32 #include "interpreter/interp_masm.hpp" 33 #include "memory/universe.hpp" 34 #include "runtime/jniHandles.hpp" 35 #include "runtime/sharedRuntime.hpp" 36 #include "runtime/thread.hpp" 37 38 #define __ masm-> 39 40 void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, 41 Register dst, Address src, Register tmp1, Register tmp_thread) { 42 bool in_heap = (decorators & IN_HEAP) != 0; 43 bool in_native = (decorators & IN_NATIVE) != 0; 44 bool is_not_null = (decorators & IS_NOT_NULL) != 0; 45 bool atomic = (decorators & MO_RELAXED) != 0; 46 47 assert(type != T_VALUETYPE, "Not supported yet"); 48 switch (type) { 49 case T_OBJECT: 50 case T_ARRAY: { 179 } else { 180 __ movptr(dst, rax); 181 __ movptr(dst.plus_disp(wordSize), rdx); 182 } 183 #endif 184 break; 185 case T_FLOAT: 186 assert(val == noreg, "only tos"); 187 __ store_float(dst); 188 break; 189 case T_DOUBLE: 190 assert(val == noreg, "only tos"); 191 __ store_double(dst); 192 break; 193 case T_ADDRESS: 194 __ movptr(dst, val); 195 break; 196 default: Unimplemented(); 197 } 198 } 199 200 void BarrierSetAssembler::value_copy(MacroAssembler* masm, DecoratorSet decorators, 201 Register src, Register dst, Register value_klass) { 202 // value_copy implementation is fairly complex, and there are not any 203 // "short-cuts" to be made from asm. What there is, appears to have the same 204 // cost in C++, so just "call_VM_leaf" for now rather than maintain hundreds 205 // of hand-rolled instructions... 206 if (decorators & IS_DEST_UNINITIALIZED) { 207 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSetRuntime::value_copy_is_dest_uninitialized), src, dst, value_klass); 208 } else { 209 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSetRuntime::value_copy), src, dst, value_klass); 210 } 211 } 212 213 214 #ifndef _LP64 215 void BarrierSetAssembler::obj_equals(MacroAssembler* masm, 216 Address obj1, jobject obj2) { 217 __ cmpoop_raw(obj1, obj2); 218 } 219 220 void BarrierSetAssembler::obj_equals(MacroAssembler* masm, 221 Register obj1, jobject obj2) { 222 __ cmpoop_raw(obj1, obj2); 223 } 224 #endif 225 void BarrierSetAssembler::obj_equals(MacroAssembler* masm, 226 Register obj1, Address obj2) { 227 __ cmpptr(obj1, obj2); 228 } 229 230 void BarrierSetAssembler::obj_equals(MacroAssembler* masm, 231 Register obj1, Register obj2) { 232 __ cmpptr(obj1, obj2); |