/* * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
class StubGenerator: public StubCodeGenerator { private:
// Call stubs are used to call Java from C.
address generate_call_stub(address& return_address);
// Return point for a Java call if there's an exception thrown in // Java code. The exception is caught and transformed into a // pending exception stored in JavaThread that can be tested from // within the VM. // // Note: Usually the parameters are removed by the callee. In case // of an exception crossing an activation frame boundary, that is // not the case if the callee is compiled code => need to setup the // rsp. // // rax: exception oop
address generate_catch_exception();
// Continuation point for runtime calls returning with a pending // exception. The pending exception check happened in the runtime // or native call stub. The pending exception in Thread is // converted into a Java-level exception. // // Contract with Java-level exception handlers: // rax: exception // rdx: throwing pc // // NOTE: At entry of this stub, exception-pc must be on stack !!
address generate_forward_exception();
// Support for intptr_t OrderAccess::fence()
address generate_orderaccess_fence();
// Support for intptr_t get_previous_sp() // // This routine is used to find the previous stack pointer for the // caller.
address generate_get_previous_sp();
//---------------------------------------------------------------------------------------------------- // Support for void verify_mxcsr() // // This routine is used with -Xcheck:jni to verify that native // JNI code does not return to Java code without restoring the // MXCSR register to our expected state.
// Non-destructive plausibility checks for oops
address generate_verify_oop();
// Verify that a register contains clean 32-bits positive value // (high 32-bits are 0) so it could be used in 64-bits shifts. void assert_clean_int(Register Rint, Register Rtmp);
// Generate overlap test for array copy stubs void array_overlap_test(address no_overlap_target, Label* NOLp, Address::ScaleFactor sf);
// Shuffle first three arg regs on Windows into Linux/Solaris locations. void setup_arg_regs(int nargs = 3); void restore_arg_regs();
#ifdef ASSERT bool _regs_in_thread; #endif
// This is used in places where r10 is a scratch register, and can // be adapted if r9 is needed also. void setup_arg_regs_using_thread();
void restore_arg_regs_using_thread();
// Copy big chunks forward void copy_bytes_forward(Register end_from, Register end_to, Register qword_count, Register to,
Label& L_copy_bytes, Label& L_copy_8_bytes);
// Copy big chunks backward void copy_bytes_backward(Register from, Register dest, Register qword_count, Register to,
Label& L_copy_bytes, Label& L_copy_8_bytes);
void setup_argument_regs(BasicType type);
void restore_argument_regs(BasicType type);
#if COMPILER2_OR_JVMCI // Following rules apply to AVX3 optimized arraycopy stubs: // - If target supports AVX3 features (BW+VL+F) then implementation uses 32 byte vectors (YMMs) // for both special cases (various small block sizes) and aligned copy loop. This is the // default configuration. // - If copy length is above AVX3Threshold, then implementation use 64 byte vectors (ZMMs) // for main copy loop (and subsequent tail) since bulk of the cycles will be consumed in it. // - If user forces MaxVectorSize=32 then above 4096 bytes its seen that REP MOVs shows a // better performance for disjoint copies. For conjoint/backward copy vector based // copy performs better. // - If user sets AVX3Threshold=0, then special cases for small blocks sizes operate over // 64 byte vector registers (ZMMs).
// Generate 'unsafe' array copy stub // Though just as safe as the other stubs, it takes an unscaled // size_t argument instead of an element count. // // Examines the alignment of the operands and dispatches // to a long, int, short, or byte copy loop.
address generate_unsafe_copy(constchar *name,
address byte_copy_entry, address short_copy_entry,
address int_copy_entry, address long_copy_entry);
// Perform range checks on the proposed arraycopy. // Kills temp, but nothing else. // Also, clean the sign bits of src_pos and dst_pos. void arraycopy_range_checks(Register src, // source array oop (c_rarg0) Register src_pos, // source position (c_rarg1) Register dst, // destination array oo (c_rarg2) Register dst_pos, // destination position (c_rarg3) Register length, Register temp,
Label& L_failed);
// ofs and limit are use for multi-block byte array. // int com.sun.security.provider.MD5.implCompress(byte[] b, int ofs)
address generate_md5_implCompress(bool multi_block, constchar *name);
// SHA stubs
// ofs and limit are use for multi-block byte array. // int com.sun.security.provider.DigestBase.implCompressMultiBlock(byte[] b, int ofs, int limit)
address generate_sha1_implCompress(bool multi_block, constchar *name);
// ofs and limit are use for multi-block byte array. // int com.sun.security.provider.DigestBase.implCompressMultiBlock(byte[] b, int ofs, int limit)
address generate_sha256_implCompress(bool multi_block, constchar *name);
address generate_sha512_implCompress(bool multi_block, constchar *name);
// Mask for byte-swapping a couple of qwords in an XMM register using (v)pshufb.
address generate_pshuffle_byte_flip_mask_sha512();
// A version of CBC/AES Decrypt which does 4 blocks in a loop at a time // to hide instruction latency
address generate_cipherBlockChaining_decryptAESCrypt_Parallel();
// This is a version of CTR/AES crypt which does 6 blocks in a loop at a time // to hide instruction latency
address generate_counterMode_AESCrypt_Parallel();
// Utility routine for loading a 128-bit key word in little endian format // can optionally specify that the shuffle mask is already in an xmmregister void load_key(XMMRegister xmmdst, Register key, int offset, XMMRegister xmm_shuf_mask); void load_key(XMMRegister xmmdst, Register key, int offset, Register rscratch);
// Utility routine for increase 128bit counter (iv in CTR mode) void inc_counter(Register reg, XMMRegister xmmdst, int inc_delta, Label& next_block);
// Used by GHASH and AES stubs.
address ghash_polynomial_addr();
address ghash_shufflemask_addr();
address ghash_long_swap_mask_addr(); // byte swap x86 long
address ghash_byte_swap_mask_addr(); // byte swap x86 byte array
// Single and multi-block ghash operations
address generate_ghash_processBlocks();
// Ghash single and multi block operations using AVX instructions
address generate_avx_ghash_processBlocks();
// Code for generating Base64 encoding. // Intrinsic function prototype in Base64.java: // private void encodeBlock(byte[] src, int sp, int sl, byte[] dst, int dp, boolean isURL)
address generate_base64_encodeBlock();
// Code for generating Base64 decoding. // // Based on the article (and associated code) from https://arxiv.org/abs/1910.05109. // // Intrinsic function prototype in Base64.java: // private void decodeBlock(byte[] src, int sp, int sl, byte[] dst, int dp, boolean isURL, isMIME);
address generate_base64_decodeBlock();
// TODO: will probably need multiple return barriers depending on return type
address generate_cont_returnBarrier();
address generate_cont_returnBarrier_exception();
#if INCLUDE_JFR
// For c2: c_rarg0 is junk, call to runtime to write a checkpoint. // It returns a jobject handle to the event writer. // The handle is dereferenced and the return value is the event writer oop.
RuntimeStub* generate_jfr_write_checkpoint();
#endif// INCLUDE_JFR
// Continuation point for throwing of implicit exceptions that are // not handled in the current activation. Fabricates an exception // oop and initiates normal exception dispatching in this // frame. Since we need to preserve callee-saved values (currently // only for C2, but done for C1 as well) we need a callee-saved oop // map and therefore have to make these stubs into RuntimeStubs // rather than BufferBlobs. If the compiler needs all registers to // be preserved between the fault point and the exception handler // then it must assume responsibility for that in // AbstractCompiler::continuation_for_implicit_null_exception or // continuation_for_implicit_division_by_zero_exception. All other // implicit exceptions (e.g., NullPointerException or // AbstractMethodError on entry) are either at call sites or // otherwise assume that stack unwinding will be initiated, so // caller saved registers were assumed volatile in the compiler.
address generate_throw_exception(constchar* name,
address runtime_entry, Register arg1 = noreg, Register arg2 = noreg);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.