equal
deleted
inserted
replaced
881 } else { |
881 } else { |
882 // template code: |
882 // template code: |
883 // |
883 // |
884 // markWord displaced_header = obj->mark().set_unlocked(); |
884 // markWord displaced_header = obj->mark().set_unlocked(); |
885 // monitor->lock()->set_displaced_header(displaced_header); |
885 // monitor->lock()->set_displaced_header(displaced_header); |
886 // if (Atomic::cmpxchg(/*ex=*/monitor, /*addr*/obj->mark_addr(), /*cmp*/displaced_header) == displaced_header) { |
886 // if (Atomic::cmpxchg(/*addr*/obj->mark_addr(), /*cmp*/displaced_header, /*ex=*/monitor) == displaced_header) { |
887 // // We stored the monitor address into the object's mark word. |
887 // // We stored the monitor address into the object's mark word. |
888 // } else if (THREAD->is_lock_owned((address)displaced_header)) |
888 // } else if (THREAD->is_lock_owned((address)displaced_header)) |
889 // // Simple recursive case. |
889 // // Simple recursive case. |
890 // monitor->lock()->set_displaced_header(NULL); |
890 // monitor->lock()->set_displaced_header(NULL); |
891 // } else { |
891 // } else { |
919 |
919 |
920 // Initialize the box (Must happen before we update the object mark!). |
920 // Initialize the box (Must happen before we update the object mark!). |
921 std(displaced_header, BasicObjectLock::lock_offset_in_bytes() + |
921 std(displaced_header, BasicObjectLock::lock_offset_in_bytes() + |
922 BasicLock::displaced_header_offset_in_bytes(), monitor); |
922 BasicLock::displaced_header_offset_in_bytes(), monitor); |
923 |
923 |
924 // if (Atomic::cmpxchg(/*ex=*/monitor, /*addr*/obj->mark_addr(), /*cmp*/displaced_header) == displaced_header) { |
924 // if (Atomic::cmpxchg(/*addr*/obj->mark_addr(), /*cmp*/displaced_header, /*ex=*/monitor) == displaced_header) { |
925 |
925 |
926 // Store stack address of the BasicObjectLock (this is monitor) into object. |
926 // Store stack address of the BasicObjectLock (this is monitor) into object. |
927 addi(object_mark_addr, object, oopDesc::mark_offset_in_bytes()); |
927 addi(object_mark_addr, object, oopDesc::mark_offset_in_bytes()); |
928 |
928 |
929 // Must fence, otherwise, preceding store(s) may float below cmpxchg. |
929 // Must fence, otherwise, preceding store(s) may float below cmpxchg. |
995 // template code: |
995 // template code: |
996 // |
996 // |
997 // if ((displaced_header = monitor->displaced_header()) == NULL) { |
997 // if ((displaced_header = monitor->displaced_header()) == NULL) { |
998 // // Recursive unlock. Mark the monitor unlocked by setting the object field to NULL. |
998 // // Recursive unlock. Mark the monitor unlocked by setting the object field to NULL. |
999 // monitor->set_obj(NULL); |
999 // monitor->set_obj(NULL); |
1000 // } else if (Atomic::cmpxchg(displaced_header, obj->mark_addr(), monitor) == monitor) { |
1000 // } else if (Atomic::cmpxchg(obj->mark_addr(), monitor, displaced_header) == monitor) { |
1001 // // We swapped the unlocked mark in displaced_header into the object's mark word. |
1001 // // We swapped the unlocked mark in displaced_header into the object's mark word. |
1002 // monitor->set_obj(NULL); |
1002 // monitor->set_obj(NULL); |
1003 // } else { |
1003 // } else { |
1004 // // Slow path. |
1004 // // Slow path. |
1005 // InterpreterRuntime::monitorexit(THREAD, monitor); |
1005 // InterpreterRuntime::monitorexit(THREAD, monitor); |
1028 |
1028 |
1029 // If the displaced header is zero, we have a recursive unlock. |
1029 // If the displaced header is zero, we have a recursive unlock. |
1030 cmpdi(CCR0, displaced_header, 0); |
1030 cmpdi(CCR0, displaced_header, 0); |
1031 beq(CCR0, free_slot); // recursive unlock |
1031 beq(CCR0, free_slot); // recursive unlock |
1032 |
1032 |
1033 // } else if (Atomic::cmpxchg(displaced_header, obj->mark_addr(), monitor) == monitor) { |
1033 // } else if (Atomic::cmpxchg(obj->mark_addr(), monitor, displaced_header) == monitor) { |
1034 // // We swapped the unlocked mark in displaced_header into the object's mark word. |
1034 // // We swapped the unlocked mark in displaced_header into the object's mark word. |
1035 // monitor->set_obj(NULL); |
1035 // monitor->set_obj(NULL); |
1036 |
1036 |
1037 // If we still have a lightweight lock, unlock the object and be done. |
1037 // If we still have a lightweight lock, unlock the object and be done. |
1038 |
1038 |