Mercurial > hg > truffle
comparison src/cpu/sparc/vm/interp_masm_sparc.cpp @ 644:c517646eef23
6813212: factor duplicated assembly code for general subclass check (for 6655638)
Summary: Code in interp_masm, stubGenerator, c1_LIRAssembler, and AD files moved into MacroAssembler.
Reviewed-by: kvn
author | jrose |
---|---|
date | Fri, 13 Mar 2009 18:39:22 -0700 |
parents | 3db67f76d308 |
children | 6b2273dd6fa9 |
comparison
equal
deleted
inserted
replaced
643:c771b7f43bbf | 644:c517646eef23 |
---|---|
864 Register Rsuper_klass, | 864 Register Rsuper_klass, |
865 Register Rtmp1, | 865 Register Rtmp1, |
866 Register Rtmp2, | 866 Register Rtmp2, |
867 Register Rtmp3, | 867 Register Rtmp3, |
868 Label &ok_is_subtype ) { | 868 Label &ok_is_subtype ) { |
869 Label not_subtype, loop; | 869 Label not_subtype; |
870 | 870 |
871 // Profile the not-null value's klass. | 871 // Profile the not-null value's klass. |
872 profile_typecheck(Rsub_klass, Rtmp1); | 872 profile_typecheck(Rsub_klass, Rtmp1); |
873 | 873 |
874 // Load the super-klass's check offset into Rtmp1 | 874 check_klass_subtype_fast_path(Rsub_klass, Rsuper_klass, |
875 ld( Rsuper_klass, sizeof(oopDesc) + Klass::super_check_offset_offset_in_bytes(), Rtmp1 ); | 875 Rtmp1, Rtmp2, |
876 // Load from the sub-klass's super-class display list, or a 1-word cache of | 876 &ok_is_subtype, ¬_subtype, NULL); |
877 // the secondary superclass list, or a failing value with a sentinel offset | 877 |
878 // if the super-klass is an interface or exceptionally deep in the Java | 878 check_klass_subtype_slow_path(Rsub_klass, Rsuper_klass, |
879 // hierarchy and we have to scan the secondary superclass list the hard way. | 879 Rtmp1, Rtmp2, Rtmp3, /*hack:*/ noreg, |
880 ld_ptr( Rsub_klass, Rtmp1, Rtmp2 ); | 880 &ok_is_subtype, NULL); |
881 // See if we get an immediate positive hit | |
882 cmp( Rtmp2, Rsuper_klass ); | |
883 brx( Assembler::equal, false, Assembler::pt, ok_is_subtype ); | |
884 // In the delay slot, check for immediate negative hit | |
885 delayed()->cmp( Rtmp1, sizeof(oopDesc) + Klass::secondary_super_cache_offset_in_bytes() ); | |
886 br( Assembler::notEqual, false, Assembler::pt, not_subtype ); | |
887 // In the delay slot, check for self | |
888 delayed()->cmp( Rsub_klass, Rsuper_klass ); | |
889 brx( Assembler::equal, false, Assembler::pt, ok_is_subtype ); | |
890 | |
891 // Now do a linear scan of the secondary super-klass chain. | |
892 delayed()->ld_ptr( Rsub_klass, sizeof(oopDesc) + Klass::secondary_supers_offset_in_bytes(), Rtmp2 ); | |
893 | |
894 // compress superclass | |
895 if (UseCompressedOops) encode_heap_oop(Rsuper_klass); | |
896 | |
897 // Rtmp2 holds the objArrayOop of secondary supers. | |
898 ld( Rtmp2, arrayOopDesc::length_offset_in_bytes(), Rtmp1 );// Load the array length | |
899 // Check for empty secondary super list | |
900 tst(Rtmp1); | |
901 | |
902 // Top of search loop | |
903 bind( loop ); | |
904 br( Assembler::equal, false, Assembler::pn, not_subtype ); | |
905 delayed()->nop(); | |
906 | |
907 // load next super to check | |
908 if (UseCompressedOops) { | |
909 lduw( Rtmp2, arrayOopDesc::base_offset_in_bytes(T_OBJECT), Rtmp3); | |
910 // Bump array pointer forward one oop | |
911 add( Rtmp2, 4, Rtmp2 ); | |
912 } else { | |
913 ld_ptr( Rtmp2, arrayOopDesc::base_offset_in_bytes(T_OBJECT), Rtmp3); | |
914 // Bump array pointer forward one oop | |
915 add( Rtmp2, wordSize, Rtmp2); | |
916 } | |
917 // Look for Rsuper_klass on Rsub_klass's secondary super-class-overflow list | |
918 cmp( Rtmp3, Rsuper_klass ); | |
919 // A miss means we are NOT a subtype and need to keep looping | |
920 brx( Assembler::notEqual, false, Assembler::pt, loop ); | |
921 delayed()->deccc( Rtmp1 ); // dec trip counter in delay slot | |
922 // Falling out the bottom means we found a hit; we ARE a subtype | |
923 if (UseCompressedOops) decode_heap_oop(Rsuper_klass); | |
924 br( Assembler::always, false, Assembler::pt, ok_is_subtype ); | |
925 // Update the cache | |
926 delayed()->st_ptr( Rsuper_klass, Rsub_klass, | |
927 sizeof(oopDesc) + Klass::secondary_super_cache_offset_in_bytes() ); | |
928 | 881 |
929 bind(not_subtype); | 882 bind(not_subtype); |
930 profile_typecheck_failed(Rtmp1); | 883 profile_typecheck_failed(Rtmp1); |
931 } | 884 } |
932 | 885 |