1055
1056 // The prior sequence "LGR, NGR, LTGR" can be done better
1057 // (Z_R1 is temp and not used after here).
1058 load_const_optimized(Z_R0, (~(os::vm_page_size() - 1) | markWord::lock_mask_in_place));
1059 z_ngr(Z_R0, current_header); // AND sets CC (result eq/ne 0)
1060
1061 // If condition is true we are done and hence we can store 0 in the displaced
1062 // header indicating it is a recursive lock and be done.
1063 z_brne(slow_case);
1064 z_release(); // Member unnecessary on zarch AND because the above csg does a sync before and after.
1065 z_stg(Z_R0/*==0!*/, mark_offset, monitor);
1066 }
1067 z_bru(done);
1068 // } else {
1069 // // Slow path.
1070 // InterpreterRuntime::monitorenter(THREAD, monitor);
1071
1072 // None of the above fast optimizations worked so we have to get into the
1073 // slow case of monitor enter.
1074 bind(slow_case);
1075 if (LockingMode == LM_LIGHTWEIGHT) {
1076 // for lightweight locking we need to use monitorenter_obj, see interpreterRuntime.cpp
1077 call_VM(noreg,
1078 CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter_obj),
1079 object);
1080 } else {
1081 call_VM(noreg,
1082 CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter),
1083 monitor);
1084 }
1085 // }
1086
1087 bind(done);
1088 }
1089
1090 // Unlocks an object. Used in monitorexit bytecode and remove_activation.
1091 //
1092 // Registers alive
1093 // monitor - address of the BasicObjectLock to be used for locking,
1094 // which must be initialized with the object to lock.
1095 //
1096 // Throw IllegalMonitorException if object is not locked by current thread.
1097 void InterpreterMacroAssembler::unlock_object(Register monitor, Register object) {
1098
1099 if (LockingMode == LM_MONITOR) {
1100 call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), monitor);
1101 return;
1102 }
1103
1104 // else {
|
1055
1056 // The prior sequence "LGR, NGR, LTGR" can be done better
1057 // (Z_R1 is temp and not used after here).
1058 load_const_optimized(Z_R0, (~(os::vm_page_size() - 1) | markWord::lock_mask_in_place));
1059 z_ngr(Z_R0, current_header); // AND sets CC (result eq/ne 0)
1060
1061 // If condition is true we are done and hence we can store 0 in the displaced
1062 // header indicating it is a recursive lock and be done.
1063 z_brne(slow_case);
1064 z_release(); // Member unnecessary on zarch AND because the above csg does a sync before and after.
1065 z_stg(Z_R0/*==0!*/, mark_offset, monitor);
1066 }
1067 z_bru(done);
1068 // } else {
1069 // // Slow path.
1070 // InterpreterRuntime::monitorenter(THREAD, monitor);
1071
1072 // None of the above fast optimizations worked so we have to get into the
1073 // slow case of monitor enter.
1074 bind(slow_case);
1075 call_VM(noreg,
1076 CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter),
1077 monitor);
1078 // }
1079
1080 bind(done);
1081 }
1082
1083 // Unlocks an object. Used in monitorexit bytecode and remove_activation.
1084 //
1085 // Registers alive
1086 // monitor - address of the BasicObjectLock to be used for locking,
1087 // which must be initialized with the object to lock.
1088 //
1089 // Throw IllegalMonitorException if object is not locked by current thread.
1090 void InterpreterMacroAssembler::unlock_object(Register monitor, Register object) {
1091
1092 if (LockingMode == LM_MONITOR) {
1093 call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit), monitor);
1094 return;
1095 }
1096
1097 // else {
|