3863 transition(vtos, atos);
3864
3865 Register Rptr = R31; // Needs to survive C call.
3866
3867 // Put ndims * wordSize into frame temp slot
3868 __ lbz(Rptr, 3, R14_bcp);
3869 __ sldi(Rptr, Rptr, Interpreter::logStackElementSize);
3870 // Esp points past last_dim, so set to R4 to first_dim address.
3871 __ add(R4, Rptr, R15_esp);
3872 call_VM(R17_tos, CAST_FROM_FN_PTR(address, InterpreterRuntime::multianewarray), R4 /* first_size_address */);
3873 // Pop all dimensions off the stack.
3874 __ add(R15_esp, Rptr, R15_esp);
3875
3876 // Must prevent reordering of stores for object initialization with stores that publish the new object.
3877 __ membar(Assembler::StoreStore);
3878 }
3879
3880 void TemplateTable::arraylength() {
3881 transition(atos, itos);
3882
3883 Label LnoException;
3884 __ verify_oop(R17_tos);
3885 __ null_check_throw(R17_tos, arrayOopDesc::length_offset_in_bytes(), R11_scratch1);
3886 __ lwa(R17_tos, arrayOopDesc::length_offset_in_bytes(), R17_tos);
3887 }
3888
3889 // ============================================================================
3890 // Typechecks
3891
3892 void TemplateTable::checkcast() {
3893 transition(atos, atos);
3894
3895 Label Ldone, Lis_null, Lquicked, Lresolved;
3896 Register Roffset = R6_ARG4,
3897 RobjKlass = R4_ARG2,
3898 RspecifiedKlass = R5_ARG3, // Generate_ClassCastException_verbose_handler will read value from this register.
3899 Rcpool = R11_scratch1,
3900 Rtags = R12_scratch2;
3901
3902 // Null does not pass.
3903 __ cmpdi(CCR0, R17_tos, 0);
4064 Robj_to_lock = R17_tos,
4065 Rscratch1 = R3_ARG1,
4066 Rscratch2 = R4_ARG2,
4067 Rscratch3 = R5_ARG3,
4068 Rcurrent_obj_addr = R6_ARG4;
4069
4070 // ------------------------------------------------------------------------------
4071 // Null pointer exception.
4072 __ null_check_throw(Robj_to_lock, -1, R11_scratch1);
4073
4074 // Try to acquire a lock on the object.
4075 // Repeat until succeeded (i.e., until monitorenter returns true).
4076
4077 // ------------------------------------------------------------------------------
4078 // Find a free slot in the monitor block.
4079 Label Lfound, Lexit, Lallocate_new;
4080 ConditionRegister found_free_slot = CCR0,
4081 found_same_obj = CCR1,
4082 reached_limit = CCR6;
4083 {
4084 Label Lloop, Lentry;
4085 Register Rlimit = Rcurrent_monitor;
4086
4087 // Set up search loop - start with topmost monitor.
4088 __ add(Rcurrent_obj_addr, BasicObjectLock::obj_offset_in_bytes(), R26_monitor);
4089
4090 __ ld(Rlimit, 0, R1_SP);
4091 __ addi(Rlimit, Rlimit, - (frame::ijava_state_size + frame::interpreter_frame_monitor_size_in_bytes() - BasicObjectLock::obj_offset_in_bytes())); // Monitor base
4092
4093 // Check if any slot is present => short cut to allocation if not.
4094 __ cmpld(reached_limit, Rcurrent_obj_addr, Rlimit);
4095 __ bgt(reached_limit, Lallocate_new);
4096
4097 // Pre-load topmost slot.
4098 __ ld(Rcurrent_obj, 0, Rcurrent_obj_addr);
4099 __ addi(Rcurrent_obj_addr, Rcurrent_obj_addr, frame::interpreter_frame_monitor_size() * wordSize);
4100 // The search loop.
4101 __ bind(Lloop);
4102 // Found free slot?
4103 __ cmpdi(found_free_slot, Rcurrent_obj, 0);
4104 // Is this entry for same obj? If so, stop the search and take the found
|
3863 transition(vtos, atos);
3864
3865 Register Rptr = R31; // Needs to survive C call.
3866
3867 // Put ndims * wordSize into frame temp slot
3868 __ lbz(Rptr, 3, R14_bcp);
3869 __ sldi(Rptr, Rptr, Interpreter::logStackElementSize);
3870 // Esp points past last_dim, so set to R4 to first_dim address.
3871 __ add(R4, Rptr, R15_esp);
3872 call_VM(R17_tos, CAST_FROM_FN_PTR(address, InterpreterRuntime::multianewarray), R4 /* first_size_address */);
3873 // Pop all dimensions off the stack.
3874 __ add(R15_esp, Rptr, R15_esp);
3875
3876 // Must prevent reordering of stores for object initialization with stores that publish the new object.
3877 __ membar(Assembler::StoreStore);
3878 }
3879
3880 void TemplateTable::arraylength() {
3881 transition(atos, itos);
3882
3883 __ verify_oop(R17_tos);
3884 __ null_check_throw(R17_tos, arrayOopDesc::length_offset_in_bytes(), R11_scratch1);
3885 __ lwa(R17_tos, arrayOopDesc::length_offset_in_bytes(), R17_tos);
3886 }
3887
3888 // ============================================================================
3889 // Typechecks
3890
3891 void TemplateTable::checkcast() {
3892 transition(atos, atos);
3893
3894 Label Ldone, Lis_null, Lquicked, Lresolved;
3895 Register Roffset = R6_ARG4,
3896 RobjKlass = R4_ARG2,
3897 RspecifiedKlass = R5_ARG3, // Generate_ClassCastException_verbose_handler will read value from this register.
3898 Rcpool = R11_scratch1,
3899 Rtags = R12_scratch2;
3900
3901 // Null does not pass.
3902 __ cmpdi(CCR0, R17_tos, 0);
4063 Robj_to_lock = R17_tos,
4064 Rscratch1 = R3_ARG1,
4065 Rscratch2 = R4_ARG2,
4066 Rscratch3 = R5_ARG3,
4067 Rcurrent_obj_addr = R6_ARG4;
4068
4069 // ------------------------------------------------------------------------------
4070 // Null pointer exception.
4071 __ null_check_throw(Robj_to_lock, -1, R11_scratch1);
4072
4073 // Try to acquire a lock on the object.
4074 // Repeat until succeeded (i.e., until monitorenter returns true).
4075
4076 // ------------------------------------------------------------------------------
4077 // Find a free slot in the monitor block.
4078 Label Lfound, Lexit, Lallocate_new;
4079 ConditionRegister found_free_slot = CCR0,
4080 found_same_obj = CCR1,
4081 reached_limit = CCR6;
4082 {
4083 Label Lloop;
4084 Register Rlimit = Rcurrent_monitor;
4085
4086 // Set up search loop - start with topmost monitor.
4087 __ add(Rcurrent_obj_addr, BasicObjectLock::obj_offset_in_bytes(), R26_monitor);
4088
4089 __ ld(Rlimit, 0, R1_SP);
4090 __ addi(Rlimit, Rlimit, - (frame::ijava_state_size + frame::interpreter_frame_monitor_size_in_bytes() - BasicObjectLock::obj_offset_in_bytes())); // Monitor base
4091
4092 // Check if any slot is present => short cut to allocation if not.
4093 __ cmpld(reached_limit, Rcurrent_obj_addr, Rlimit);
4094 __ bgt(reached_limit, Lallocate_new);
4095
4096 // Pre-load topmost slot.
4097 __ ld(Rcurrent_obj, 0, Rcurrent_obj_addr);
4098 __ addi(Rcurrent_obj_addr, Rcurrent_obj_addr, frame::interpreter_frame_monitor_size() * wordSize);
4099 // The search loop.
4100 __ bind(Lloop);
4101 // Found free slot?
4102 __ cmpdi(found_free_slot, Rcurrent_obj, 0);
4103 // Is this entry for same obj? If so, stop the search and take the found
|