Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp
40930 views
1
/*
2
* Copyright (c) 2008, 2021, 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
*
23
*/
24
25
#include "precompiled.hpp"
26
#include "asm/macroAssembler.inline.hpp"
27
#include "c1/c1_Defs.hpp"
28
#include "c1/c1_LIRAssembler.hpp"
29
#include "c1/c1_MacroAssembler.hpp"
30
#include "c1/c1_Runtime1.hpp"
31
#include "ci/ciUtilities.hpp"
32
#include "compiler/oopMap.hpp"
33
#include "gc/shared/cardTable.hpp"
34
#include "gc/shared/cardTableBarrierSet.hpp"
35
#include "gc/shared/collectedHeap.hpp"
36
#include "gc/shared/tlab_globals.hpp"
37
#include "interpreter/interpreter.hpp"
38
#include "memory/universe.hpp"
39
#include "nativeInst_arm.hpp"
40
#include "oops/compiledICHolder.hpp"
41
#include "oops/oop.inline.hpp"
42
#include "prims/jvmtiExport.hpp"
43
#include "register_arm.hpp"
44
#include "runtime/sharedRuntime.hpp"
45
#include "runtime/signature.hpp"
46
#include "runtime/vframeArray.hpp"
47
#include "utilities/align.hpp"
48
#include "vmreg_arm.inline.hpp"
49
50
// Note: Rtemp usage is this file should not impact C2 and should be
51
// correct as long as it is not implicitly used in lower layers (the
52
// arm [macro]assembler) and used with care in the other C1 specific
53
// files.
54
55
// Implementation of StubAssembler
56
57
int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, int args_size) {
58
mov(R0, Rthread);
59
60
int call_offset = set_last_Java_frame(SP, FP, false, Rtemp);
61
62
call(entry);
63
if (call_offset == -1) { // PC not saved
64
call_offset = offset();
65
}
66
reset_last_Java_frame(Rtemp);
67
68
assert(frame_size() != no_frame_size, "frame must be fixed");
69
if (_stub_id != Runtime1::forward_exception_id) {
70
ldr(R3, Address(Rthread, Thread::pending_exception_offset()));
71
}
72
73
if (oop_result1->is_valid()) {
74
assert_different_registers(oop_result1, R3, Rtemp);
75
get_vm_result(oop_result1, Rtemp);
76
}
77
if (metadata_result->is_valid()) {
78
assert_different_registers(metadata_result, R3, Rtemp);
79
get_vm_result_2(metadata_result, Rtemp);
80
}
81
82
// Check for pending exception
83
// unpack_with_exception_in_tls path is taken through
84
// Runtime1::exception_handler_for_pc
85
if (_stub_id != Runtime1::forward_exception_id) {
86
assert(frame_size() != no_frame_size, "cannot directly call forward_exception_id");
87
cmp(R3, 0);
88
jump(Runtime1::entry_for(Runtime1::forward_exception_id), relocInfo::runtime_call_type, Rtemp, ne);
89
} else {
90
#ifdef ASSERT
91
// Should not have pending exception in forward_exception stub
92
ldr(R3, Address(Rthread, Thread::pending_exception_offset()));
93
cmp(R3, 0);
94
breakpoint(ne);
95
#endif // ASSERT
96
}
97
return call_offset;
98
}
99
100
101
int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1) {
102
if (arg1 != R1) {
103
mov(R1, arg1);
104
}
105
return call_RT(oop_result1, metadata_result, entry, 1);
106
}
107
108
109
int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2) {
110
assert(arg1 == R1 && arg2 == R2, "cannot handle otherwise");
111
return call_RT(oop_result1, metadata_result, entry, 2);
112
}
113
114
115
int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2, Register arg3) {
116
assert(arg1 == R1 && arg2 == R2 && arg3 == R3, "cannot handle otherwise");
117
return call_RT(oop_result1, metadata_result, entry, 3);
118
}
119
120
121
#define __ sasm->
122
123
// TODO: ARM - does this duplicate RegisterSaver in SharedRuntime?
124
125
enum RegisterLayout {
126
fpu_save_size = pd_nof_fpu_regs_reg_alloc,
127
#ifndef __SOFTFP__
128
D0_offset = 0,
129
#endif
130
R0_offset = fpu_save_size,
131
R1_offset,
132
R2_offset,
133
R3_offset,
134
R4_offset,
135
R5_offset,
136
R6_offset,
137
#if (FP_REG_NUM != 7)
138
R7_offset,
139
#endif
140
R8_offset,
141
R9_offset,
142
R10_offset,
143
#if (FP_REG_NUM != 11)
144
R11_offset,
145
#endif
146
R12_offset,
147
FP_offset,
148
LR_offset,
149
reg_save_size,
150
arg1_offset = reg_save_size * wordSize,
151
arg2_offset = (reg_save_size + 1) * wordSize
152
};
153
154
155
static OopMap* generate_oop_map(StubAssembler* sasm, bool save_fpu_registers = HaveVFP) {
156
sasm->set_frame_size(reg_save_size /* in words */);
157
158
// Record saved value locations in an OopMap.
159
// Locations are offsets from sp after runtime call.
160
OopMap* map = new OopMap(VMRegImpl::slots_per_word * reg_save_size, 0);
161
162
int j=0;
163
for (int i = R0_offset; i < R10_offset; i++) {
164
if (j == FP_REG_NUM) {
165
// skip the FP register, saved below
166
j++;
167
}
168
map->set_callee_saved(VMRegImpl::stack2reg(i), as_Register(j)->as_VMReg());
169
j++;
170
}
171
assert(j == R10->encoding(), "must be");
172
#if (FP_REG_NUM != 11)
173
// add R11, if not saved as FP
174
map->set_callee_saved(VMRegImpl::stack2reg(R11_offset), R11->as_VMReg());
175
#endif
176
map->set_callee_saved(VMRegImpl::stack2reg(FP_offset), FP->as_VMReg());
177
map->set_callee_saved(VMRegImpl::stack2reg(LR_offset), LR->as_VMReg());
178
179
if (save_fpu_registers) {
180
for (int i = 0; i < fpu_save_size; i++) {
181
map->set_callee_saved(VMRegImpl::stack2reg(i), as_FloatRegister(i)->as_VMReg());
182
}
183
}
184
185
return map;
186
}
187
188
static OopMap* save_live_registers(StubAssembler* sasm, bool save_fpu_registers = HaveVFP) {
189
__ block_comment("save_live_registers");
190
sasm->set_frame_size(reg_save_size /* in words */);
191
192
__ push(RegisterSet(FP) | RegisterSet(LR));
193
__ push(RegisterSet(R0, R6) | RegisterSet(R8, R10) | R12 | altFP_7_11);
194
if (save_fpu_registers) {
195
__ fpush(FloatRegisterSet(D0, fpu_save_size / 2));
196
} else {
197
__ sub(SP, SP, fpu_save_size * wordSize);
198
}
199
200
return generate_oop_map(sasm, save_fpu_registers);
201
}
202
203
204
static void restore_live_registers(StubAssembler* sasm,
205
bool restore_R0,
206
bool restore_FP_LR,
207
bool do_return,
208
bool restore_fpu_registers = HaveVFP) {
209
__ block_comment("restore_live_registers");
210
211
if (restore_fpu_registers) {
212
__ fpop(FloatRegisterSet(D0, fpu_save_size / 2));
213
if (!restore_R0) {
214
__ add(SP, SP, (R1_offset - fpu_save_size) * wordSize);
215
}
216
} else {
217
__ add(SP, SP, (restore_R0 ? fpu_save_size : R1_offset) * wordSize);
218
}
219
__ pop(RegisterSet((restore_R0 ? R0 : R1), R6) | RegisterSet(R8, R10) | R12 | altFP_7_11);
220
if (restore_FP_LR) {
221
__ pop(RegisterSet(FP) | RegisterSet(do_return ? PC : LR));
222
} else {
223
assert (!do_return, "return without restoring FP/LR");
224
}
225
}
226
227
228
static void restore_live_registers_except_R0(StubAssembler* sasm, bool restore_fpu_registers = HaveVFP) {
229
restore_live_registers(sasm, false, true, true, restore_fpu_registers);
230
}
231
232
static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = HaveVFP) {
233
restore_live_registers(sasm, true, true, true, restore_fpu_registers);
234
}
235
236
static void restore_live_registers_except_FP_LR(StubAssembler* sasm, bool restore_fpu_registers = HaveVFP) {
237
restore_live_registers(sasm, true, false, false, restore_fpu_registers);
238
}
239
240
static void restore_live_registers_without_return(StubAssembler* sasm, bool restore_fpu_registers = HaveVFP) {
241
restore_live_registers(sasm, true, true, false, restore_fpu_registers);
242
}
243
244
void StubAssembler::save_live_registers() {
245
::save_live_registers(this);
246
}
247
248
void StubAssembler::restore_live_registers_without_return() {
249
::restore_live_registers_without_return(this);
250
}
251
252
void Runtime1::initialize_pd() {
253
}
254
255
256
OopMapSet* Runtime1::generate_exception_throw(StubAssembler* sasm, address target, bool has_argument) {
257
OopMap* oop_map = save_live_registers(sasm);
258
259
int call_offset;
260
if (has_argument) {
261
__ ldr(R1, Address(SP, arg1_offset));
262
__ ldr(R2, Address(SP, arg2_offset));
263
call_offset = __ call_RT(noreg, noreg, target, R1, R2);
264
} else {
265
call_offset = __ call_RT(noreg, noreg, target);
266
}
267
268
OopMapSet* oop_maps = new OopMapSet();
269
oop_maps->add_gc_map(call_offset, oop_map);
270
271
DEBUG_ONLY(STOP("generate_exception_throw");) // Should not reach here
272
return oop_maps;
273
}
274
275
276
static void restore_sp_for_method_handle(StubAssembler* sasm) {
277
// Restore SP from its saved reg (FP) if the exception PC is a MethodHandle call site.
278
__ ldr_s32(Rtemp, Address(Rthread, JavaThread::is_method_handle_return_offset()));
279
__ cmp(Rtemp, 0);
280
__ mov(SP, Rmh_SP_save, ne);
281
}
282
283
284
OopMapSet* Runtime1::generate_handle_exception(StubID id, StubAssembler* sasm) {
285
__ block_comment("generate_handle_exception");
286
287
bool save_fpu_registers = false;
288
289
// Save registers, if required.
290
OopMapSet* oop_maps = new OopMapSet();
291
OopMap* oop_map = NULL;
292
293
switch (id) {
294
case forward_exception_id: {
295
save_fpu_registers = HaveVFP;
296
oop_map = generate_oop_map(sasm);
297
__ ldr(Rexception_obj, Address(Rthread, Thread::pending_exception_offset()));
298
__ ldr(Rexception_pc, Address(SP, LR_offset * wordSize));
299
Register zero = __ zero_register(Rtemp);
300
__ str(zero, Address(Rthread, Thread::pending_exception_offset()));
301
break;
302
}
303
case handle_exception_id:
304
save_fpu_registers = HaveVFP;
305
// fall-through
306
case handle_exception_nofpu_id:
307
// At this point all registers MAY be live.
308
oop_map = save_live_registers(sasm, save_fpu_registers);
309
break;
310
case handle_exception_from_callee_id:
311
// At this point all registers except exception oop (R4/R19) and
312
// exception pc (R5/R20) are dead.
313
oop_map = save_live_registers(sasm); // TODO it's not required to save all registers
314
break;
315
default: ShouldNotReachHere();
316
}
317
318
__ str(Rexception_obj, Address(Rthread, JavaThread::exception_oop_offset()));
319
__ str(Rexception_pc, Address(Rthread, JavaThread::exception_pc_offset()));
320
321
__ str(Rexception_pc, Address(SP, LR_offset * wordSize)); // patch throwing pc into return address
322
323
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, exception_handler_for_pc));
324
oop_maps->add_gc_map(call_offset, oop_map);
325
326
// Exception handler found
327
__ str(R0, Address(SP, LR_offset * wordSize)); // patch the return address
328
329
// Restore the registers that were saved at the beginning, remove
330
// frame and jump to the exception handler.
331
switch (id) {
332
case forward_exception_id:
333
case handle_exception_nofpu_id:
334
case handle_exception_id:
335
restore_live_registers(sasm, save_fpu_registers);
336
// Note: the restore live registers includes the jump to LR (patched to R0)
337
break;
338
case handle_exception_from_callee_id:
339
restore_live_registers_without_return(sasm); // must not jump immediatly to handler
340
restore_sp_for_method_handle(sasm);
341
__ ret();
342
break;
343
default: ShouldNotReachHere();
344
}
345
346
DEBUG_ONLY(STOP("generate_handle_exception");) // Should not reach here
347
348
return oop_maps;
349
}
350
351
352
void Runtime1::generate_unwind_exception(StubAssembler* sasm) {
353
// FP no longer used to find the frame start
354
// on entry, remove_frame() has already been called (restoring FP and LR)
355
356
// search the exception handler address of the caller (using the return address)
357
__ mov(c_rarg0, Rthread);
358
__ mov(Rexception_pc, LR);
359
__ mov(c_rarg1, LR);
360
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), c_rarg0, c_rarg1);
361
362
// Exception oop should be still in Rexception_obj and pc in Rexception_pc
363
// Jump to handler
364
__ verify_not_null_oop(Rexception_obj);
365
366
// JSR292 extension
367
restore_sp_for_method_handle(sasm);
368
369
__ jump(R0);
370
}
371
372
373
OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) {
374
OopMap* oop_map = save_live_registers(sasm);
375
376
// call the runtime patching routine, returns non-zero if nmethod got deopted.
377
int call_offset = __ call_RT(noreg, noreg, target);
378
OopMapSet* oop_maps = new OopMapSet();
379
oop_maps->add_gc_map(call_offset, oop_map);
380
381
DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();
382
assert(deopt_blob != NULL, "deoptimization blob must have been created");
383
384
__ cmp_32(R0, 0);
385
386
restore_live_registers_except_FP_LR(sasm);
387
__ pop(RegisterSet(FP) | RegisterSet(PC), eq);
388
389
// Deoptimization needed
390
// TODO: ARM - no need to restore FP & LR because unpack_with_reexecution() stores them back
391
__ pop(RegisterSet(FP) | RegisterSet(LR));
392
393
__ jump(deopt_blob->unpack_with_reexecution(), relocInfo::runtime_call_type, Rtemp);
394
395
DEBUG_ONLY(STOP("generate_patching");) // Should not reach here
396
return oop_maps;
397
}
398
399
400
OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
401
const bool must_gc_arguments = true;
402
const bool dont_gc_arguments = false;
403
404
OopMapSet* oop_maps = NULL;
405
bool save_fpu_registers = HaveVFP;
406
407
switch (id) {
408
case forward_exception_id:
409
{
410
oop_maps = generate_handle_exception(id, sasm);
411
// does not return on ARM
412
}
413
break;
414
415
case new_instance_id:
416
case fast_new_instance_id:
417
case fast_new_instance_init_check_id:
418
{
419
const Register result = R0;
420
const Register klass = R1;
421
422
// If TLAB is disabled, see if there is support for inlining contiguous
423
// allocations.
424
// Otherwise, just go to the slow path.
425
if (!UseTLAB && Universe::heap()->supports_inline_contig_alloc() && id != new_instance_id) {
426
Label slow_case, slow_case_no_pop;
427
428
// Make sure the class is fully initialized
429
if (id == fast_new_instance_init_check_id) {
430
__ ldrb(result, Address(klass, InstanceKlass::init_state_offset()));
431
__ cmp(result, InstanceKlass::fully_initialized);
432
__ b(slow_case_no_pop, ne);
433
}
434
435
// Free some temporary registers
436
const Register obj_size = R4;
437
const Register tmp1 = R5;
438
const Register tmp2 = LR;
439
const Register obj_end = Rtemp;
440
441
__ raw_push(R4, R5, LR);
442
443
__ ldr_u32(obj_size, Address(klass, Klass::layout_helper_offset()));
444
__ eden_allocate(result, obj_end, tmp1, tmp2, obj_size, slow_case); // initializes result and obj_end
445
__ initialize_object(result, obj_end, klass, noreg /* len */, tmp1, tmp2,
446
instanceOopDesc::header_size() * HeapWordSize, -1,
447
/* is_tlab_allocated */ false);
448
__ raw_pop_and_ret(R4, R5);
449
450
__ bind(slow_case);
451
__ raw_pop(R4, R5, LR);
452
453
__ bind(slow_case_no_pop);
454
}
455
456
OopMap* map = save_live_registers(sasm);
457
int call_offset = __ call_RT(result, noreg, CAST_FROM_FN_PTR(address, new_instance), klass);
458
oop_maps = new OopMapSet();
459
oop_maps->add_gc_map(call_offset, map);
460
461
// MacroAssembler::StoreStore useless (included in the runtime exit path)
462
463
restore_live_registers_except_R0(sasm);
464
}
465
break;
466
467
case counter_overflow_id:
468
{
469
OopMap* oop_map = save_live_registers(sasm);
470
__ ldr(R1, Address(SP, arg1_offset));
471
__ ldr(R2, Address(SP, arg2_offset));
472
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, counter_overflow), R1, R2);
473
oop_maps = new OopMapSet();
474
oop_maps->add_gc_map(call_offset, oop_map);
475
restore_live_registers(sasm);
476
}
477
break;
478
479
case new_type_array_id:
480
case new_object_array_id:
481
{
482
if (id == new_type_array_id) {
483
__ set_info("new_type_array", dont_gc_arguments);
484
} else {
485
__ set_info("new_object_array", dont_gc_arguments);
486
}
487
488
const Register result = R0;
489
const Register klass = R1;
490
const Register length = R2;
491
492
// If TLAB is disabled, see if there is support for inlining contiguous
493
// allocations.
494
// Otherwise, just go to the slow path.
495
if (!UseTLAB && Universe::heap()->supports_inline_contig_alloc()) {
496
Label slow_case, slow_case_no_pop;
497
498
__ cmp_32(length, C1_MacroAssembler::max_array_allocation_length);
499
__ b(slow_case_no_pop, hs);
500
501
// Free some temporary registers
502
const Register arr_size = R4;
503
const Register tmp1 = R5;
504
const Register tmp2 = LR;
505
const Register tmp3 = Rtemp;
506
const Register obj_end = tmp3;
507
508
__ raw_push(R4, R5, LR);
509
510
// Get the allocation size: round_up((length << (layout_helper & 0xff)) + header_size)
511
__ ldr_u32(tmp1, Address(klass, Klass::layout_helper_offset()));
512
__ mov(arr_size, MinObjAlignmentInBytesMask);
513
__ and_32(tmp2, tmp1, (unsigned int)(Klass::_lh_header_size_mask << Klass::_lh_header_size_shift));
514
515
__ add(arr_size, arr_size, AsmOperand(length, lsl, tmp1));
516
517
__ add(arr_size, arr_size, AsmOperand(tmp2, lsr, Klass::_lh_header_size_shift));
518
__ align_reg(arr_size, arr_size, MinObjAlignmentInBytes);
519
520
// eden_allocate destroys tmp2, so reload header_size after allocation
521
// eden_allocate initializes result and obj_end
522
__ eden_allocate(result, obj_end, tmp1, tmp2, arr_size, slow_case);
523
__ ldrb(tmp2, Address(klass, in_bytes(Klass::layout_helper_offset()) +
524
Klass::_lh_header_size_shift / BitsPerByte));
525
__ initialize_object(result, obj_end, klass, length, tmp1, tmp2, tmp2, -1, /* is_tlab_allocated */ false);
526
__ raw_pop_and_ret(R4, R5);
527
528
__ bind(slow_case);
529
__ raw_pop(R4, R5, LR);
530
__ bind(slow_case_no_pop);
531
}
532
533
OopMap* map = save_live_registers(sasm);
534
int call_offset;
535
if (id == new_type_array_id) {
536
call_offset = __ call_RT(result, noreg, CAST_FROM_FN_PTR(address, new_type_array), klass, length);
537
} else {
538
call_offset = __ call_RT(result, noreg, CAST_FROM_FN_PTR(address, new_object_array), klass, length);
539
}
540
oop_maps = new OopMapSet();
541
oop_maps->add_gc_map(call_offset, map);
542
543
// MacroAssembler::StoreStore useless (included in the runtime exit path)
544
545
restore_live_registers_except_R0(sasm);
546
}
547
break;
548
549
case new_multi_array_id:
550
{
551
__ set_info("new_multi_array", dont_gc_arguments);
552
553
// R0: klass
554
// R2: rank
555
// SP: address of 1st dimension
556
const Register result = R0;
557
OopMap* map = save_live_registers(sasm);
558
559
__ mov(R1, R0);
560
__ add(R3, SP, arg1_offset);
561
int call_offset = __ call_RT(result, noreg, CAST_FROM_FN_PTR(address, new_multi_array), R1, R2, R3);
562
563
oop_maps = new OopMapSet();
564
oop_maps->add_gc_map(call_offset, map);
565
566
// MacroAssembler::StoreStore useless (included in the runtime exit path)
567
568
restore_live_registers_except_R0(sasm);
569
}
570
break;
571
572
case register_finalizer_id:
573
{
574
__ set_info("register_finalizer", dont_gc_arguments);
575
576
// Do not call runtime if JVM_ACC_HAS_FINALIZER flag is not set
577
__ load_klass(Rtemp, R0);
578
__ ldr_u32(Rtemp, Address(Rtemp, Klass::access_flags_offset()));
579
580
__ tst(Rtemp, JVM_ACC_HAS_FINALIZER);
581
__ bx(LR, eq);
582
583
// Call VM
584
OopMap* map = save_live_registers(sasm);
585
oop_maps = new OopMapSet();
586
int call_offset = __ call_RT(noreg, noreg,
587
CAST_FROM_FN_PTR(address, SharedRuntime::register_finalizer), R0);
588
oop_maps->add_gc_map(call_offset, map);
589
restore_live_registers(sasm);
590
}
591
break;
592
593
case throw_range_check_failed_id:
594
{
595
__ set_info("range_check_failed", dont_gc_arguments);
596
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_range_check_exception), true);
597
}
598
break;
599
600
case throw_index_exception_id:
601
{
602
__ set_info("index_range_check_failed", dont_gc_arguments);
603
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_index_exception), true);
604
}
605
break;
606
607
case throw_div0_exception_id:
608
{
609
__ set_info("throw_div0_exception", dont_gc_arguments);
610
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_div0_exception), false);
611
}
612
break;
613
614
case throw_null_pointer_exception_id:
615
{
616
__ set_info("throw_null_pointer_exception", dont_gc_arguments);
617
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_null_pointer_exception), false);
618
}
619
break;
620
621
case handle_exception_nofpu_id:
622
case handle_exception_id:
623
{
624
__ set_info("handle_exception", dont_gc_arguments);
625
oop_maps = generate_handle_exception(id, sasm);
626
}
627
break;
628
629
case handle_exception_from_callee_id:
630
{
631
__ set_info("handle_exception_from_callee", dont_gc_arguments);
632
oop_maps = generate_handle_exception(id, sasm);
633
}
634
break;
635
636
case unwind_exception_id:
637
{
638
__ set_info("unwind_exception", dont_gc_arguments);
639
generate_unwind_exception(sasm);
640
}
641
break;
642
643
case throw_array_store_exception_id:
644
{
645
__ set_info("throw_array_store_exception", dont_gc_arguments);
646
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true);
647
}
648
break;
649
650
case throw_class_cast_exception_id:
651
{
652
__ set_info("throw_class_cast_exception", dont_gc_arguments);
653
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_class_cast_exception), true);
654
}
655
break;
656
657
case throw_incompatible_class_change_error_id:
658
{
659
__ set_info("throw_incompatible_class_cast_exception", dont_gc_arguments);
660
oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_incompatible_class_change_error), false);
661
}
662
break;
663
664
case slow_subtype_check_id:
665
{
666
// (in) R0 - sub, destroyed,
667
// (in) R1 - super, not changed
668
// (out) R0 - result: 1 if check passed, 0 otherwise
669
__ raw_push(R2, R3, LR);
670
671
// Load an array of secondary_supers
672
__ ldr(R2, Address(R0, Klass::secondary_supers_offset()));
673
// Length goes to R3
674
__ ldr_s32(R3, Address(R2, Array<Klass*>::length_offset_in_bytes()));
675
__ add(R2, R2, Array<Klass*>::base_offset_in_bytes());
676
677
Label loop, miss;
678
__ bind(loop);
679
__ cbz(R3, miss);
680
__ ldr(LR, Address(R2, wordSize, post_indexed));
681
__ sub(R3, R3, 1);
682
__ cmp(LR, R1);
683
__ b(loop, ne);
684
685
// We get here if an equal cache entry is found
686
__ str(R1, Address(R0, Klass::secondary_super_cache_offset()));
687
__ mov(R0, 1);
688
__ raw_pop_and_ret(R2, R3);
689
690
// A cache entry not found - return false
691
__ bind(miss);
692
__ mov(R0, 0);
693
__ raw_pop_and_ret(R2, R3);
694
}
695
break;
696
697
case monitorenter_nofpu_id:
698
save_fpu_registers = false;
699
// fall through
700
case monitorenter_id:
701
{
702
__ set_info("monitorenter", dont_gc_arguments);
703
const Register obj = R1;
704
const Register lock = R2;
705
OopMap* map = save_live_registers(sasm, save_fpu_registers);
706
__ ldr(obj, Address(SP, arg1_offset));
707
__ ldr(lock, Address(SP, arg2_offset));
708
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorenter), obj, lock);
709
oop_maps = new OopMapSet();
710
oop_maps->add_gc_map(call_offset, map);
711
restore_live_registers(sasm, save_fpu_registers);
712
}
713
break;
714
715
case monitorexit_nofpu_id:
716
save_fpu_registers = false;
717
// fall through
718
case monitorexit_id:
719
{
720
__ set_info("monitorexit", dont_gc_arguments);
721
const Register lock = R1;
722
OopMap* map = save_live_registers(sasm, save_fpu_registers);
723
__ ldr(lock, Address(SP, arg1_offset));
724
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorexit), lock);
725
oop_maps = new OopMapSet();
726
oop_maps->add_gc_map(call_offset, map);
727
restore_live_registers(sasm, save_fpu_registers);
728
}
729
break;
730
731
case deoptimize_id:
732
{
733
__ set_info("deoptimize", dont_gc_arguments);
734
OopMap* oop_map = save_live_registers(sasm);
735
const Register trap_request = R1;
736
__ ldr(trap_request, Address(SP, arg1_offset));
737
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize), trap_request);
738
oop_maps = new OopMapSet();
739
oop_maps->add_gc_map(call_offset, oop_map);
740
restore_live_registers_without_return(sasm);
741
DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();
742
assert(deopt_blob != NULL, "deoptimization blob must have been created");
743
__ jump(deopt_blob->unpack_with_reexecution(), relocInfo::runtime_call_type, noreg);
744
}
745
break;
746
747
case access_field_patching_id:
748
{
749
__ set_info("access_field_patching", dont_gc_arguments);
750
oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, access_field_patching));
751
}
752
break;
753
754
case load_klass_patching_id:
755
{
756
__ set_info("load_klass_patching", dont_gc_arguments);
757
oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_klass_patching));
758
}
759
break;
760
761
case load_appendix_patching_id:
762
{
763
__ set_info("load_appendix_patching", dont_gc_arguments);
764
oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_appendix_patching));
765
}
766
break;
767
768
case load_mirror_patching_id:
769
{
770
__ set_info("load_mirror_patching", dont_gc_arguments);
771
oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_mirror_patching));
772
}
773
break;
774
775
case predicate_failed_trap_id:
776
{
777
__ set_info("predicate_failed_trap", dont_gc_arguments);
778
779
OopMap* oop_map = save_live_registers(sasm);
780
int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, predicate_failed_trap));
781
782
oop_maps = new OopMapSet();
783
oop_maps->add_gc_map(call_offset, oop_map);
784
785
restore_live_registers_without_return(sasm);
786
787
DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();
788
assert(deopt_blob != NULL, "deoptimization blob must have been created");
789
__ jump(deopt_blob->unpack_with_reexecution(), relocInfo::runtime_call_type, Rtemp);
790
}
791
break;
792
793
default:
794
{
795
__ set_info("unimplemented entry", dont_gc_arguments);
796
STOP("unimplemented entry");
797
}
798
break;
799
}
800
return oop_maps;
801
}
802
803
#undef __
804
805
#ifdef __SOFTFP__
806
const char *Runtime1::pd_name_for_address(address entry) {
807
808
#define FUNCTION_CASE(a, f) \
809
if ((intptr_t)a == CAST_FROM_FN_PTR(intptr_t, f)) return #f
810
811
FUNCTION_CASE(entry, __aeabi_fadd_glibc);
812
FUNCTION_CASE(entry, __aeabi_fmul);
813
FUNCTION_CASE(entry, __aeabi_fsub_glibc);
814
FUNCTION_CASE(entry, __aeabi_fdiv);
815
816
// __aeabi_XXXX_glibc: Imported code from glibc soft-fp bundle for calculation accuracy improvement. See CR 6757269.
817
FUNCTION_CASE(entry, __aeabi_dadd_glibc);
818
FUNCTION_CASE(entry, __aeabi_dmul);
819
FUNCTION_CASE(entry, __aeabi_dsub_glibc);
820
FUNCTION_CASE(entry, __aeabi_ddiv);
821
822
FUNCTION_CASE(entry, __aeabi_f2d);
823
FUNCTION_CASE(entry, __aeabi_d2f);
824
FUNCTION_CASE(entry, __aeabi_i2f);
825
FUNCTION_CASE(entry, __aeabi_i2d);
826
FUNCTION_CASE(entry, __aeabi_f2iz);
827
828
FUNCTION_CASE(entry, SharedRuntime::fcmpl);
829
FUNCTION_CASE(entry, SharedRuntime::fcmpg);
830
FUNCTION_CASE(entry, SharedRuntime::dcmpl);
831
FUNCTION_CASE(entry, SharedRuntime::dcmpg);
832
833
FUNCTION_CASE(entry, SharedRuntime::unordered_fcmplt);
834
FUNCTION_CASE(entry, SharedRuntime::unordered_dcmplt);
835
FUNCTION_CASE(entry, SharedRuntime::unordered_fcmple);
836
FUNCTION_CASE(entry, SharedRuntime::unordered_dcmple);
837
FUNCTION_CASE(entry, SharedRuntime::unordered_fcmpge);
838
FUNCTION_CASE(entry, SharedRuntime::unordered_dcmpge);
839
FUNCTION_CASE(entry, SharedRuntime::unordered_fcmpgt);
840
FUNCTION_CASE(entry, SharedRuntime::unordered_dcmpgt);
841
842
FUNCTION_CASE(entry, SharedRuntime::fneg);
843
FUNCTION_CASE(entry, SharedRuntime::dneg);
844
845
FUNCTION_CASE(entry, __aeabi_fcmpeq);
846
FUNCTION_CASE(entry, __aeabi_fcmplt);
847
FUNCTION_CASE(entry, __aeabi_fcmple);
848
FUNCTION_CASE(entry, __aeabi_fcmpge);
849
FUNCTION_CASE(entry, __aeabi_fcmpgt);
850
851
FUNCTION_CASE(entry, __aeabi_dcmpeq);
852
FUNCTION_CASE(entry, __aeabi_dcmplt);
853
FUNCTION_CASE(entry, __aeabi_dcmple);
854
FUNCTION_CASE(entry, __aeabi_dcmpge);
855
FUNCTION_CASE(entry, __aeabi_dcmpgt);
856
#undef FUNCTION_CASE
857
return "";
858
}
859
#else // __SOFTFP__
860
const char *Runtime1::pd_name_for_address(address entry) {
861
return "<unknown function>";
862
}
863
#endif // __SOFTFP__
864
865