src/cpu/x86/vm/interp_masm_x86_64.cpp

changeset 1082
bd441136a5ce
parent 1063
7bb995fbd3c0
parent 1079
c517646eef23
child 1145
e5b0439ef4ae
     1.1 --- a/src/cpu/x86/vm/interp_masm_x86_64.cpp	Wed Mar 18 11:37:48 2009 -0400
     1.2 +++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp	Thu Mar 19 09:13:24 2009 -0700
     1.3 @@ -232,65 +232,13 @@
     1.4    assert(Rsub_klass != rcx, "rcx holds 2ndary super array length");
     1.5    assert(Rsub_klass != rdi, "rdi holds 2ndary super array scan ptr");
     1.6  
     1.7 -  Label not_subtype, not_subtype_pop, loop;
     1.8 +  // Profile the not-null value's klass.
     1.9 +  profile_typecheck(rcx, Rsub_klass, rdi); // blows rcx, reloads rdi
    1.10  
    1.11 -  // Profile the not-null value's klass.
    1.12 -  profile_typecheck(rcx, Rsub_klass, rdi); // blows rcx, rdi
    1.13 +  // Do the check.
    1.14 +  check_klass_subtype(Rsub_klass, rax, rcx, ok_is_subtype); // blows rcx
    1.15  
    1.16 -  // Load the super-klass's check offset into rcx
    1.17 -  movl(rcx, Address(rax, sizeof(oopDesc) +
    1.18 -                    Klass::super_check_offset_offset_in_bytes()));
    1.19 -  // Load from the sub-klass's super-class display list, or a 1-word
    1.20 -  // cache of the secondary superclass list, or a failing value with a
    1.21 -  // sentinel offset if the super-klass is an interface or
    1.22 -  // exceptionally deep in the Java hierarchy and we have to scan the
    1.23 -  // secondary superclass list the hard way.  See if we get an
    1.24 -  // immediate positive hit
    1.25 -  cmpptr(rax, Address(Rsub_klass, rcx, Address::times_1));
    1.26 -  jcc(Assembler::equal,ok_is_subtype);
    1.27 -
    1.28 -  // Check for immediate negative hit
    1.29 -  cmpl(rcx, sizeof(oopDesc) + Klass::secondary_super_cache_offset_in_bytes());
    1.30 -  jcc( Assembler::notEqual, not_subtype );
    1.31 -  // Check for self
    1.32 -  cmpptr(Rsub_klass, rax);
    1.33 -  jcc(Assembler::equal, ok_is_subtype);
    1.34 -
    1.35 -  // Now do a linear scan of the secondary super-klass chain.
    1.36 -  movptr(rdi, Address(Rsub_klass, sizeof(oopDesc) +
    1.37 -                      Klass::secondary_supers_offset_in_bytes()));
    1.38 -  // rdi holds the objArrayOop of secondary supers.
    1.39 -  // Load the array length
    1.40 -  movl(rcx, Address(rdi, arrayOopDesc::length_offset_in_bytes()));
    1.41 -  // Skip to start of data; also clear Z flag incase rcx is zero
    1.42 -  addptr(rdi, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
    1.43 -  // Scan rcx words at [rdi] for occurance of rax
    1.44 -  // Set NZ/Z based on last compare
    1.45 -
    1.46 -  // this part is kind tricky, as values in supers array could be 32 or 64 bit wide
    1.47 -  // and we store values in objArrays always encoded, thus we need to encode value
    1.48 -  // before repne
    1.49 -  if (UseCompressedOops) {
    1.50 -    push(rax);
    1.51 -    encode_heap_oop(rax);
    1.52 -    repne_scanl();
    1.53 -    // Not equal?
    1.54 -    jcc(Assembler::notEqual, not_subtype_pop);
    1.55 -    // restore heap oop here for movq
    1.56 -    pop(rax);
    1.57 -  } else {
    1.58 -    repne_scan();
    1.59 -    jcc(Assembler::notEqual, not_subtype);
    1.60 -  }
    1.61 -  // Must be equal but missed in cache.  Update cache.
    1.62 -  movptr(Address(Rsub_klass, sizeof(oopDesc) +
    1.63 -               Klass::secondary_super_cache_offset_in_bytes()), rax);
    1.64 -  jmp(ok_is_subtype);
    1.65 -
    1.66 -  bind(not_subtype_pop);
    1.67 -  // restore heap oop here for miss
    1.68 -  if (UseCompressedOops) pop(rax);
    1.69 -  bind(not_subtype);
    1.70 +  // Profile the failure of the check.
    1.71    profile_typecheck_failed(rcx); // blows rcx
    1.72  }
    1.73  

mercurial