mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-14 18:03:44 +00:00
8363837: Make StubRoutines::crc_table_adr() into platform-specific method
Reviewed-by: adinn, yzheng
This commit is contained in:
parent
9e209fef86
commit
89fe586edd
@ -11680,8 +11680,6 @@ class StubGenerator: public StubCodeGenerator {
|
||||
}
|
||||
|
||||
if (UseCRC32Intrinsics) {
|
||||
// set table address before stub generation which use it
|
||||
StubRoutines::_crc_table_adr = (address)StubRoutines::aarch64::_crc_table;
|
||||
StubRoutines::_updateBytesCRC32 = generate_updateBytesCRC32();
|
||||
}
|
||||
|
||||
|
||||
@ -71,6 +71,10 @@ ATTRIBUTE_ALIGNED(64) uint32_t StubRoutines::aarch64::_dilithiumConsts[] =
|
||||
/**
|
||||
* crc_table[] from jdk/src/share/native/java/util/zip/zlib-1.2.5/crc32.h
|
||||
*/
|
||||
|
||||
address StubRoutines::crc_table_addr() { return (address)StubRoutines::aarch64::_crc_table; }
|
||||
address StubRoutines::crc32c_table_addr() { ShouldNotCallThis(); return nullptr; }
|
||||
|
||||
ATTRIBUTE_ALIGNED(4096) juint StubRoutines::aarch64::_crc_table[] =
|
||||
{
|
||||
// Table 0
|
||||
|
||||
@ -47,6 +47,7 @@ enum platform_dependent_constants {
|
||||
|
||||
class aarch64 {
|
||||
friend class StubGenerator;
|
||||
friend class StubRoutines;
|
||||
#if INCLUDE_JVMCI
|
||||
friend class JVMCIVMStructs;
|
||||
#endif
|
||||
|
||||
@ -36,3 +36,6 @@ STUBGEN_ARCH_ENTRIES_DO(DEFINE_ARCH_ENTRY, DEFINE_ARCH_ENTRY_INIT)
|
||||
|
||||
#undef DEFINE_ARCH_ENTRY_INIT
|
||||
#undef DEFINE_ARCH_ENTRY
|
||||
|
||||
address StubRoutines::crc_table_addr() { ShouldNotCallThis(); return nullptr; }
|
||||
address StubRoutines::crc32c_table_addr() { ShouldNotCallThis(); return nullptr; }
|
||||
|
||||
@ -4982,13 +4982,11 @@ void generate_lookup_secondary_supers_table_stub() {
|
||||
|
||||
// CRC32 Intrinsics.
|
||||
if (UseCRC32Intrinsics) {
|
||||
StubRoutines::_crc_table_adr = StubRoutines::ppc::generate_crc_constants(REVERSE_CRC32_POLY);
|
||||
StubRoutines::_updateBytesCRC32 = generate_CRC32_updateBytes(StubId::stubgen_updateBytesCRC32_id);
|
||||
}
|
||||
|
||||
// CRC32C Intrinsics.
|
||||
if (UseCRC32CIntrinsics) {
|
||||
StubRoutines::_crc32c_table_addr = StubRoutines::ppc::generate_crc_constants(REVERSE_CRC32C_POLY);
|
||||
StubRoutines::_updateBytesCRC32C = generate_CRC32_updateBytes(StubId::stubgen_updateBytesCRC32C_id);
|
||||
}
|
||||
|
||||
|
||||
@ -54,6 +54,7 @@ enum platform_dependent_constants {
|
||||
|
||||
class ppc {
|
||||
friend class StubGenerator;
|
||||
friend class StubRoutines;
|
||||
|
||||
private:
|
||||
public:
|
||||
|
||||
@ -74,6 +74,22 @@ static julong compute_inverse_poly(julong long_poly) {
|
||||
return div;
|
||||
}
|
||||
|
||||
static address _crc_table_addr = nullptr;
|
||||
static address _crc32c_table_addr = nullptr;
|
||||
|
||||
address StubRoutines::crc_table_addr() {
|
||||
if (_crc_table_addr == nullptr) {
|
||||
_crc_table_addr = StubRoutines::ppc::generate_crc_constants(REVERSE_CRC32_POLY);
|
||||
}
|
||||
return _crc_table_addr;
|
||||
}
|
||||
address StubRoutines::crc32c_table_addr() {
|
||||
if (_crc32c_table_addr == nullptr) {
|
||||
_crc32c_table_addr = StubRoutines::ppc::generate_crc_constants(REVERSE_CRC32C_POLY);
|
||||
}
|
||||
return _crc32c_table_addr;
|
||||
}
|
||||
|
||||
// Constants to fold n words as needed by macroAssembler.
|
||||
address StubRoutines::ppc::generate_crc_constants(juint reverse_poly) {
|
||||
// Layout of constant table:
|
||||
|
||||
@ -6686,8 +6686,6 @@ static const int64_t right_3_bits = right_n_bits(3);
|
||||
StubRoutines::_catch_exception_entry = generate_catch_exception();
|
||||
|
||||
if (UseCRC32Intrinsics) {
|
||||
// set table address before stub generation which use it
|
||||
StubRoutines::_crc_table_adr = (address)StubRoutines::riscv::_crc_table;
|
||||
StubRoutines::_updateBytesCRC32 = generate_updateBytesCRC32();
|
||||
}
|
||||
|
||||
|
||||
@ -52,6 +52,10 @@ bool StubRoutines::riscv::_completed = false;
|
||||
/**
|
||||
* crc_table[] from jdk/src/java.base/share/native/libzip/zlib/crc32.h
|
||||
*/
|
||||
|
||||
address StubRoutines::crc_table_addr() { return (address)StubRoutines::riscv::_crc_table; }
|
||||
address StubRoutines::crc32c_table_addr() { ShouldNotCallThis(); return nullptr; }
|
||||
|
||||
ATTRIBUTE_ALIGNED(4096) juint StubRoutines::riscv::_crc_table[] =
|
||||
{
|
||||
// Table 0
|
||||
|
||||
@ -48,6 +48,7 @@ enum platform_dependent_constants {
|
||||
|
||||
class riscv {
|
||||
friend class StubGenerator;
|
||||
friend class StubRoutines;
|
||||
#if INCLUDE_JVMCI
|
||||
friend class JVMCIVMStructs;
|
||||
#endif
|
||||
|
||||
@ -3308,12 +3308,10 @@ class StubGenerator: public StubCodeGenerator {
|
||||
}
|
||||
|
||||
if (UseCRC32Intrinsics) {
|
||||
StubRoutines::_crc_table_adr = (address)StubRoutines::zarch::_crc_table;
|
||||
StubRoutines::_updateBytesCRC32 = generate_CRC32_updateBytes();
|
||||
}
|
||||
|
||||
if (UseCRC32CIntrinsics) {
|
||||
StubRoutines::_crc32c_table_addr = (address)StubRoutines::zarch::_crc32c_table;
|
||||
StubRoutines::_updateBytesCRC32C = generate_CRC32C_updateBytes();
|
||||
}
|
||||
|
||||
|
||||
@ -78,14 +78,17 @@ void StubRoutines::zarch::generate_load_absolute_address(MacroAssembler* masm, R
|
||||
#endif
|
||||
}
|
||||
|
||||
address StubRoutines::crc_table_addr() { return (address)StubRoutines::zarch::_crc_table; }
|
||||
address StubRoutines::crc32c_table_addr() { return (address)StubRoutines::zarch::_crc32c_table; }
|
||||
|
||||
void StubRoutines::zarch::generate_load_crc_table_addr(MacroAssembler* masm, Register table) {
|
||||
const uint64_t table_contents = 0x77073096UL; // required contents of table[1]
|
||||
generate_load_absolute_address(masm, table, StubRoutines::_crc_table_adr, table_contents);
|
||||
generate_load_absolute_address(masm, table, StubRoutines::crc_table_addr(), table_contents);
|
||||
}
|
||||
|
||||
void StubRoutines::zarch::generate_load_crc32c_table_addr(MacroAssembler* masm, Register table) {
|
||||
const uint64_t table_contents = 0xf26b8303UL; // required contents of table[1]
|
||||
generate_load_absolute_address(masm, table, StubRoutines::_crc32c_table_addr, table_contents);
|
||||
generate_load_absolute_address(masm, table, StubRoutines::crc32c_table_addr(), table_contents);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -62,6 +62,7 @@ enum method_handles_platform_dependent_constants {
|
||||
|
||||
class zarch {
|
||||
friend class StubGenerator;
|
||||
friend class StubRoutines;
|
||||
|
||||
public:
|
||||
enum { nof_instance_allocators = 10 };
|
||||
|
||||
@ -4095,15 +4095,11 @@ void StubGenerator::generate_initial_stubs() {
|
||||
StubRoutines::x86::_double_sign_flip = generate_fp_mask(StubId::stubgen_double_sign_flip_id, 0x8000000000000000);
|
||||
|
||||
if (UseCRC32Intrinsics) {
|
||||
// set table address before stub generation which use it
|
||||
StubRoutines::_crc_table_adr = (address)StubRoutines::x86::_crc_table;
|
||||
StubRoutines::_updateBytesCRC32 = generate_updateBytesCRC32();
|
||||
}
|
||||
|
||||
if (UseCRC32CIntrinsics) {
|
||||
bool supports_clmul = VM_Version::supports_clmul();
|
||||
StubRoutines::x86::generate_CRC32C_table(supports_clmul);
|
||||
StubRoutines::_crc32c_table_addr = (address)StubRoutines::x86::_crc32c_table;
|
||||
StubRoutines::_updateBytesCRC32C = generate_updateBytesCRC32C(supports_clmul);
|
||||
}
|
||||
|
||||
|
||||
@ -45,6 +45,17 @@ STUBGEN_ARCH_ENTRIES_DO(DEFINE_ARCH_ENTRY, DEFINE_ARCH_ENTRY_INIT)
|
||||
#undef DEFINE_ARCH_ENTRY_INIT
|
||||
#undef DEFINE_ARCH_ENTRY
|
||||
|
||||
address StubRoutines::crc_table_addr() {
|
||||
return (address)StubRoutines::x86::_crc_table;
|
||||
}
|
||||
address StubRoutines::crc32c_table_addr() {
|
||||
if (StubRoutines::x86::_crc32c_table == nullptr) {
|
||||
bool supports_clmul = VM_Version::supports_clmul();
|
||||
StubRoutines::x86::generate_CRC32C_table(supports_clmul);
|
||||
}
|
||||
return (address)StubRoutines::x86::_crc32c_table;
|
||||
}
|
||||
|
||||
address StubRoutines::x86::_k256_adr = nullptr;
|
||||
address StubRoutines::x86::_k256_W_adr = nullptr;
|
||||
address StubRoutines::x86::_k512_W_addr = nullptr;
|
||||
@ -291,7 +302,7 @@ static uint32_t crc32c_f_pow_n(uint32_t n) {
|
||||
return result;
|
||||
}
|
||||
|
||||
juint *StubRoutines::x86::_crc32c_table;
|
||||
juint* StubRoutines::x86::_crc32c_table = nullptr;
|
||||
|
||||
void StubRoutines::x86::generate_CRC32C_table(bool is_pclmulqdq_table_supported) {
|
||||
|
||||
|
||||
@ -44,6 +44,7 @@ enum platform_dependent_constants {
|
||||
|
||||
class x86 {
|
||||
friend class StubGenerator;
|
||||
friend class StubRoutines;
|
||||
friend class VMStructs;
|
||||
|
||||
// declare fields for arch-specific entries
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
do_arch_blob, \
|
||||
do_arch_entry, \
|
||||
do_arch_entry_init) \
|
||||
do_arch_blob(initial, 0) \
|
||||
do_arch_blob(initial, 32) \
|
||||
|
||||
|
||||
#define STUBGEN_CONTINUATION_BLOBS_ARCH_DO(do_stub, \
|
||||
@ -58,7 +58,7 @@
|
||||
do_arch_blob, \
|
||||
do_arch_entry, \
|
||||
do_arch_entry_init) \
|
||||
do_arch_blob(final, 0) \
|
||||
do_arch_blob(final, 32) \
|
||||
|
||||
|
||||
#endif // CPU_ZERO_STUBDECLARATIONS_HPP
|
||||
|
||||
@ -28,4 +28,5 @@
|
||||
#include "runtime/javaThread.hpp"
|
||||
#include "runtime/stubRoutines.hpp"
|
||||
|
||||
// zero has no arch-specific stubs nor any associated entries
|
||||
address StubRoutines::crc_table_addr() { ShouldNotCallThis(); return nullptr; }
|
||||
address StubRoutines::crc32c_table_addr() { ShouldNotCallThis(); return nullptr; }
|
||||
|
||||
@ -131,6 +131,8 @@ class CompilerToVM {
|
||||
static address dlog10;
|
||||
static address dpow;
|
||||
|
||||
static address crc_table_addr;
|
||||
|
||||
static address symbol_init;
|
||||
static address symbol_clinit;
|
||||
|
||||
|
||||
@ -151,6 +151,8 @@ address CompilerToVM::Data::dlog;
|
||||
address CompilerToVM::Data::dlog10;
|
||||
address CompilerToVM::Data::dpow;
|
||||
|
||||
address CompilerToVM::Data::crc_table_addr;
|
||||
|
||||
address CompilerToVM::Data::symbol_init;
|
||||
address CompilerToVM::Data::symbol_clinit;
|
||||
|
||||
@ -289,6 +291,7 @@ void CompilerToVM::Data::initialize(JVMCI_TRAPS) {
|
||||
|
||||
SET_TRIGFUNC_OR_NULL(dtanh);
|
||||
SET_TRIGFUNC_OR_NULL(dcbrt);
|
||||
SET_TRIGFUNC_OR_NULL(crc_table_addr);
|
||||
|
||||
#undef SET_TRIGFUNC_OR_NULL
|
||||
|
||||
|
||||
@ -147,6 +147,7 @@
|
||||
static_field(CompilerToVM::Data, dlog, address) \
|
||||
static_field(CompilerToVM::Data, dlog10, address) \
|
||||
static_field(CompilerToVM::Data, dpow, address) \
|
||||
static_field(CompilerToVM::Data, crc_table_addr, address) \
|
||||
\
|
||||
static_field(CompilerToVM::Data, symbol_init, address) \
|
||||
static_field(CompilerToVM::Data, symbol_clinit, address) \
|
||||
@ -417,8 +418,6 @@
|
||||
static_field(StubRoutines, _dilithiumMontMulByConstant, address) \
|
||||
static_field(StubRoutines, _dilithiumDecomposePoly, address) \
|
||||
static_field(StubRoutines, _updateBytesCRC32, address) \
|
||||
static_field(StubRoutines, _crc_table_adr, address) \
|
||||
static_field(StubRoutines, _crc32c_table_addr, address) \
|
||||
static_field(StubRoutines, _updateBytesCRC32C, address) \
|
||||
static_field(StubRoutines, _updateBytesAdler32, address) \
|
||||
static_field(StubRoutines, _multiplyToLen, address) \
|
||||
|
||||
@ -631,7 +631,7 @@
|
||||
do_arch_entry, do_arch_entry_init) \
|
||||
end_blob(preuniverse) \
|
||||
|
||||
#define STUBGEN_INITIAL_BLOBS_DO(do_blob, end_blob, \
|
||||
#define STUBGEN_INITIAL_BLOBS_DO(do_blob, end_blob, \
|
||||
do_stub, \
|
||||
do_entry, do_entry_init, \
|
||||
do_entry_array, \
|
||||
@ -651,12 +651,9 @@
|
||||
do_stub(initial, updateBytesCRC32) \
|
||||
do_entry(initial, updateBytesCRC32, updateBytesCRC32, \
|
||||
updateBytesCRC32) \
|
||||
do_entry(initial, updateBytesCRC32, crc_table_adr, crc_table_addr) \
|
||||
do_stub(initial, updateBytesCRC32C) \
|
||||
do_entry(initial, updateBytesCRC32C, updateBytesCRC32C, \
|
||||
updateBytesCRC32C) \
|
||||
do_entry(initial, updateBytesCRC32C, crc32c_table_addr, \
|
||||
crc32c_table_addr) \
|
||||
do_stub(initial, f2hf) \
|
||||
do_entry(initial, f2hf, f2hf, f2hf_adr) \
|
||||
do_stub(initial, hf2f) \
|
||||
|
||||
@ -144,8 +144,8 @@ static BufferBlob* initialize_stubs(BlobId blob_id,
|
||||
if (lt.is_enabled()) {
|
||||
LogStream ls(lt);
|
||||
ls.print_cr("%s\t not generated", buffer_name);
|
||||
return nullptr;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
TraceTime timer(timer_msg, TRACETIME_LOG(Info, startuptime));
|
||||
// Add extra space for large CodeEntryAlignment
|
||||
|
||||
@ -304,6 +304,12 @@ public:
|
||||
return dest_uninitialized ? _arrayof_oop_disjoint_arraycopy_uninit : _arrayof_oop_disjoint_arraycopy;
|
||||
}
|
||||
|
||||
// These methods is implemented in architecture-specific code.
|
||||
// Any table that is returned must be allocated once-only in
|
||||
// foreign memory (or C heap) rather generated in the code cache.
|
||||
static address crc_table_addr();
|
||||
static address crc32c_table_addr();
|
||||
|
||||
typedef void (*DataCacheWritebackStub)(void *);
|
||||
static DataCacheWritebackStub DataCacheWriteback_stub() { return CAST_TO_FN_PTR(DataCacheWritebackStub, _data_cache_writeback); }
|
||||
typedef void (*DataCacheWritebackSyncStub)(bool);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user