1.1 --- a/src/cpu/x86/vm/interp_masm_x86_32.cpp Wed Mar 18 11:37:48 2009 -0400 1.2 +++ b/src/cpu/x86/vm/interp_masm_x86_32.cpp Thu Mar 19 09:13:24 2009 -0700 1.3 @@ -219,47 +219,16 @@ 1.4 // Resets EDI to locals. Register sub_klass cannot be any of the above. 1.5 void InterpreterMacroAssembler::gen_subtype_check( Register Rsub_klass, Label &ok_is_subtype ) { 1.6 assert( Rsub_klass != rax, "rax, holds superklass" ); 1.7 - assert( Rsub_klass != rcx, "rcx holds 2ndary super array length" ); 1.8 - assert( Rsub_klass != rdi, "rdi holds 2ndary super array scan ptr" ); 1.9 - Label not_subtype, loop; 1.10 + assert( Rsub_klass != rcx, "used as a temp" ); 1.11 + assert( Rsub_klass != rdi, "used as a temp, restored from locals" ); 1.12 1.13 // Profile the not-null value's klass. 1.14 - profile_typecheck(rcx, Rsub_klass, rdi); // blows rcx, rdi 1.15 + profile_typecheck(rcx, Rsub_klass, rdi); // blows rcx, reloads rdi 1.16 1.17 - // Load the super-klass's check offset into ECX 1.18 - movl( rcx, Address(rax, sizeof(oopDesc) + Klass::super_check_offset_offset_in_bytes() ) ); 1.19 - // Load from the sub-klass's super-class display list, or a 1-word cache of 1.20 - // the secondary superclass list, or a failing value with a sentinel offset 1.21 - // if the super-klass is an interface or exceptionally deep in the Java 1.22 - // hierarchy and we have to scan the secondary superclass list the hard way. 1.23 - // See if we get an immediate positive hit 1.24 - cmpptr( rax, Address(Rsub_klass,rcx,Address::times_1) ); 1.25 - jcc( Assembler::equal,ok_is_subtype ); 1.26 + // Do the check. 1.27 + check_klass_subtype(Rsub_klass, rax, rcx, ok_is_subtype); // blows rcx 1.28 1.29 - // Check for immediate negative hit 1.30 - cmpl( rcx, sizeof(oopDesc) + Klass::secondary_super_cache_offset_in_bytes() ); 1.31 - jcc( Assembler::notEqual, not_subtype ); 1.32 - // Check for self 1.33 - cmpptr( Rsub_klass, rax ); 1.34 - jcc( Assembler::equal, ok_is_subtype ); 1.35 - 1.36 - // Now do a linear scan of the secondary super-klass chain. 1.37 - movptr( rdi, Address(Rsub_klass, sizeof(oopDesc) + Klass::secondary_supers_offset_in_bytes()) ); 1.38 - // EDI holds the objArrayOop of secondary supers. 1.39 - movl( rcx, Address(rdi, arrayOopDesc::length_offset_in_bytes()));// Load the array length 1.40 - // Skip to start of data; also clear Z flag incase ECX is zero 1.41 - addptr( rdi, arrayOopDesc::base_offset_in_bytes(T_OBJECT) ); 1.42 - // Scan ECX words at [EDI] for occurance of EAX 1.43 - // Set NZ/Z based on last compare 1.44 - repne_scan(); 1.45 - restore_locals(); // Restore EDI; Must not blow flags 1.46 - // Not equal? 1.47 - jcc( Assembler::notEqual, not_subtype ); 1.48 - // Must be equal but missed in cache. Update cache. 1.49 - movptr( Address(Rsub_klass, sizeof(oopDesc) + Klass::secondary_super_cache_offset_in_bytes()), rax ); 1.50 - jmp( ok_is_subtype ); 1.51 - 1.52 - bind(not_subtype); 1.53 + // Profile the failure of the check. 1.54 profile_typecheck_failed(rcx); // blows rcx 1.55 } 1.56