819 // get synchronization object
820 {
821 Label done;
822 __ ldrw(r0, access_flags);
823 __ tst(r0, JVM_ACC_STATIC);
824 // get receiver (assume this is frequent case)
825 __ ldr(r0, Address(rlocals, Interpreter::local_offset_in_bytes(0)));
826 __ br(Assembler::EQ, done);
827 __ load_mirror(r0, rmethod);
828
829 #ifdef ASSERT
830 {
831 Label L;
832 __ cbnz(r0, L);
833 __ stop("synchronization object is NULL");
834 __ bind(L);
835 }
836 #endif // ASSERT
837
838 __ bind(done);
839 }
840
841 // add space for monitor & lock
842 __ sub(sp, sp, entry_size); // add space for a monitor entry
843 __ sub(esp, esp, entry_size);
844 __ mov(rscratch1, esp);
845 __ str(rscratch1, monitor_block_top); // set new monitor block top
846 // store object
847 __ str(r0, Address(esp, BasicObjectLock::obj_offset_in_bytes()));
848 __ mov(c_rarg1, esp); // object address
849 __ lock_object(c_rarg1);
850 }
851
852 // Generate a fixed interpreter frame. This is identical setup for
853 // interpreted methods and for native methods hence the shared code.
854 //
855 // Args:
856 // lr: return address
857 // rmethod: Method*
858 // rlocals: pointer to locals
1045 __ safepoint_poll(slow_path);
1046
1047 // We don't generate local frame and don't align stack because
1048 // we call stub code and there is no safepoint on this path.
1049
1050 // Load parameters
1051 const Register crc = c_rarg0; // crc
1052 const Register buf = c_rarg1; // source java byte array address
1053 const Register len = c_rarg2; // length
1054 const Register off = len; // offset (never overlaps with 'len')
1055
1056 // Arguments are reversed on java expression stack
1057 // Calculate address of start element
1058 if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) {
1059 __ ldr(buf, Address(esp, 2*wordSize)); // long buf
1060 __ ldrw(off, Address(esp, wordSize)); // offset
1061 __ add(buf, buf, off); // + offset
1062 __ ldrw(crc, Address(esp, 4*wordSize)); // Initial CRC
1063 } else {
1064 __ ldr(buf, Address(esp, 2*wordSize)); // byte[] array
1065 __ add(buf, buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
1066 __ ldrw(off, Address(esp, wordSize)); // offset
1067 __ add(buf, buf, off); // + offset
1068 __ ldrw(crc, Address(esp, 3*wordSize)); // Initial CRC
1069 }
1070 // Can now load 'len' since we're finished with 'off'
1071 __ ldrw(len, Address(esp, 0x0)); // Length
1072
1073 __ andr(sp, r13, -16); // Restore the caller's SP
1074
1075 // We are frameless so we can just jump to the stub.
1076 __ b(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()));
1077
1078 // generate a vanilla native entry as the slow path
1079 __ bind(slow_path);
1080 __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native));
1081 return entry;
1082 }
1083 return NULL;
1084 }
1089 * int java.util.zip.CRC32C.updateDirectByteBuffer(int crc, long buf, int off, int end)
1090 * Unlike CRC32, CRC32C does not have any methods marked as native
1091 * CRC32C also uses an "end" variable instead of the length variable CRC32 uses
1092 */
1093 address TemplateInterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) {
1094 if (UseCRC32CIntrinsics) {
1095 address entry = __ pc();
1096
1097 // Prepare jump to stub using parameters from the stack
1098 const Register crc = c_rarg0; // initial crc
1099 const Register buf = c_rarg1; // source java byte array address
1100 const Register len = c_rarg2; // len argument to the kernel
1101
1102 const Register end = len; // index of last element to process
1103 const Register off = crc; // offset
1104
1105 __ ldrw(end, Address(esp)); // int end
1106 __ ldrw(off, Address(esp, wordSize)); // int offset
1107 __ sub(len, end, off);
1108 __ ldr(buf, Address(esp, 2*wordSize)); // byte[] buf | long buf
1109 __ add(buf, buf, off); // + offset
1110 if (kind == Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer) {
1111 __ ldrw(crc, Address(esp, 4*wordSize)); // long crc
1112 } else {
1113 __ add(buf, buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
1114 __ ldrw(crc, Address(esp, 3*wordSize)); // long crc
1115 }
1116
1117 __ andr(sp, r13, -16); // Restore the caller's SP
1118
1119 // Jump to the stub.
1120 __ b(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32C()));
1121
1122 return entry;
1123 }
1124 return NULL;
1125 }
1126
1127 void TemplateInterpreterGenerator::bang_stack_shadow_pages(bool native_call) {
1128 // Bang each page in the shadow zone. We can't assume it's been done for
|
819 // get synchronization object
820 {
821 Label done;
822 __ ldrw(r0, access_flags);
823 __ tst(r0, JVM_ACC_STATIC);
824 // get receiver (assume this is frequent case)
825 __ ldr(r0, Address(rlocals, Interpreter::local_offset_in_bytes(0)));
826 __ br(Assembler::EQ, done);
827 __ load_mirror(r0, rmethod);
828
829 #ifdef ASSERT
830 {
831 Label L;
832 __ cbnz(r0, L);
833 __ stop("synchronization object is NULL");
834 __ bind(L);
835 }
836 #endif // ASSERT
837
838 __ bind(done);
839 __ resolve(IS_NOT_NULL, r0);
840 }
841
842 // add space for monitor & lock
843 __ sub(sp, sp, entry_size); // add space for a monitor entry
844 __ sub(esp, esp, entry_size);
845 __ mov(rscratch1, esp);
846 __ str(rscratch1, monitor_block_top); // set new monitor block top
847 // store object
848 __ str(r0, Address(esp, BasicObjectLock::obj_offset_in_bytes()));
849 __ mov(c_rarg1, esp); // object address
850 __ lock_object(c_rarg1);
851 }
852
853 // Generate a fixed interpreter frame. This is identical setup for
854 // interpreted methods and for native methods hence the shared code.
855 //
856 // Args:
857 // lr: return address
858 // rmethod: Method*
859 // rlocals: pointer to locals
1046 __ safepoint_poll(slow_path);
1047
1048 // We don't generate local frame and don't align stack because
1049 // we call stub code and there is no safepoint on this path.
1050
1051 // Load parameters
1052 const Register crc = c_rarg0; // crc
1053 const Register buf = c_rarg1; // source java byte array address
1054 const Register len = c_rarg2; // length
1055 const Register off = len; // offset (never overlaps with 'len')
1056
1057 // Arguments are reversed on java expression stack
1058 // Calculate address of start element
1059 if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) {
1060 __ ldr(buf, Address(esp, 2*wordSize)); // long buf
1061 __ ldrw(off, Address(esp, wordSize)); // offset
1062 __ add(buf, buf, off); // + offset
1063 __ ldrw(crc, Address(esp, 4*wordSize)); // Initial CRC
1064 } else {
1065 __ ldr(buf, Address(esp, 2*wordSize)); // byte[] array
1066 __ resolve(IS_NOT_NULL | ACCESS_READ, buf);
1067 __ add(buf, buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
1068 __ ldrw(off, Address(esp, wordSize)); // offset
1069 __ add(buf, buf, off); // + offset
1070 __ ldrw(crc, Address(esp, 3*wordSize)); // Initial CRC
1071 }
1072 // Can now load 'len' since we're finished with 'off'
1073 __ ldrw(len, Address(esp, 0x0)); // Length
1074
1075 __ andr(sp, r13, -16); // Restore the caller's SP
1076
1077 // We are frameless so we can just jump to the stub.
1078 __ b(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()));
1079
1080 // generate a vanilla native entry as the slow path
1081 __ bind(slow_path);
1082 __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native));
1083 return entry;
1084 }
1085 return NULL;
1086 }
1091 * int java.util.zip.CRC32C.updateDirectByteBuffer(int crc, long buf, int off, int end)
1092 * Unlike CRC32, CRC32C does not have any methods marked as native
1093 * CRC32C also uses an "end" variable instead of the length variable CRC32 uses
1094 */
1095 address TemplateInterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) {
1096 if (UseCRC32CIntrinsics) {
1097 address entry = __ pc();
1098
1099 // Prepare jump to stub using parameters from the stack
1100 const Register crc = c_rarg0; // initial crc
1101 const Register buf = c_rarg1; // source java byte array address
1102 const Register len = c_rarg2; // len argument to the kernel
1103
1104 const Register end = len; // index of last element to process
1105 const Register off = crc; // offset
1106
1107 __ ldrw(end, Address(esp)); // int end
1108 __ ldrw(off, Address(esp, wordSize)); // int offset
1109 __ sub(len, end, off);
1110 __ ldr(buf, Address(esp, 2*wordSize)); // byte[] buf | long buf
1111 if (kind == Interpreter::java_util_zip_CRC32C_updateBytes) {
1112 __ resolve(IS_NOT_NULL | ACCESS_READ, buf);
1113 }
1114 __ add(buf, buf, off); // + offset
1115 if (kind == Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer) {
1116 __ ldrw(crc, Address(esp, 4*wordSize)); // long crc
1117 } else {
1118 __ add(buf, buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
1119 __ ldrw(crc, Address(esp, 3*wordSize)); // long crc
1120 }
1121
1122 __ andr(sp, r13, -16); // Restore the caller's SP
1123
1124 // Jump to the stub.
1125 __ b(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32C()));
1126
1127 return entry;
1128 }
1129 return NULL;
1130 }
1131
1132 void TemplateInterpreterGenerator::bang_stack_shadow_pages(bool native_call) {
1133 // Bang each page in the shadow zone. We can't assume it's been done for
|