src/cpu/x86/vm/stubGenerator_x86_64.cpp

changeset 5400
980532a806a5
parent 5353
b800986664f4
child 5440
46a90f83df31
     1.1 --- a/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Thu Jul 04 14:56:49 2013 -0700
     1.2 +++ b/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Thu Jun 20 15:02:05 2013 +0200
     1.3 @@ -3357,7 +3357,45 @@
     1.4      return start;
     1.5    }
     1.6  
     1.7 -
     1.8 +  // Safefetch stubs.
     1.9 +  void generate_safefetch(const char* name, int size, address* entry,
    1.10 +                          address* fault_pc, address* continuation_pc) {
    1.11 +    // safefetch signatures:
    1.12 +    //   int      SafeFetch32(int*      adr, int      errValue);
    1.13 +    //   intptr_t SafeFetchN (intptr_t* adr, intptr_t errValue);
    1.14 +    //
    1.15 +    // arguments:
    1.16 +    //   c_rarg0 = adr
    1.17 +    //   c_rarg1 = errValue
    1.18 +    //
    1.19 +    // result:
    1.20 +    //   PPC_RET  = *adr or errValue
    1.21 +
    1.22 +    StubCodeMark mark(this, "StubRoutines", name);
    1.23 +
    1.24 +    // Entry point, pc or function descriptor.
    1.25 +    *entry = __ pc();
    1.26 +
    1.27 +    // Load *adr into c_rarg1, may fault.
    1.28 +    *fault_pc = __ pc();
    1.29 +    switch (size) {
    1.30 +      case 4:
    1.31 +        // int32_t
    1.32 +        __ movl(c_rarg1, Address(c_rarg0, 0));
    1.33 +        break;
    1.34 +      case 8:
    1.35 +        // int64_t
    1.36 +        __ movq(c_rarg1, Address(c_rarg0, 0));
    1.37 +        break;
    1.38 +      default:
    1.39 +        ShouldNotReachHere();
    1.40 +    }
    1.41 +
    1.42 +    // return errValue or *adr
    1.43 +    *continuation_pc = __ pc();
    1.44 +    __ movq(rax, c_rarg1);
    1.45 +    __ ret(0);
    1.46 +  }
    1.47  
    1.48    // This is a version of CBC/AES Decrypt which does 4 blocks in a loop at a time
    1.49    // to hide instruction latency
    1.50 @@ -3833,6 +3871,14 @@
    1.51        StubRoutines::_cipherBlockChaining_encryptAESCrypt = generate_cipherBlockChaining_encryptAESCrypt();
    1.52        StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_decryptAESCrypt_Parallel();
    1.53      }
    1.54 +
    1.55 +    // Safefetch stubs.
    1.56 +    generate_safefetch("SafeFetch32", sizeof(int),     &StubRoutines::_safefetch32_entry,
    1.57 +                                                       &StubRoutines::_safefetch32_fault_pc,
    1.58 +                                                       &StubRoutines::_safefetch32_continuation_pc);
    1.59 +    generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry,
    1.60 +                                                       &StubRoutines::_safefetchN_fault_pc,
    1.61 +                                                       &StubRoutines::_safefetchN_continuation_pc);
    1.62    }
    1.63  
    1.64   public:

mercurial