Mercurial > hg > graal-compiler
comparison src/cpu/sparc/vm/stubGenerator_sparc.cpp @ 11127:980532a806a5
8016697: Use stubs to implement safefetch
Summary: Implement Safefetch as stub routines. This reduces compiler and os dependencies.
Reviewed-by: twisti, kvn
author | goetz |
---|---|
date | Thu, 20 Jun 2013 15:02:05 +0200 |
parents | 46c544b8fbfc |
children | 6b0fd0964b87 7944aba7ba41 |
comparison
equal
deleted
inserted
replaced
11088:ea4d24c1e0c6 | 11127:980532a806a5 |
---|---|
408 __ delayed()->st_ptr(G0, exception_addr); | 408 __ delayed()->st_ptr(G0, exception_addr); |
409 | 409 |
410 return start; | 410 return start; |
411 } | 411 } |
412 | 412 |
413 // Safefetch stubs. | |
414 void generate_safefetch(const char* name, int size, address* entry, | |
415 address* fault_pc, address* continuation_pc) { | |
416 // safefetch signatures: | |
417 // int SafeFetch32(int* adr, int errValue); | |
418 // intptr_t SafeFetchN (intptr_t* adr, intptr_t errValue); | |
419 // | |
420 // arguments: | |
421 // o0 = adr | |
422 // o1 = errValue | |
423 // | |
424 // result: | |
425 // o0 = *adr or errValue | |
426 | |
427 StubCodeMark mark(this, "StubRoutines", name); | |
428 | |
429 // Entry point, pc or function descriptor. | |
430 __ align(CodeEntryAlignment); | |
431 *entry = __ pc(); | |
432 | |
433 __ mov(O0, G1); // g1 = o0 | |
434 __ mov(O1, O0); // o0 = o1 | |
435 // Load *adr into c_rarg1, may fault. | |
436 *fault_pc = __ pc(); | |
437 switch (size) { | |
438 case 4: | |
439 // int32_t | |
440 __ ldsw(G1, 0, O0); // o0 = [g1] | |
441 break; | |
442 case 8: | |
443 // int64_t | |
444 __ ldx(G1, 0, O0); // o0 = [g1] | |
445 break; | |
446 default: | |
447 ShouldNotReachHere(); | |
448 } | |
449 | |
450 // return errValue or *adr | |
451 *continuation_pc = __ pc(); | |
452 // By convention with the trap handler we ensure there is a non-CTI | |
453 // instruction in the trap shadow. | |
454 __ nop(); | |
455 __ retl(); | |
456 __ delayed()->nop(); | |
457 } | |
413 | 458 |
414 //------------------------------------------------------------------------------------------------------------------------ | 459 //------------------------------------------------------------------------------------------------------------------------ |
415 // Continuation point for throwing of implicit exceptions that are not handled in | 460 // Continuation point for throwing of implicit exceptions that are not handled in |
416 // the current activation. Fabricates an exception oop and initiates normal | 461 // the current activation. Fabricates an exception oop and initiates normal |
417 // exception dispatching in this frame. Only callee-saved registers are preserved | 462 // exception dispatching in this frame. Only callee-saved registers are preserved |
3313 // arraycopy stubs used by compilers | 3358 // arraycopy stubs used by compilers |
3314 generate_arraycopy_stubs(); | 3359 generate_arraycopy_stubs(); |
3315 | 3360 |
3316 // Don't initialize the platform math functions since sparc | 3361 // Don't initialize the platform math functions since sparc |
3317 // doesn't have intrinsics for these operations. | 3362 // doesn't have intrinsics for these operations. |
3363 | |
3364 // Safefetch stubs. | |
3365 generate_safefetch("SafeFetch32", sizeof(int), &StubRoutines::_safefetch32_entry, | |
3366 &StubRoutines::_safefetch32_fault_pc, | |
3367 &StubRoutines::_safefetch32_continuation_pc); | |
3368 generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry, | |
3369 &StubRoutines::_safefetchN_fault_pc, | |
3370 &StubRoutines::_safefetchN_continuation_pc); | |
3318 } | 3371 } |
3319 | 3372 |
3320 | 3373 |
3321 public: | 3374 public: |
3322 StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) { | 3375 StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) { |