1 /*
2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
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 *
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 *
2929
2930 void LIR_Assembler::pop(LIR_Opr opr) {
2931 Unimplemented();
2932 }
2933
2934
2935 void LIR_Assembler::monitor_address(int monitor_no, LIR_Opr dst_opr) {
2936 Address mon_addr = frame_map()->address_for_monitor_lock(monitor_no);
2937 Register dst = dst_opr->as_register();
2938 Register reg = mon_addr.base();
2939 int offset = mon_addr.disp();
2940 // compute pointer to BasicLock
2941 if (mon_addr.is_simm13()) {
2942 __ add(reg, offset, dst);
2943 } else {
2944 __ set(offset, dst);
2945 __ add(dst, reg, dst);
2946 }
2947 }
2948
2949
2950 void LIR_Assembler::emit_lock(LIR_OpLock* op) {
2951 Register obj = op->obj_opr()->as_register();
2952 Register hdr = op->hdr_opr()->as_register();
2953 Register lock = op->lock_opr()->as_register();
2954
2955 // obj may not be an oop
2956 if (op->code() == lir_lock) {
2957 MonitorEnterStub* stub = (MonitorEnterStub*)op->stub();
2958 if (UseFastLocking) {
2959 assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
2960 // add debug info for NullPointerException only if one is possible
2961 if (op->info() != NULL) {
2962 add_debug_info_for_null_check_here(op->info());
2963 }
2964 __ lock_object(hdr, obj, lock, op->scratch_opr()->as_register(), *op->stub()->entry());
2965 } else {
2966 // always do slow locking
2967 // note: the slow locking code could be inlined here, however if we use
2968 // slow locking, speed doesn't matter anyway and this solution is
|
1 /*
2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
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 *
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 *
2929
2930 void LIR_Assembler::pop(LIR_Opr opr) {
2931 Unimplemented();
2932 }
2933
2934
2935 void LIR_Assembler::monitor_address(int monitor_no, LIR_Opr dst_opr) {
2936 Address mon_addr = frame_map()->address_for_monitor_lock(monitor_no);
2937 Register dst = dst_opr->as_register();
2938 Register reg = mon_addr.base();
2939 int offset = mon_addr.disp();
2940 // compute pointer to BasicLock
2941 if (mon_addr.is_simm13()) {
2942 __ add(reg, offset, dst);
2943 } else {
2944 __ set(offset, dst);
2945 __ add(dst, reg, dst);
2946 }
2947 }
2948
2949 void LIR_Assembler::emit_updatecrc32(LIR_OpUpdateCRC32* op) {
2950 fatal("CRC32 intrinsic is not implemented on this platform");
2951 }
2952
2953 void LIR_Assembler::emit_lock(LIR_OpLock* op) {
2954 Register obj = op->obj_opr()->as_register();
2955 Register hdr = op->hdr_opr()->as_register();
2956 Register lock = op->lock_opr()->as_register();
2957
2958 // obj may not be an oop
2959 if (op->code() == lir_lock) {
2960 MonitorEnterStub* stub = (MonitorEnterStub*)op->stub();
2961 if (UseFastLocking) {
2962 assert(BasicLock::displaced_header_offset_in_bytes() == 0, "lock_reg must point to the displaced header");
2963 // add debug info for NullPointerException only if one is possible
2964 if (op->info() != NULL) {
2965 add_debug_info_for_null_check_here(op->info());
2966 }
2967 __ lock_object(hdr, obj, lock, op->scratch_opr()->as_register(), *op->stub()->entry());
2968 } else {
2969 // always do slow locking
2970 // note: the slow locking code could be inlined here, however if we use
2971 // slow locking, speed doesn't matter anyway and this solution is
|