src/cpu/sparc/vm/stubGenerator_sparc.cpp

changeset 5400
980532a806a5
parent 5283
46c544b8fbfc
child 5694
7944aba7ba41
     1.1 --- a/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Thu Jul 04 14:56:49 2013 -0700
     1.2 +++ b/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Thu Jun 20 15:02:05 2013 +0200
     1.3 @@ -410,6 +410,51 @@
     1.4      return start;
     1.5    }
     1.6  
     1.7 +  // Safefetch stubs.
     1.8 +  void generate_safefetch(const char* name, int size, address* entry,
     1.9 +                          address* fault_pc, address* continuation_pc) {
    1.10 +    // safefetch signatures:
    1.11 +    //   int      SafeFetch32(int*      adr, int      errValue);
    1.12 +    //   intptr_t SafeFetchN (intptr_t* adr, intptr_t errValue);
    1.13 +    //
    1.14 +    // arguments:
    1.15 +    //   o0 = adr
    1.16 +    //   o1 = errValue
    1.17 +    //
    1.18 +    // result:
    1.19 +    //   o0  = *adr or errValue
    1.20 +
    1.21 +    StubCodeMark mark(this, "StubRoutines", name);
    1.22 +
    1.23 +    // Entry point, pc or function descriptor.
    1.24 +    __ align(CodeEntryAlignment);
    1.25 +    *entry = __ pc();
    1.26 +
    1.27 +    __ mov(O0, G1);  // g1 = o0
    1.28 +    __ mov(O1, O0);  // o0 = o1
    1.29 +    // Load *adr into c_rarg1, may fault.
    1.30 +    *fault_pc = __ pc();
    1.31 +    switch (size) {
    1.32 +      case 4:
    1.33 +        // int32_t
    1.34 +        __ ldsw(G1, 0, O0);  // o0 = [g1]
    1.35 +        break;
    1.36 +      case 8:
    1.37 +        // int64_t
    1.38 +        __ ldx(G1, 0, O0);   // o0 = [g1]
    1.39 +        break;
    1.40 +      default:
    1.41 +        ShouldNotReachHere();
    1.42 +    }
    1.43 +
    1.44 +    // return errValue or *adr
    1.45 +    *continuation_pc = __ pc();
    1.46 +    // By convention with the trap handler we ensure there is a non-CTI
    1.47 +    // instruction in the trap shadow.
    1.48 +    __ nop();
    1.49 +    __ retl();
    1.50 +    __ delayed()->nop();
    1.51 +  }
    1.52  
    1.53    //------------------------------------------------------------------------------------------------------------------------
    1.54    // Continuation point for throwing of implicit exceptions that are not handled in
    1.55 @@ -3315,6 +3360,14 @@
    1.56  
    1.57      // Don't initialize the platform math functions since sparc
    1.58      // doesn't have intrinsics for these operations.
    1.59 +
    1.60 +    // Safefetch stubs.
    1.61 +    generate_safefetch("SafeFetch32", sizeof(int),     &StubRoutines::_safefetch32_entry,
    1.62 +                                                       &StubRoutines::_safefetch32_fault_pc,
    1.63 +                                                       &StubRoutines::_safefetch32_continuation_pc);
    1.64 +    generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry,
    1.65 +                                                       &StubRoutines::_safefetchN_fault_pc,
    1.66 +                                                       &StubRoutines::_safefetchN_continuation_pc);
    1.67    }
    1.68  
    1.69  

mercurial