884 // of java.lang.Reference) and jump to the slow path if null. If the |
884 // of java.lang.Reference) and jump to the slow path if null. If the |
885 // Reference object is null then we obviously cannot fetch the referent |
885 // Reference object is null then we obviously cannot fetch the referent |
886 // and so we don't need to call the G1 pre-barrier. Thus we can use the |
886 // and so we don't need to call the G1 pre-barrier. Thus we can use the |
887 // regular method entry code to generate the NPE. |
887 // regular method entry code to generate the NPE. |
888 // |
888 // |
889 // This code is based on generate_accessor_enty. |
889 // This code is based on generate_accessor_entry. |
890 // |
890 // |
891 // rmethod: Method* |
891 // rmethod: Method* |
892 // r13: senderSP must preserve for slow path, set SP to it on fast path |
892 // r13: senderSP must preserve for slow path, set SP to it on fast path |
893 |
893 |
894 address entry = __ pc(); |
894 address entry = __ pc(); |
902 // Check if local 0 != NULL |
902 // Check if local 0 != NULL |
903 // If the receiver is null then it is OK to jump to the slow path. |
903 // If the receiver is null then it is OK to jump to the slow path. |
904 __ ldr(local_0, Address(esp, 0)); |
904 __ ldr(local_0, Address(esp, 0)); |
905 __ cbz(local_0, slow_path); |
905 __ cbz(local_0, slow_path); |
906 |
906 |
907 |
|
908 // Load the value of the referent field. |
907 // Load the value of the referent field. |
909 const Address field_address(local_0, referent_offset); |
908 const Address field_address(local_0, referent_offset); |
910 __ load_heap_oop(local_0, field_address); |
909 __ load_heap_oop(local_0, field_address); |
911 |
910 |
|
911 __ mov(r19, r13); // Move senderSP to a callee-saved register |
912 // Generate the G1 pre-barrier code to log the value of |
912 // Generate the G1 pre-barrier code to log the value of |
913 // the referent field in an SATB buffer. |
913 // the referent field in an SATB buffer. |
914 __ enter(); // g1_write may call runtime |
914 __ enter(); // g1_write may call runtime |
915 __ g1_write_barrier_pre(noreg /* obj */, |
915 __ g1_write_barrier_pre(noreg /* obj */, |
916 local_0 /* pre_val */, |
916 local_0 /* pre_val */, |
918 rscratch2 /* tmp */, |
918 rscratch2 /* tmp */, |
919 true /* tosca_live */, |
919 true /* tosca_live */, |
920 true /* expand_call */); |
920 true /* expand_call */); |
921 __ leave(); |
921 __ leave(); |
922 // areturn |
922 // areturn |
923 __ andr(sp, r13, -16); // done with stack |
923 __ andr(sp, r19, -16); // done with stack |
924 __ ret(lr); |
924 __ ret(lr); |
925 |
925 |
926 // generate a vanilla interpreter entry as the slow path |
926 // generate a vanilla interpreter entry as the slow path |
927 __ bind(slow_path); |
927 __ bind(slow_path); |
928 __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::zerolocals)); |
928 __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::zerolocals)); |