1616 // synchronization is progress, and escapes.
1617
1618 __ set_thread_state(_thread_in_native_trans);
1619 if (UseMembar) {
1620 __ z_fence();
1621 } else {
1622 // Write serialization page so VM thread can do a pseudo remote
1623 // membar. We use the current thread pointer to calculate a thread
1624 // specific offset to write to within the page. This minimizes bus
1625 // traffic due to cache line collision.
1626 __ serialize_memory(Z_thread, Z_R1, Z_R0);
1627 }
1628 // Now before we return to java we must look for a current safepoint
1629 // (a new safepoint can not start since we entered native_trans).
1630 // We must check here because a current safepoint could be modifying
1631 // the callers registers right this moment.
1632
1633 // Check for safepoint operation in progress and/or pending suspend requests.
1634 {
1635 Label Continue, do_safepoint;
1636 __ generate_safepoint_check(do_safepoint, Z_R1, true);
1637 // Check for suspend.
1638 __ load_and_test_int(Z_R0/*suspend_flags*/, thread_(suspend_flags));
1639 __ z_bre(Continue); // 0 -> no flag set -> not suspended
1640 __ bind(do_safepoint);
1641 __ z_lgr(Z_ARG1, Z_thread);
1642 __ call_c(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans));
1643 __ bind(Continue);
1644 }
1645
1646 //=============================================================================
1647 // Back in Interpreter Frame.
1648
1649 // We are in thread_in_native_trans here and back in the normal
1650 // interpreter frame. We don't have to do anything special about
1651 // safepoints and we can switch to Java mode anytime we are ready.
1652
1653 // Note: frame::interpreter_frame_result has a dependency on how the
1654 // method result is saved across the call to post_method_exit. For
1655 // native methods it assumes that the non-FPU/non-void result is
1656 // saved in z_ijava_state.lresult and a FPU result in z_ijava_state.fresult. If
1920 generate_counter_overflow(Lcontinue);
1921 }
1922
1923 BLOCK_COMMENT("} normal_entry");
1924
1925 return entry_point;
1926 }
1927
1928
1929 /**
1930 * Method entry for static native methods:
1931 * int java.util.zip.CRC32.update(int crc, int b)
1932 */
1933 address TemplateInterpreterGenerator::generate_CRC32_update_entry() {
1934
1935 if (UseCRC32Intrinsics) {
1936 uint64_t entry_off = __ offset();
1937 Label slow_path;
1938
1939 // If we need a safepoint check, generate full interpreter entry.
1940 __ generate_safepoint_check(slow_path, Z_R1, false);
1941
1942 BLOCK_COMMENT("CRC32_update {");
1943
1944 // We don't generate local frame and don't align stack because
1945 // we not even call stub code (we generate the code inline)
1946 // and there is no safepoint on this path.
1947
1948 // Load java parameters.
1949 // Z_esp is callers operand stack pointer, i.e. it points to the parameters.
1950 const Register argP = Z_esp;
1951 const Register crc = Z_ARG1; // crc value
1952 const Register data = Z_ARG2; // address of java byte value (kernel_crc32 needs address)
1953 const Register dataLen = Z_ARG3; // source data len (1 byte). Not used because calling the single-byte emitter.
1954 const Register table = Z_ARG4; // address of crc32 table
1955
1956 // Arguments are reversed on java expression stack.
1957 __ z_la(data, 3+1*wordSize, argP); // byte value (stack address).
1958 // Being passed as an int, the single byte is at offset +3.
1959 __ z_llgf(crc, 2 * wordSize, argP); // Current crc state, zero extend to 64 bit to have a clean register.
1960
1973 __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native), Z_R1);
1974 return __ addr_at(entry_off);
1975 }
1976
1977 return NULL;
1978 }
1979
1980
1981 /**
1982 * Method entry for static native methods:
1983 * int java.util.zip.CRC32.updateBytes( int crc, byte[] b, int off, int len)
1984 * int java.util.zip.CRC32.updateByteBuffer(int crc, long* buf, int off, int len)
1985 */
1986 address TemplateInterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) {
1987
1988 if (UseCRC32Intrinsics) {
1989 uint64_t entry_off = __ offset();
1990 Label slow_path;
1991
1992 // If we need a safepoint check, generate full interpreter entry.
1993 __ generate_safepoint_check(slow_path, Z_R1, false);
1994
1995 // We don't generate local frame and don't align stack because
1996 // we call stub code and there is no safepoint on this path.
1997
1998 // Load parameters.
1999 // Z_esp is callers operand stack pointer, i.e. it points to the parameters.
2000 const Register argP = Z_esp;
2001 const Register crc = Z_ARG1; // crc value
2002 const Register data = Z_ARG2; // address of java byte array
2003 const Register dataLen = Z_ARG3; // source data len
2004 const Register table = Z_ARG4; // address of crc32 table
2005 const Register t0 = Z_R10; // work reg for kernel* emitters
2006 const Register t1 = Z_R11; // work reg for kernel* emitters
2007 const Register t2 = Z_R12; // work reg for kernel* emitters
2008 const Register t3 = Z_R13; // work reg for kernel* emitters
2009
2010 // Arguments are reversed on java expression stack.
2011 // Calculate address of start element.
2012 if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) { // Used for "updateByteBuffer direct".
2013 // crc @ (SP + 5W) (32bit)
|
1616 // synchronization is progress, and escapes.
1617
1618 __ set_thread_state(_thread_in_native_trans);
1619 if (UseMembar) {
1620 __ z_fence();
1621 } else {
1622 // Write serialization page so VM thread can do a pseudo remote
1623 // membar. We use the current thread pointer to calculate a thread
1624 // specific offset to write to within the page. This minimizes bus
1625 // traffic due to cache line collision.
1626 __ serialize_memory(Z_thread, Z_R1, Z_R0);
1627 }
1628 // Now before we return to java we must look for a current safepoint
1629 // (a new safepoint can not start since we entered native_trans).
1630 // We must check here because a current safepoint could be modifying
1631 // the callers registers right this moment.
1632
1633 // Check for safepoint operation in progress and/or pending suspend requests.
1634 {
1635 Label Continue, do_safepoint;
1636 __ safepoint_poll(do_safepoint, Z_R1);
1637 // Check for suspend.
1638 __ load_and_test_int(Z_R0/*suspend_flags*/, thread_(suspend_flags));
1639 __ z_bre(Continue); // 0 -> no flag set -> not suspended
1640 __ bind(do_safepoint);
1641 __ z_lgr(Z_ARG1, Z_thread);
1642 __ call_c(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans));
1643 __ bind(Continue);
1644 }
1645
1646 //=============================================================================
1647 // Back in Interpreter Frame.
1648
1649 // We are in thread_in_native_trans here and back in the normal
1650 // interpreter frame. We don't have to do anything special about
1651 // safepoints and we can switch to Java mode anytime we are ready.
1652
1653 // Note: frame::interpreter_frame_result has a dependency on how the
1654 // method result is saved across the call to post_method_exit. For
1655 // native methods it assumes that the non-FPU/non-void result is
1656 // saved in z_ijava_state.lresult and a FPU result in z_ijava_state.fresult. If
1920 generate_counter_overflow(Lcontinue);
1921 }
1922
1923 BLOCK_COMMENT("} normal_entry");
1924
1925 return entry_point;
1926 }
1927
1928
1929 /**
1930 * Method entry for static native methods:
1931 * int java.util.zip.CRC32.update(int crc, int b)
1932 */
1933 address TemplateInterpreterGenerator::generate_CRC32_update_entry() {
1934
1935 if (UseCRC32Intrinsics) {
1936 uint64_t entry_off = __ offset();
1937 Label slow_path;
1938
1939 // If we need a safepoint check, generate full interpreter entry.
1940 __ safepoint_poll(slow_path, Z_R1);
1941
1942 BLOCK_COMMENT("CRC32_update {");
1943
1944 // We don't generate local frame and don't align stack because
1945 // we not even call stub code (we generate the code inline)
1946 // and there is no safepoint on this path.
1947
1948 // Load java parameters.
1949 // Z_esp is callers operand stack pointer, i.e. it points to the parameters.
1950 const Register argP = Z_esp;
1951 const Register crc = Z_ARG1; // crc value
1952 const Register data = Z_ARG2; // address of java byte value (kernel_crc32 needs address)
1953 const Register dataLen = Z_ARG3; // source data len (1 byte). Not used because calling the single-byte emitter.
1954 const Register table = Z_ARG4; // address of crc32 table
1955
1956 // Arguments are reversed on java expression stack.
1957 __ z_la(data, 3+1*wordSize, argP); // byte value (stack address).
1958 // Being passed as an int, the single byte is at offset +3.
1959 __ z_llgf(crc, 2 * wordSize, argP); // Current crc state, zero extend to 64 bit to have a clean register.
1960
1973 __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native), Z_R1);
1974 return __ addr_at(entry_off);
1975 }
1976
1977 return NULL;
1978 }
1979
1980
1981 /**
1982 * Method entry for static native methods:
1983 * int java.util.zip.CRC32.updateBytes( int crc, byte[] b, int off, int len)
1984 * int java.util.zip.CRC32.updateByteBuffer(int crc, long* buf, int off, int len)
1985 */
1986 address TemplateInterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) {
1987
1988 if (UseCRC32Intrinsics) {
1989 uint64_t entry_off = __ offset();
1990 Label slow_path;
1991
1992 // If we need a safepoint check, generate full interpreter entry.
1993 __ safepoint_poll(slow_path, Z_R1);
1994
1995 // We don't generate local frame and don't align stack because
1996 // we call stub code and there is no safepoint on this path.
1997
1998 // Load parameters.
1999 // Z_esp is callers operand stack pointer, i.e. it points to the parameters.
2000 const Register argP = Z_esp;
2001 const Register crc = Z_ARG1; // crc value
2002 const Register data = Z_ARG2; // address of java byte array
2003 const Register dataLen = Z_ARG3; // source data len
2004 const Register table = Z_ARG4; // address of crc32 table
2005 const Register t0 = Z_R10; // work reg for kernel* emitters
2006 const Register t1 = Z_R11; // work reg for kernel* emitters
2007 const Register t2 = Z_R12; // work reg for kernel* emitters
2008 const Register t3 = Z_R13; // work reg for kernel* emitters
2009
2010 // Arguments are reversed on java expression stack.
2011 // Calculate address of start element.
2012 if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) { // Used for "updateByteBuffer direct".
2013 // crc @ (SP + 5W) (32bit)
|