@@ -705,7 +705,7 @@ void MacroAssembler::call_VM_helper(Register oop_result, address entry_point, in
705
705
// Maybe emit a call via a trampoline. If the code cache is small
706
706
// trampolines won't be emitted.
707
707
708
- address MacroAssembler::trampoline_call (Address entry, CodeBuffer * cbuf) {
708
+ address MacroAssembler::trampoline_call (Address entry, CodeBuffer* cbuf) {
709
709
assert (JavaThread::current ()->is_Compiler_thread (), " just checking" );
710
710
assert (entry.rspec ().type () == relocInfo::runtime_call_type
711
711
|| entry.rspec ().type () == relocInfo::opt_virtual_call_type
@@ -726,6 +726,7 @@ address MacroAssembler::trampoline_call(Address entry, CodeBuffer *cbuf) {
726
726
if (!in_scratch_emit_size) {
727
727
address stub = emit_trampoline_stub (offset (), entry.target ());
728
728
if (stub == NULL ) {
729
+ postcond (pc () == badAddress);
729
730
return NULL ; // CodeCache is full
730
731
}
731
732
}
@@ -739,6 +740,7 @@ address MacroAssembler::trampoline_call(Address entry, CodeBuffer *cbuf) {
739
740
bl (pc ());
740
741
}
741
742
// just need to return a non-null address
743
+ postcond (pc () != badAddress);
742
744
return pc ();
743
745
}
744
746
@@ -4490,7 +4492,7 @@ void MacroAssembler::remove_frame(int framesize) {
4490
4492
4491
4493
4492
4494
// This method checks if provided byte array contains byte with highest bit set.
4493
- void MacroAssembler::has_negatives (Register ary1, Register len, Register result) {
4495
+ address MacroAssembler::has_negatives (Register ary1, Register len, Register result) {
4494
4496
// Simple and most common case of aligned small array which is not at the
4495
4497
// end of memory page is placed here. All other cases are in stub.
4496
4498
Label LOOP, END, STUB, STUB_LONG, SET_RESULT, DONE;
@@ -4527,27 +4529,38 @@ void MacroAssembler::has_negatives(Register ary1, Register len, Register result)
4527
4529
b (SET_RESULT);
4528
4530
4529
4531
BIND (STUB);
4530
- RuntimeAddress has_neg = RuntimeAddress (StubRoutines::aarch64::has_negatives ());
4532
+ RuntimeAddress has_neg = RuntimeAddress (StubRoutines::aarch64::has_negatives ());
4531
4533
assert (has_neg.target () != NULL , " has_negatives stub has not been generated" );
4532
- trampoline_call (has_neg);
4534
+ address tpc1 = trampoline_call (has_neg);
4535
+ if (tpc1 == NULL ) {
4536
+ DEBUG_ONLY (reset_labels (STUB_LONG, SET_RESULT, DONE));
4537
+ postcond (pc () == badAddress);
4538
+ return NULL ;
4539
+ }
4533
4540
b (DONE);
4534
4541
4535
4542
BIND (STUB_LONG);
4536
- RuntimeAddress has_neg_long = RuntimeAddress (
4537
- StubRoutines::aarch64::has_negatives_long ());
4543
+ RuntimeAddress has_neg_long = RuntimeAddress (StubRoutines::aarch64::has_negatives_long ());
4538
4544
assert (has_neg_long.target () != NULL , " has_negatives stub has not been generated" );
4539
- trampoline_call (has_neg_long);
4545
+ address tpc2 = trampoline_call (has_neg_long);
4546
+ if (tpc2 == NULL ) {
4547
+ DEBUG_ONLY (reset_labels (SET_RESULT, DONE));
4548
+ postcond (pc () == badAddress);
4549
+ return NULL ;
4550
+ }
4540
4551
b (DONE);
4541
4552
4542
4553
BIND (SET_RESULT);
4543
4554
cset (result, NE); // set true or false
4544
4555
4545
4556
BIND (DONE);
4557
+ postcond (pc () != badAddress);
4558
+ return pc ();
4546
4559
}
4547
4560
4548
- void MacroAssembler::arrays_equals (Register a1, Register a2, Register tmp3,
4549
- Register tmp4, Register tmp5, Register result,
4550
- Register cnt1, int elem_size) {
4561
+ address MacroAssembler::arrays_equals (Register a1, Register a2, Register tmp3,
4562
+ Register tmp4, Register tmp5, Register result,
4563
+ Register cnt1, int elem_size) {
4551
4564
Label DONE, SAME;
4552
4565
Register tmp1 = rscratch1;
4553
4566
Register tmp2 = rscratch2;
@@ -4651,7 +4664,7 @@ void MacroAssembler::arrays_equals(Register a1, Register a2, Register tmp3,
4651
4664
}
4652
4665
}
4653
4666
} else {
4654
- Label NEXT_DWORD, SHORT, TAIL, TAIL2, STUB, EARLY_OUT,
4667
+ Label NEXT_DWORD, SHORT, TAIL, TAIL2, STUB,
4655
4668
CSET_EQ, LAST_CHECK;
4656
4669
mov (result, false );
4657
4670
cbz (a1, DONE);
@@ -4710,10 +4723,14 @@ void MacroAssembler::arrays_equals(Register a1, Register a2, Register tmp3,
4710
4723
cbnz (tmp5, DONE);
4711
4724
RuntimeAddress stub = RuntimeAddress (StubRoutines::aarch64::large_array_equals ());
4712
4725
assert (stub.target () != NULL , " array_equals_long stub has not been generated" );
4713
- trampoline_call (stub);
4726
+ address tpc = trampoline_call (stub);
4727
+ if (tpc == NULL ) {
4728
+ DEBUG_ONLY (reset_labels (SHORT, LAST_CHECK, CSET_EQ, SAME, DONE));
4729
+ postcond (pc () == badAddress);
4730
+ return NULL ;
4731
+ }
4714
4732
b (DONE);
4715
4733
4716
- bind (EARLY_OUT);
4717
4734
// (a1 != null && a2 == null) || (a1 != null && a2 != null && a1 == a2)
4718
4735
// so, if a2 == null => return false(0), else return true, so we can return a2
4719
4736
mov (result, a2);
@@ -4740,6 +4757,8 @@ void MacroAssembler::arrays_equals(Register a1, Register a2, Register tmp3,
4740
4757
bind (DONE);
4741
4758
4742
4759
BLOCK_COMMENT (" } array_equals" );
4760
+ postcond (pc () != badAddress);
4761
+ return pc ();
4743
4762
}
4744
4763
4745
4764
// Compare Strings
@@ -4847,7 +4866,7 @@ const int MacroAssembler::zero_words_block_size = 8;
4847
4866
// cnt: Count in HeapWords.
4848
4867
//
4849
4868
// ptr, cnt, rscratch1, and rscratch2 are clobbered.
4850
- void MacroAssembler::zero_words (Register ptr, Register cnt)
4869
+ address MacroAssembler::zero_words (Register ptr, Register cnt)
4851
4870
{
4852
4871
assert (is_power_of_2 (zero_words_block_size), " adjust this" );
4853
4872
assert (ptr == r10 && cnt == r11, " mismatch in register usage" );
@@ -4857,10 +4876,15 @@ void MacroAssembler::zero_words(Register ptr, Register cnt)
4857
4876
Label around;
4858
4877
br (LO, around);
4859
4878
{
4860
- RuntimeAddress zero_blocks = RuntimeAddress (StubRoutines::aarch64::zero_blocks ());
4879
+ RuntimeAddress zero_blocks = RuntimeAddress (StubRoutines::aarch64::zero_blocks ());
4861
4880
assert (zero_blocks.target () != NULL , " zero_blocks stub has not been generated" );
4862
4881
if (StubRoutines::aarch64::complete ()) {
4863
- trampoline_call (zero_blocks);
4882
+ address tpc = trampoline_call (zero_blocks);
4883
+ if (tpc == NULL ) {
4884
+ DEBUG_ONLY (reset_labels (around));
4885
+ postcond (pc () == badAddress);
4886
+ return NULL ;
4887
+ }
4864
4888
} else {
4865
4889
bl (zero_blocks);
4866
4890
}
@@ -4881,6 +4905,8 @@ void MacroAssembler::zero_words(Register ptr, Register cnt)
4881
4905
bind (l);
4882
4906
}
4883
4907
BLOCK_COMMENT (" } zero_words" );
4908
+ postcond (pc () != badAddress);
4909
+ return pc ();
4884
4910
}
4885
4911
4886
4912
// base: Address of a buffer to be zeroed, 8 bytes aligned.
@@ -4893,14 +4919,15 @@ void MacroAssembler::zero_words(Register base, uint64_t cnt)
4893
4919
if (i) str (zr, Address (base));
4894
4920
4895
4921
if (cnt <= SmallArraySize / BytesPerLong) {
4896
- for (; i < (int )cnt; i += 2 )
4922
+ for (; i < (int )cnt; i += 2 ) {
4897
4923
stp (zr, zr, Address (base, i * wordSize));
4924
+ }
4898
4925
} else {
4899
4926
const int unroll = 4 ; // Number of stp(zr, zr) instructions we'll unroll
4900
4927
int remainder = cnt % (2 * unroll);
4901
- for (; i < remainder; i += 2 )
4928
+ for (; i < remainder; i += 2 ) {
4902
4929
stp (zr, zr, Address (base, i * wordSize));
4903
-
4930
+ }
4904
4931
Label loop;
4905
4932
Register cnt_reg = rscratch1;
4906
4933
Register loop_base = rscratch2;
@@ -4910,8 +4937,9 @@ void MacroAssembler::zero_words(Register base, uint64_t cnt)
4910
4937
add (loop_base, base, (remainder - 2 ) * wordSize);
4911
4938
bind (loop);
4912
4939
sub (cnt_reg, cnt_reg, 2 * unroll);
4913
- for (i = 1 ; i < unroll; i++)
4940
+ for (i = 1 ; i < unroll; i++) {
4914
4941
stp (zr, zr, Address (loop_base, 2 * i * wordSize));
4942
+ }
4915
4943
stp (zr, zr, Address (pre (loop_base, 2 * unroll * wordSize)));
4916
4944
cbnz (cnt_reg, loop);
4917
4945
}
@@ -5127,9 +5155,9 @@ void MacroAssembler::encode_iso_array(Register src, Register dst,
5127
5155
5128
5156
5129
5157
// Inflate byte[] array to char[].
5130
- void MacroAssembler::byte_array_inflate (Register src, Register dst, Register len,
5131
- FloatRegister vtmp1, FloatRegister vtmp2 , FloatRegister vtmp3 ,
5132
- Register tmp4) {
5158
+ address MacroAssembler::byte_array_inflate (Register src, Register dst, Register len,
5159
+ FloatRegister vtmp1 , FloatRegister vtmp2 ,
5160
+ FloatRegister vtmp3, Register tmp4) {
5133
5161
Label big, done, after_init, to_stub;
5134
5162
5135
5163
assert_different_registers (src, dst, len, tmp4, rscratch1);
@@ -5166,9 +5194,14 @@ void MacroAssembler::byte_array_inflate(Register src, Register dst, Register len
5166
5194
5167
5195
if (SoftwarePrefetchHintDistance >= 0 ) {
5168
5196
bind (to_stub);
5169
- RuntimeAddress stub = RuntimeAddress (StubRoutines::aarch64::large_byte_array_inflate ());
5197
+ RuntimeAddress stub = RuntimeAddress (StubRoutines::aarch64::large_byte_array_inflate ());
5170
5198
assert (stub.target () != NULL , " large_byte_array_inflate stub has not been generated" );
5171
- trampoline_call (stub);
5199
+ address tpc = trampoline_call (stub);
5200
+ if (tpc == NULL ) {
5201
+ DEBUG_ONLY (reset_labels (big, done));
5202
+ postcond (pc () == badAddress);
5203
+ return NULL ;
5204
+ }
5172
5205
b (after_init);
5173
5206
}
5174
5207
@@ -5222,6 +5255,8 @@ void MacroAssembler::byte_array_inflate(Register src, Register dst, Register len
5222
5255
strq (vtmp3, Address (dst, -16 ));
5223
5256
5224
5257
bind (done);
5258
+ postcond (pc () != badAddress);
5259
+ return pc ();
5225
5260
}
5226
5261
5227
5262
// Compress char[] array to byte[].
0 commit comments