hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp
changeset 360 21d113ecbf6a
parent 1 489c9b5090e2
child 670 ddf3e9583f2f
equal deleted inserted replaced
357:f4edb0d9f109 360:21d113ecbf6a
   857   add(LcpoolCache, tmp, cache);
   857   add(LcpoolCache, tmp, cache);
   858 }
   858 }
   859 
   859 
   860 
   860 
   861 // Generate a subtype check: branch to ok_is_subtype if sub_klass is
   861 // Generate a subtype check: branch to ok_is_subtype if sub_klass is
   862 // a subtype of super_klass.  Blows registers Rsub_klass, tmp1, tmp2.
   862 // a subtype of super_klass.  Blows registers Rsuper_klass, Rsub_klass, tmp1, tmp2.
   863 void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass,
   863 void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass,
   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,
   889   brx( Assembler::equal, false, Assembler::pt, ok_is_subtype );
   889   brx( Assembler::equal, false, Assembler::pt, ok_is_subtype );
   890 
   890 
   891   // Now do a linear scan of the secondary super-klass chain.
   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 );
   892   delayed()->ld_ptr( Rsub_klass, sizeof(oopDesc) + Klass::secondary_supers_offset_in_bytes(), Rtmp2 );
   893 
   893 
       
   894   // compress superclass
       
   895   if (UseCompressedOops) encode_heap_oop(Rsuper_klass);
       
   896 
   894   // Rtmp2 holds the objArrayOop of secondary supers.
   897   // Rtmp2 holds the objArrayOop of secondary supers.
   895   ld( Rtmp2, arrayOopDesc::length_offset_in_bytes(), Rtmp1 );// Load the array length
   898   ld( Rtmp2, arrayOopDesc::length_offset_in_bytes(), Rtmp1 );// Load the array length
   896   // Check for empty secondary super list
   899   // Check for empty secondary super list
   897   tst(Rtmp1);
   900   tst(Rtmp1);
   898 
   901 
   899   // Top of search loop
   902   // Top of search loop
   900   bind( loop );
   903   bind( loop );
   901   br( Assembler::equal, false, Assembler::pn, not_subtype );
   904   br( Assembler::equal, false, Assembler::pn, not_subtype );
   902   delayed()->nop();
   905   delayed()->nop();
       
   906 
   903   // load next super to check
   907   // load next super to check
   904   ld_ptr( Rtmp2, arrayOopDesc::base_offset_in_bytes(T_OBJECT), Rtmp3 );
   908   if (UseCompressedOops) {
   905 
   909     ld( Rtmp2, arrayOopDesc::base_offset_in_bytes(T_OBJECT), Rtmp3);
   906   // Bump array pointer forward one oop
   910     // Bump array pointer forward one oop
   907   add( Rtmp2, wordSize, Rtmp2 );
   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   }
   908   // Look for Rsuper_klass on Rsub_klass's secondary super-class-overflow list
   917   // Look for Rsuper_klass on Rsub_klass's secondary super-class-overflow list
   909   cmp( Rtmp3, Rsuper_klass );
   918   cmp( Rtmp3, Rsuper_klass );
   910   // A miss means we are NOT a subtype and need to keep looping
   919   // A miss means we are NOT a subtype and need to keep looping
   911   brx( Assembler::notEqual, false, Assembler::pt, loop );
   920   brx( Assembler::notEqual, false, Assembler::pt, loop );
   912   delayed()->deccc( Rtmp1 );    // dec trip counter in delay slot
   921   delayed()->deccc( Rtmp1 );    // dec trip counter in delay slot
   913   // Falling out the bottom means we found a hit; we ARE a subtype
   922   // Falling out the bottom means we found a hit; we ARE a subtype
       
   923   if (UseCompressedOops) decode_heap_oop(Rsuper_klass);
   914   br( Assembler::always, false, Assembler::pt, ok_is_subtype );
   924   br( Assembler::always, false, Assembler::pt, ok_is_subtype );
   915   // Update the cache
   925   // Update the cache
   916   delayed()->st_ptr( Rsuper_klass, Rsub_klass, sizeof(oopDesc) + Klass::secondary_super_cache_offset_in_bytes() );
   926   delayed()->st_ptr( Rsuper_klass, Rsub_klass,
       
   927                      sizeof(oopDesc) + Klass::secondary_super_cache_offset_in_bytes() );
   917 
   928 
   918   bind(not_subtype);
   929   bind(not_subtype);
   919   profile_typecheck_failed(Rtmp1);
   930   profile_typecheck_failed(Rtmp1);
   920 }
   931 }
   921 
   932