< prev index next >

src/cpu/ppc/vm/stubGenerator_ppc.cpp

Print this page
rev 8574 : 8131048: ppc: implement CRC32 intrinsic


2456     *fault_pc = __ pc();
2457     switch (size) {
2458       case 4:
2459         // int32_t, signed extended
2460         __ lwa(R4_ARG2, 0, R3_ARG1);
2461         break;
2462       case 8:
2463         // int64_t
2464         __ ld(R4_ARG2, 0, R3_ARG1);
2465         break;
2466       default:
2467         ShouldNotReachHere();
2468     }
2469 
2470     // return errValue or *adr
2471     *continuation_pc = __ pc();
2472     __ mr(R3_RET, R4_ARG2);
2473     __ blr();
2474   }
2475 
















































2476   // Initialization
2477   void generate_initial() {
2478     // Generates all stubs and initializes the entry points
2479 
2480     // Entry points that exist in all platforms.
2481     // Note: This is code that could be shared among different platforms - however the
2482     // benefit seems to be smaller than the disadvantage of having a
2483     // much more complicated generator structure. See also comment in
2484     // stubRoutines.hpp.
2485 
2486     StubRoutines::_forward_exception_entry          = generate_forward_exception();
2487     StubRoutines::_call_stub_entry                  = generate_call_stub(StubRoutines::_call_stub_return_address);
2488     StubRoutines::_catch_exception_entry            = generate_catch_exception();
2489 
2490     // Build this early so it's available for the interpreter.
2491     StubRoutines::_throw_StackOverflowError_entry   =
2492       generate_throw_exception("StackOverflowError throw_exception",
2493                                CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError), false);






2494   }
2495 
2496   void generate_all() {
2497     // Generates all stubs and initializes the entry points
2498 
2499     // These entry points require SharedInfo::stack0 to be set up in
2500     // non-core builds
2501     StubRoutines::_throw_AbstractMethodError_entry         = generate_throw_exception("AbstractMethodError throw_exception",          CAST_FROM_FN_PTR(address, SharedRuntime::throw_AbstractMethodError),  false);
2502     // Handle IncompatibleClassChangeError in itable stubs.
2503     StubRoutines::_throw_IncompatibleClassChangeError_entry= generate_throw_exception("IncompatibleClassChangeError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError),  false);
2504     StubRoutines::_throw_NullPointerException_at_call_entry= generate_throw_exception("NullPointerException at call throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException_at_call), false);
2505 
2506     StubRoutines::_handler_for_unsafe_access_entry         = generate_handler_for_unsafe_access();
2507 
2508     // support for verify_oop (must happen after universe_init)
2509     StubRoutines::_verify_oop_subroutine_entry             = generate_verify_oop();
2510 
2511     // arraycopy stubs used by compilers
2512     generate_arraycopy_stubs();
2513 




2456     *fault_pc = __ pc();
2457     switch (size) {
2458       case 4:
2459         // int32_t, signed extended
2460         __ lwa(R4_ARG2, 0, R3_ARG1);
2461         break;
2462       case 8:
2463         // int64_t
2464         __ ld(R4_ARG2, 0, R3_ARG1);
2465         break;
2466       default:
2467         ShouldNotReachHere();
2468     }
2469 
2470     // return errValue or *adr
2471     *continuation_pc = __ pc();
2472     __ mr(R3_RET, R4_ARG2);
2473     __ blr();
2474   }
2475 
2476   /**
2477    * Arguments:
2478    *
2479    * Inputs:
2480    *   R3_ARG1    - int   crc
2481    *   R4_ARG2    - byte* buf
2482    *   R5_ARG3    - int   length (of buffer)
2483    *
2484    * scratch:
2485    *   R6_ARG4    - crc table address
2486    *   R7_ARG5    - tmp1
2487    *   R8_ARG6    - tmp2
2488    *
2489    * Ouput:
2490    *   R3_RET     - int   crc result
2491    */
2492   // Compute CRC32 function.
2493   address generate_CRC32_updateBytes(const char* name) {
2494     __ align(CodeEntryAlignment);
2495     StubCodeMark mark(this, "StubRoutines", name);
2496     address start = __ function_entry();  // Remember stub start address (is rtn value).
2497 
2498     // arguments to kernel_crc32:
2499     Register       crc     = R3_ARG1;  // Current checksum, preset by caller or result from previous call.
2500     Register       data    = R4_ARG2;  // source byte array
2501     Register       dataLen = R5_ARG3;  // #bytes to process
2502     Register       table   = R6_ARG4;  // crc table address
2503 
2504     Register       t0      = R9;       // work reg for kernel* emitters
2505     Register       t1      = R10;      // work reg for kernel* emitters
2506     Register       t2      = R11;      // work reg for kernel* emitters
2507     Register       t3      = R12;      // work reg for kernel* emitters
2508 
2509     BLOCK_COMMENT("Stub body {");
2510     assert_different_registers(crc, data, dataLen, table);
2511 
2512     StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table);
2513 
2514     __ kernel_crc32_1byte(crc, data, dataLen, table, t0, t1, t2, t3);
2515 
2516     BLOCK_COMMENT("return");
2517     __ mr_if_needed(R3_RET, crc);      // Updated crc is function result. No copying required (R3_ARG1 == R3_RET).
2518     __ blr();
2519 
2520     BLOCK_COMMENT("} Stub body");
2521     return start;
2522   }
2523 
2524   // Initialization
2525   void generate_initial() {
2526     // Generates all stubs and initializes the entry points
2527 
2528     // Entry points that exist in all platforms.
2529     // Note: This is code that could be shared among different platforms - however the
2530     // benefit seems to be smaller than the disadvantage of having a
2531     // much more complicated generator structure. See also comment in
2532     // stubRoutines.hpp.
2533 
2534     StubRoutines::_forward_exception_entry          = generate_forward_exception();
2535     StubRoutines::_call_stub_entry                  = generate_call_stub(StubRoutines::_call_stub_return_address);
2536     StubRoutines::_catch_exception_entry            = generate_catch_exception();
2537 
2538     // Build this early so it's available for the interpreter.
2539     StubRoutines::_throw_StackOverflowError_entry   =
2540       generate_throw_exception("StackOverflowError throw_exception",
2541                                CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError), false);
2542 
2543     // CRC32 Intrinsics.
2544     if (UseCRC32Intrinsics) {
2545       StubRoutines::_crc_table_adr    = (address)StubRoutines::ppc64::_crc_table;
2546       StubRoutines::_updateBytesCRC32 = generate_CRC32_updateBytes("CRC32_updateBytes");
2547     }
2548   }
2549 
2550   void generate_all() {
2551     // Generates all stubs and initializes the entry points
2552 
2553     // These entry points require SharedInfo::stack0 to be set up in
2554     // non-core builds
2555     StubRoutines::_throw_AbstractMethodError_entry         = generate_throw_exception("AbstractMethodError throw_exception",          CAST_FROM_FN_PTR(address, SharedRuntime::throw_AbstractMethodError),  false);
2556     // Handle IncompatibleClassChangeError in itable stubs.
2557     StubRoutines::_throw_IncompatibleClassChangeError_entry= generate_throw_exception("IncompatibleClassChangeError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError),  false);
2558     StubRoutines::_throw_NullPointerException_at_call_entry= generate_throw_exception("NullPointerException at call throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException_at_call), false);
2559 
2560     StubRoutines::_handler_for_unsafe_access_entry         = generate_handler_for_unsafe_access();
2561 
2562     // support for verify_oop (must happen after universe_init)
2563     StubRoutines::_verify_oop_subroutine_entry             = generate_verify_oop();
2564 
2565     // arraycopy stubs used by compilers
2566     generate_arraycopy_stubs();
2567 


< prev index next >