8314694: Separate checked_cast from globalDefinitions.hpp

Reviewed-by: stuefe, coleenp, sspitsyn
This commit is contained in:
Kim Barrett 2023-08-23 22:32:37 +00:00
parent 68815d54c1
commit c077be4768
83 changed files with 140 additions and 25 deletions

View file

@ -28,6 +28,7 @@
#include "asm/register.hpp" #include "asm/register.hpp"
#include "metaprogramming/enableIf.hpp" #include "metaprogramming/enableIf.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
#include "utilities/globalDefinitions.hpp" #include "utilities/globalDefinitions.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"

View file

@ -27,6 +27,7 @@
#define CPU_AARCH64_REGISTER_AARCH64_HPP #define CPU_AARCH64_REGISTER_AARCH64_HPP
#include "asm/register.hpp" #include "asm/register.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/powerOfTwo.hpp" #include "utilities/powerOfTwo.hpp"
class VMRegImpl; class VMRegImpl;

View file

@ -51,6 +51,7 @@
#include "runtime/stubCodeGenerator.hpp" #include "runtime/stubCodeGenerator.hpp"
#include "runtime/stubRoutines.hpp" #include "runtime/stubRoutines.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/globalDefinitions.hpp" #include "utilities/globalDefinitions.hpp"
#include "utilities/powerOfTwo.hpp" #include "utilities/powerOfTwo.hpp"
#ifdef COMPILER2 #ifdef COMPILER2

View file

@ -53,6 +53,7 @@
#include "runtime/synchronizer.hpp" #include "runtime/synchronizer.hpp"
#include "runtime/timer.hpp" #include "runtime/timer.hpp"
#include "runtime/vframeArray.hpp" #include "runtime/vframeArray.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
#include "utilities/powerOfTwo.hpp" #include "utilities/powerOfTwo.hpp"
#include <sys/types.h> #include <sys/types.h>

View file

@ -28,6 +28,7 @@
#include <cstdint> #include <cstdint>
#include "asm/register.hpp" #include "asm/register.hpp"
#include "utilities/checkedCast.hpp"
// keep in sync with jdk/internal/foreign/abi/ppc64/PPC64Architecture // keep in sync with jdk/internal/foreign/abi/ppc64/PPC64Architecture
enum class StorageType : int8_t { enum class StorageType : int8_t {

View file

@ -27,6 +27,7 @@
#define CPU_RISCV_REGISTER_RISCV_HPP #define CPU_RISCV_REGISTER_RISCV_HPP
#include "asm/register.hpp" #include "asm/register.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/powerOfTwo.hpp" #include "utilities/powerOfTwo.hpp"
#define CSR_FFLAGS 0x001 // Floating-Point Accrued Exceptions. #define CSR_FFLAGS 0x001 // Floating-Point Accrued Exceptions.

View file

@ -53,6 +53,7 @@
#include "runtime/synchronizer.hpp" #include "runtime/synchronizer.hpp"
#include "runtime/timer.hpp" #include "runtime/timer.hpp"
#include "runtime/vframeArray.hpp" #include "runtime/vframeArray.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
#include "utilities/powerOfTwo.hpp" #include "utilities/powerOfTwo.hpp"
#include <sys/types.h> #include <sys/types.h>

View file

@ -27,6 +27,7 @@
#include <cstdint> #include <cstdint>
#include "asm/register.hpp" #include "asm/register.hpp"
#include "utilities/checkedCast.hpp"
enum class StorageType : int8_t { enum class StorageType : int8_t {
INTEGER = 0, INTEGER = 0,

View file

@ -35,6 +35,7 @@
#include "runtime/sharedRuntime.hpp" #include "runtime/sharedRuntime.hpp"
#include "runtime/stubRoutines.hpp" #include "runtime/stubRoutines.hpp"
#include "runtime/vm_version.hpp" #include "runtime/vm_version.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"
#ifdef PRODUCT #ifdef PRODUCT

View file

@ -26,6 +26,7 @@
#define CPU_X86_ASSEMBLER_X86_HPP #define CPU_X86_ASSEMBLER_X86_HPP
#include "asm/register.hpp" #include "asm/register.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/powerOfTwo.hpp" #include "utilities/powerOfTwo.hpp"
// Contains all the definitions needed for x86 assembly code generation. // Contains all the definitions needed for x86 assembly code generation.

View file

@ -37,6 +37,7 @@
#include "runtime/os.hpp" #include "runtime/os.hpp"
#include "runtime/sharedRuntime.hpp" #include "runtime/sharedRuntime.hpp"
#include "runtime/stubRoutines.hpp" #include "runtime/stubRoutines.hpp"
#include "utilities/checkedCast.hpp"
int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr, Register tmp, Label& slow_case) { int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr, Register tmp, Label& slow_case) {
const int aligned_mask = BytesPerWord -1; const int aligned_mask = BytesPerWord -1;

View file

@ -35,6 +35,7 @@
#include "opto/subnode.hpp" #include "opto/subnode.hpp"
#include "runtime/objectMonitor.hpp" #include "runtime/objectMonitor.hpp"
#include "runtime/stubRoutines.hpp" #include "runtime/stubRoutines.hpp"
#include "utilities/checkedCast.hpp"
#ifdef PRODUCT #ifdef PRODUCT
#define BLOCK_COMMENT(str) /* nothing */ #define BLOCK_COMMENT(str) /* nothing */

View file

@ -52,6 +52,7 @@
#include "runtime/safepointMechanism.hpp" #include "runtime/safepointMechanism.hpp"
#include "runtime/sharedRuntime.hpp" #include "runtime/sharedRuntime.hpp"
#include "runtime/stubRoutines.hpp" #include "runtime/stubRoutines.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"
#ifdef PRODUCT #ifdef PRODUCT

View file

@ -32,6 +32,7 @@
#include "utilities/macros.hpp" #include "utilities/macros.hpp"
#include "runtime/rtmLocking.hpp" #include "runtime/rtmLocking.hpp"
#include "runtime/vm_version.hpp" #include "runtime/vm_version.hpp"
#include "utilities/checkedCast.hpp"
// MacroAssembler extends Assembler by frequently used macros. // MacroAssembler extends Assembler by frequently used macros.
// //

View file

@ -27,6 +27,7 @@
#include "asm/register.hpp" #include "asm/register.hpp"
#include "runtime/globals.hpp" #include "runtime/globals.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/count_leading_zeros.hpp" #include "utilities/count_leading_zeros.hpp"
#include "utilities/powerOfTwo.hpp" #include "utilities/powerOfTwo.hpp"

View file

@ -33,6 +33,7 @@
#include "oops/oop.inline.hpp" #include "oops/oop.inline.hpp"
#include "runtime/safepoint.hpp" #include "runtime/safepoint.hpp"
#include "runtime/safepointMechanism.hpp" #include "runtime/safepointMechanism.hpp"
#include "utilities/checkedCast.hpp"
void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) { void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) {

View file

@ -57,6 +57,7 @@
#include "runtime/vframeArray.hpp" #include "runtime/vframeArray.hpp"
#include "runtime/vm_version.hpp" #include "runtime/vm_version.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/formatBuffer.hpp" #include "utilities/formatBuffer.hpp"
#include "vmreg_x86.inline.hpp" #include "vmreg_x86.inline.hpp"
#ifdef COMPILER1 #ifdef COMPILER1

View file

@ -51,6 +51,7 @@
#include "runtime/synchronizer.hpp" #include "runtime/synchronizer.hpp"
#include "runtime/timer.hpp" #include "runtime/timer.hpp"
#include "runtime/vframeArray.hpp" #include "runtime/vframeArray.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"

View file

@ -38,6 +38,7 @@
#include "runtime/os.inline.hpp" #include "runtime/os.inline.hpp"
#include "runtime/stubCodeGenerator.hpp" #include "runtime/stubCodeGenerator.hpp"
#include "runtime/vm_version.hpp" #include "runtime/vm_version.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/powerOfTwo.hpp" #include "utilities/powerOfTwo.hpp"
#include "utilities/virtualizationSupport.hpp" #include "utilities/virtualizationSupport.hpp"

View file

@ -29,6 +29,7 @@
#include "runtime/interfaceSupport.inline.hpp" #include "runtime/interfaceSupport.inline.hpp"
#include "runtime/os.inline.hpp" #include "runtime/os.inline.hpp"
#include "services/attachListener.hpp" #include "services/attachListener.hpp"
#include "utilities/checkedCast.hpp"
#include <signal.h> #include <signal.h>
#include <sys/socket.h> #include <sys/socket.h>

View file

@ -74,6 +74,7 @@
#include "services/runtimeService.hpp" #include "services/runtimeService.hpp"
#include "signals_posix.hpp" #include "signals_posix.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/decoder.hpp" #include "utilities/decoder.hpp"
#include "utilities/defaultStream.hpp" #include "utilities/defaultStream.hpp"
#include "utilities/events.hpp" #include "utilities/events.hpp"

View file

@ -28,6 +28,7 @@
#include "runtime/interfaceSupport.inline.hpp" #include "runtime/interfaceSupport.inline.hpp"
#include "runtime/os.inline.hpp" #include "runtime/os.inline.hpp"
#include "services/attachListener.hpp" #include "services/attachListener.hpp"
#include "utilities/checkedCast.hpp"
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>

View file

@ -29,6 +29,7 @@
#include "runtime/os.inline.hpp" #include "runtime/os.inline.hpp"
#include "os_posix.hpp" #include "os_posix.hpp"
#include "services/attachListener.hpp" #include "services/attachListener.hpp"
#include "utilities/checkedCast.hpp"
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>

View file

@ -69,6 +69,7 @@
#include "services/memTracker.hpp" #include "services/memTracker.hpp"
#include "services/runtimeService.hpp" #include "services/runtimeService.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/decoder.hpp" #include "utilities/decoder.hpp"
#include "utilities/defaultStream.hpp" #include "utilities/defaultStream.hpp"
#include "utilities/events.hpp" #include "utilities/events.hpp"

View file

@ -42,6 +42,7 @@
#include "runtime/park.hpp" #include "runtime/park.hpp"
#include "runtime/perfMemory.hpp" #include "runtime/perfMemory.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
#include "utilities/defaultStream.hpp" #include "utilities/defaultStream.hpp"
#include "utilities/events.hpp" #include "utilities/events.hpp"

View file

@ -42,6 +42,7 @@
#include "runtime/threadCrashProtection.hpp" #include "runtime/threadCrashProtection.hpp"
#include "signals_posix.hpp" #include "signals_posix.hpp"
#include "suspendResume_posix.hpp" #include "suspendResume_posix.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/events.hpp" #include "utilities/events.hpp"
#include "utilities/ostream.hpp" #include "utilities/ostream.hpp"
#include "utilities/parseInteger.hpp" #include "utilities/parseInteger.hpp"

View file

@ -32,6 +32,7 @@
#include "runtime/icache.hpp" #include "runtime/icache.hpp"
#include "runtime/javaThread.hpp" #include "runtime/javaThread.hpp"
#include "runtime/os.hpp" #include "runtime/os.hpp"
#include "utilities/checkedCast.hpp"
// Implementation of AbstractAssembler // Implementation of AbstractAssembler
// //

View file

@ -30,6 +30,7 @@
#include "code/oopRecorder.hpp" #include "code/oopRecorder.hpp"
#include "code/relocInfo.hpp" #include "code/relocInfo.hpp"
#include "memory/allocation.hpp" #include "memory/allocation.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
#include "utilities/growableArray.hpp" #include "utilities/growableArray.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"

View file

@ -45,6 +45,7 @@
#include "runtime/sharedRuntime.hpp" #include "runtime/sharedRuntime.hpp"
#include "runtime/vm_version.hpp" #include "runtime/vm_version.hpp"
#include "utilities/bitMap.inline.hpp" #include "utilities/bitMap.inline.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/powerOfTwo.hpp" #include "utilities/powerOfTwo.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"
#if INCLUDE_JFR #if INCLUDE_JFR

View file

@ -31,6 +31,7 @@
#include "oops/constantPool.hpp" #include "oops/constantPool.hpp"
#include "runtime/handles.inline.hpp" #include "runtime/handles.inline.hpp"
#include "utilities/bytes.hpp" #include "utilities/bytes.hpp"
#include "utilities/checkedCast.hpp"
u2 BytecodeConstantPool::find_or_add(BytecodeCPEntry const& bcpe, TRAPS) { u2 BytecodeConstantPool::find_or_add(BytecodeCPEntry const& bcpe, TRAPS) {

View file

@ -75,6 +75,7 @@
#include "services/threadService.hpp" #include "services/threadService.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/bitMap.inline.hpp" #include "utilities/bitMap.inline.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/copy.hpp" #include "utilities/copy.hpp"
#include "utilities/formatBuffer.hpp" #include "utilities/formatBuffer.hpp"
#include "utilities/exceptions.hpp" #include "utilities/exceptions.hpp"

View file

@ -73,6 +73,7 @@
#include "runtime/vm_version.hpp" #include "runtime/vm_version.hpp"
#include "services/management.hpp" #include "services/management.hpp"
#include "services/threadService.hpp" #include "services/threadService.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/classpathStream.hpp" #include "utilities/classpathStream.hpp"
#include "utilities/events.hpp" #include "utilities/events.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"

View file

@ -48,6 +48,7 @@
#include "runtime/handles.inline.hpp" #include "runtime/handles.inline.hpp"
#include "runtime/java.hpp" #include "runtime/java.hpp"
#include "runtime/os.hpp" #include "runtime/os.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/stringUtils.hpp" #include "utilities/stringUtils.hpp"
jshort ClassLoaderExt::_app_class_paths_start_index = ClassLoaderExt::max_classpath_index; jshort ClassLoaderExt::_app_class_paths_start_index = ClassLoaderExt::max_classpath_index;

View file

@ -26,6 +26,7 @@
#define SHARE_CLASSFILE_STACKMAPTABLEFORMAT_HPP #define SHARE_CLASSFILE_STACKMAPTABLEFORMAT_HPP
#include "classfile/verificationType.hpp" #include "classfile/verificationType.hpp"
#include "utilities/checkedCast.hpp"
// These classes represent the stack-map substructures described in the JVMS // These classes represent the stack-map substructures described in the JVMS
// (hence the non-conforming naming scheme). // (hence the non-conforming naming scheme).

View file

@ -29,6 +29,7 @@
#include "jvm_constants.h" #include "jvm_constants.h"
#include "jvm_io.h" #include "jvm_io.h"
#include "runtime/vm_version.hpp" #include "runtime/vm_version.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/tribool.hpp" #include "utilities/tribool.hpp"
#include "utilities/xmlstream.hpp" #include "utilities/xmlstream.hpp"

View file

@ -34,6 +34,7 @@
#include "runtime/flags/flagSetting.hpp" #include "runtime/flags/flagSetting.hpp"
#include "runtime/stubCodeGenerator.hpp" #include "runtime/stubCodeGenerator.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/copy.hpp" #include "utilities/copy.hpp"
#include <new> #include <new>

View file

@ -28,6 +28,7 @@
#include "memory/allocation.hpp" #include "memory/allocation.hpp"
#include "oops/oopsHierarchy.hpp" #include "oops/oopsHierarchy.hpp"
#include "runtime/osInfo.hpp" #include "runtime/osInfo.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/globalDefinitions.hpp" #include "utilities/globalDefinitions.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"

View file

@ -30,6 +30,7 @@
#include "oops/oop.inline.hpp" #include "oops/oop.inline.hpp"
#include "runtime/mutexLocker.hpp" #include "runtime/mutexLocker.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/checkedCast.hpp"
// Implementation of StubQueue // Implementation of StubQueue

View file

@ -28,6 +28,7 @@
#include "asm/register.hpp" #include "asm/register.hpp"
#include "code/vmregTypes.hpp" #include "code/vmregTypes.hpp"
#include "runtime/globals.hpp" #include "runtime/globals.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/globalDefinitions.hpp" #include "utilities/globalDefinitions.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"
#include "utilities/ostream.hpp" #include "utilities/ostream.hpp"

View file

@ -28,6 +28,7 @@
#include "asm/macroAssembler.hpp" #include "asm/macroAssembler.hpp"
#include "code/vmreg.hpp" #include "code/vmreg.hpp"
#include "memory/allStatic.hpp" #include "memory/allStatic.hpp"
#include "utilities/checkedCast.hpp"
// A VtableStub holds an individual code stub for a pair (vtable index, #args) for either itables or vtables // A VtableStub holds an individual code stub for a pair (vtable index, #args) for either itables or vtables
// There's a one-to-one relationship between a VtableStub and such a pair. // There's a one-to-one relationship between a VtableStub and such a pair.

View file

@ -30,6 +30,7 @@
#include "memory/allocation.hpp" #include "memory/allocation.hpp"
#include "memory/iterator.hpp" #include "memory/iterator.hpp"
#include "oops/oopsHierarchy.hpp" #include "oops/oopsHierarchy.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/growableArray.hpp" #include "utilities/growableArray.hpp"
// Interface for generating the frame map for compiled code. A frame map // Interface for generating the frame map for compiled code. A frame map

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,7 @@
#include "gc/g1/g1CardSetContainers.hpp" #include "gc/g1/g1CardSetContainers.hpp"
#include "gc/g1/g1GCPhaseTimes.hpp" #include "gc/g1/g1GCPhaseTimes.hpp"
#include "utilities/bitMap.inline.hpp" #include "utilities/bitMap.inline.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/globalDefinitions.hpp" #include "utilities/globalDefinitions.hpp"
#include "utilities/spinYield.hpp" #include "utilities/spinYield.hpp"

View file

@ -35,6 +35,7 @@
#include "runtime/atomic.hpp" #include "runtime/atomic.hpp"
#include "runtime/os.hpp" #include "runtime/os.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
inline uint8_t XPage::type_from_size(size_t size) const { inline uint8_t XPage::type_from_size(size_t size) const {

View file

@ -39,6 +39,7 @@
#include "runtime/atomic.hpp" #include "runtime/atomic.hpp"
#include "runtime/os.hpp" #include "runtime/os.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
inline ZPageType ZPage::type_from_size(size_t size) const { inline ZPageType ZPage::type_from_size(size_t size) const {

View file

@ -73,6 +73,7 @@
#include "runtime/synchronizer.hpp" #include "runtime/synchronizer.hpp"
#include "runtime/threadCritical.hpp" #include "runtime/threadCritical.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/copy.hpp" #include "utilities/copy.hpp"
#include "utilities/events.hpp" #include "utilities/events.hpp"
#ifdef COMPILER2 #ifdef COMPILER2

View file

@ -38,6 +38,7 @@
#include "runtime/arguments.hpp" #include "runtime/arguments.hpp"
#include "runtime/fieldDescriptor.inline.hpp" #include "runtime/fieldDescriptor.inline.hpp"
#include "runtime/handles.inline.hpp" #include "runtime/handles.inline.hpp"
#include "utilities/checkedCast.hpp"
// Computes a CPC map (new_index -> original_index) for constant pool entries // Computes a CPC map (new_index -> original_index) for constant pool entries
// that are referred to by the interpreter at runtime via the constant pool cache. // that are referred to by the interpreter at runtime via the constant pool cache.

View file

@ -34,6 +34,7 @@
#include "prims/jvmtiExport.hpp" #include "prims/jvmtiExport.hpp"
#include "runtime/safepoint.hpp" #include "runtime/safepoint.hpp"
#include "runtime/timerTrace.hpp" #include "runtime/timerTrace.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/copy.hpp" #include "utilities/copy.hpp"
# define __ _masm-> # define __ _masm->

View file

@ -29,6 +29,7 @@
#include "runtime/mutexLocker.hpp" #include "runtime/mutexLocker.hpp"
#include "services/memTracker.hpp" #include "services/memTracker.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/powerOfTwo.hpp" #include "utilities/powerOfTwo.hpp"
// Implementation of Heap // Implementation of Heap

View file

@ -32,6 +32,7 @@
#include "runtime/safepointVerifiers.hpp" #include "runtime/safepointVerifiers.hpp"
#include "runtime/signature.hpp" #include "runtime/signature.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/checkedCast.hpp"
// Static initialization // Static initialization
const u2 ConstMethod::MAX_IDNUM = 0xFFFE; const u2 ConstMethod::MAX_IDNUM = 0xFFFE;

View file

@ -28,6 +28,7 @@
#include "oops/constMethodFlags.hpp" #include "oops/constMethodFlags.hpp"
#include "oops/oop.hpp" #include "oops/oop.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/checkedCast.hpp"
// An ConstMethod represents portions of a Java method which are not written to after // An ConstMethod represents portions of a Java method which are not written to after
// the classfile is parsed(*see below). This part of the method can be shared across // the classfile is parsed(*see below). This part of the method can be shared across

View file

@ -64,6 +64,7 @@
#include "runtime/javaThread.hpp" #include "runtime/javaThread.hpp"
#include "runtime/signature.hpp" #include "runtime/signature.hpp"
#include "runtime/vframe.inline.hpp" #include "runtime/vframe.inline.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/copy.hpp" #include "utilities/copy.hpp"
ConstantPool* ConstantPool::allocate(ClassLoaderData* loader_data, int length, TRAPS) { ConstantPool* ConstantPool::allocate(ClassLoaderData* loader_data, int length, TRAPS) {

View file

@ -31,6 +31,7 @@
#include "oops/constantPool.hpp" #include "oops/constantPool.hpp"
#include "oops/symbol.hpp" #include "oops/symbol.hpp"
#include "runtime/atomic.hpp" #include "runtime/atomic.hpp"
#include "utilities/checkedCast.hpp"
inline Symbol* FieldInfo::name(ConstantPool* cp) const { inline Symbol* FieldInfo::name(ConstantPool* cp) const {
int index = _name_index; int index = _name_index;

View file

@ -43,6 +43,7 @@
#include "runtime/safepointVerifiers.hpp" #include "runtime/safepointVerifiers.hpp"
#include "runtime/signature.hpp" #include "runtime/signature.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/copy.hpp" #include "utilities/copy.hpp"
// ================================================================== // ==================================================================

View file

@ -28,6 +28,7 @@
#include "interpreter/bytecodes.hpp" #include "interpreter/bytecodes.hpp"
#include "oops/instanceKlass.hpp" #include "oops/instanceKlass.hpp"
#include "runtime/atomic.hpp" #include "runtime/atomic.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/sizes.hpp" #include "utilities/sizes.hpp"
// ResolvedFieldEntry contains the resolution information for field related bytecodes like // ResolvedFieldEntry contains the resolution information for field related bytecodes like

View file

@ -32,6 +32,7 @@
#include "opto/subnode.hpp" #include "opto/subnode.hpp"
#include "opto/type.hpp" #include "opto/type.hpp"
#include "castnode.hpp" #include "castnode.hpp"
#include "utilities/checkedCast.hpp"
//============================================================================= //=============================================================================
// If input is already higher or equal to cast type, then this is an identity. // If input is already higher or equal to cast type, then this is an identity.

View file

@ -32,6 +32,7 @@
#include "opto/phaseX.hpp" #include "opto/phaseX.hpp"
#include "opto/subnode.hpp" #include "opto/subnode.hpp"
#include "runtime/stubRoutines.hpp" #include "runtime/stubRoutines.hpp"
#include "utilities/checkedCast.hpp"
//============================================================================= //=============================================================================
//------------------------------Identity--------------------------------------- //------------------------------Identity---------------------------------------

View file

@ -47,6 +47,7 @@
#include "opto/runtime.hpp" #include "opto/runtime.hpp"
#include "opto/superword.hpp" #include "opto/superword.hpp"
#include "runtime/sharedRuntime.hpp" #include "runtime/sharedRuntime.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/powerOfTwo.hpp" #include "utilities/powerOfTwo.hpp"
//============================================================================= //=============================================================================

View file

@ -30,6 +30,7 @@
#include "opto/phaseX.hpp" #include "opto/phaseX.hpp"
#include "opto/subnode.hpp" #include "opto/subnode.hpp"
#include "opto/type.hpp" #include "opto/type.hpp"
#include "utilities/checkedCast.hpp"
class CmpNode; class CmpNode;
class BaseCountedLoopEndNode; class BaseCountedLoopEndNode;

View file

@ -39,6 +39,7 @@
#include "opto/node.hpp" #include "opto/node.hpp"
#include "opto/opcodes.hpp" #include "opto/opcodes.hpp"
#include "opto/type.hpp" #include "opto/type.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/powerOfTwo.hpp" #include "utilities/powerOfTwo.hpp"
#include "utilities/stringUtils.hpp" #include "utilities/stringUtils.hpp"

View file

@ -35,6 +35,7 @@
#include "runtime/javaThread.inline.hpp" #include "runtime/javaThread.inline.hpp"
#include "runtime/vframe.inline.hpp" #include "runtime/vframe.inline.hpp"
#include "runtime/vframeArray.hpp" #include "runtime/vframeArray.hpp"
#include "utilities/checkedCast.hpp"
// call frame copied from old .h file and renamed // call frame copied from old .h file and renamed
typedef struct { typedef struct {

View file

@ -95,6 +95,7 @@
#include "services/attachListener.hpp" #include "services/attachListener.hpp"
#include "services/management.hpp" #include "services/management.hpp"
#include "services/threadService.hpp" #include "services/threadService.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/copy.hpp" #include "utilities/copy.hpp"
#include "utilities/defaultStream.hpp" #include "utilities/defaultStream.hpp"
#include "utilities/dtrace.hpp" #include "utilities/dtrace.hpp"

View file

@ -34,6 +34,7 @@
#include "runtime/handles.inline.hpp" #include "runtime/handles.inline.hpp"
#include "runtime/signature.hpp" #include "runtime/signature.hpp"
#include "utilities/bytes.hpp" #include "utilities/bytes.hpp"
#include "utilities/checkedCast.hpp"
// FIXME: add Deprecated attribute // FIXME: add Deprecated attribute
// FIXME: fix Synthetic attribute // FIXME: fix Synthetic attribute

View file

@ -62,6 +62,7 @@
#include "runtime/relocator.hpp" #include "runtime/relocator.hpp"
#include "runtime/safepointVerifiers.hpp" #include "runtime/safepointVerifiers.hpp"
#include "utilities/bitMap.inline.hpp" #include "utilities/bitMap.inline.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/events.hpp" #include "utilities/events.hpp"
Array<Method*>* VM_RedefineClasses::_old_methods = nullptr; Array<Method*>* VM_RedefineClasses::_old_methods = nullptr;

View file

@ -31,6 +31,7 @@
#include "runtime/interfaceSupport.inline.hpp" #include "runtime/interfaceSupport.inline.hpp"
#include "runtime/javaCalls.hpp" #include "runtime/javaCalls.hpp"
#include "runtime/jniHandles.inline.hpp" #include "runtime/jniHandles.inline.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/globalDefinitions.hpp" #include "utilities/globalDefinitions.hpp"
#define FOREIGN_ABI "jdk/internal/foreign/abi/" #define FOREIGN_ABI "jdk/internal/foreign/abi/"

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,7 @@
#include <cstdint> #include <cstdint>
#include "code/vmreg.hpp" #include "code/vmreg.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
#include "utilities/ostream.hpp" #include "utilities/ostream.hpp"

View file

@ -93,6 +93,7 @@
#include "services/memoryService.hpp" #include "services/memoryService.hpp"
#include "services/memTracker.hpp" #include "services/memTracker.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
#include "utilities/elfFile.hpp" #include "utilities/elfFile.hpp"
#include "utilities/exceptions.hpp" #include "utilities/exceptions.hpp"

View file

@ -60,6 +60,7 @@
#include "services/management.hpp" #include "services/management.hpp"
#include "services/nmtCommon.hpp" #include "services/nmtCommon.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
#include "utilities/defaultStream.hpp" #include "utilities/defaultStream.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"

View file

@ -89,6 +89,7 @@
#include "runtime/vframeArray.hpp" #include "runtime/vframeArray.hpp"
#include "runtime/vframe_hp.hpp" #include "runtime/vframe_hp.hpp"
#include "runtime/vmOperations.hpp" #include "runtime/vmOperations.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/events.hpp" #include "utilities/events.hpp"
#include "utilities/growableArray.hpp" #include "utilities/growableArray.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"

View file

@ -30,6 +30,7 @@
#include "oops/oopsHierarchy.hpp" #include "oops/oopsHierarchy.hpp"
#include "runtime/basicLock.hpp" #include "runtime/basicLock.hpp"
#include "runtime/monitorChunk.hpp" #include "runtime/monitorChunk.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/growableArray.hpp" #include "utilities/growableArray.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"
#ifdef ZERO #ifdef ZERO

View file

@ -25,6 +25,8 @@
#ifndef SHARE_RUNTIME_JFIELDIDWORKAROUND_HPP #ifndef SHARE_RUNTIME_JFIELDIDWORKAROUND_HPP
#define SHARE_RUNTIME_JFIELDIDWORKAROUND_HPP #define SHARE_RUNTIME_JFIELDIDWORKAROUND_HPP
#include "utilities/checkedCast.hpp"
class jfieldIDWorkaround: AllStatic { class jfieldIDWorkaround: AllStatic {
// This workaround is because JVMTI doesn't have distinct entry points // This workaround is because JVMTI doesn't have distinct entry points
// for methods that use static jfieldIDs and instance jfieldIDs. // for methods that use static jfieldIDs and instance jfieldIDs.

View file

@ -30,6 +30,7 @@
#include "oops/markWord.hpp" #include "oops/markWord.hpp"
#include "oops/weakHandle.hpp" #include "oops/weakHandle.hpp"
#include "runtime/perfDataTypes.hpp" #include "runtime/perfDataTypes.hpp"
#include "utilities/checkedCast.hpp"
class ObjectMonitor; class ObjectMonitor;
class ParkEvent; class ParkEvent;

View file

@ -70,6 +70,7 @@
#include "services/nmtCommon.hpp" #include "services/nmtCommon.hpp"
#include "services/threadService.hpp" #include "services/threadService.hpp"
#include "utilities/align.hpp" #include "utilities/align.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/count_trailing_zeros.hpp" #include "utilities/count_trailing_zeros.hpp"
#include "utilities/defaultStream.hpp" #include "utilities/defaultStream.hpp"
#include "utilities/events.hpp" #include "utilities/events.hpp"

View file

@ -31,6 +31,7 @@
#include "oops/oop.inline.hpp" #include "oops/oop.inline.hpp"
#include "runtime/handles.inline.hpp" #include "runtime/handles.inline.hpp"
#include "runtime/relocator.hpp" #include "runtime/relocator.hpp"
#include "utilities/checkedCast.hpp"
#define MAX_METHOD_LENGTH 65535 #define MAX_METHOD_LENGTH 65535

View file

@ -31,6 +31,7 @@
#include "runtime/handles.inline.hpp" #include "runtime/handles.inline.hpp"
#include "runtime/sharedRuntime.hpp" #include "runtime/sharedRuntime.hpp"
#include "runtime/threadHeapSampler.hpp" #include "runtime/threadHeapSampler.hpp"
#include "utilities/checkedCast.hpp"
// Cheap random number generator. // Cheap random number generator.
uint64_t ThreadHeapSampler::_rnd; uint64_t ThreadHeapSampler::_rnd;

View file

@ -59,6 +59,7 @@
#include "services/heapDumper.hpp" #include "services/heapDumper.hpp"
#include "services/heapDumperCompression.hpp" #include "services/heapDumperCompression.hpp"
#include "services/threadService.hpp" #include "services/threadService.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"
#include "utilities/ostream.hpp" #include "utilities/ostream.hpp"

View file

@ -31,6 +31,7 @@
#include "runtime/atomic.hpp" #include "runtime/atomic.hpp"
#endif #endif
#include "services/memTracker.hpp" #include "services/memTracker.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
#include "utilities/globalDefinitions.hpp" #include "utilities/globalDefinitions.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"

View file

@ -26,6 +26,7 @@
#define SHARE_UTILITIES_ALIGN_HPP #define SHARE_UTILITIES_ALIGN_HPP
#include "metaprogramming/enableIf.hpp" #include "metaprogramming/enableIf.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
#include "utilities/globalDefinitions.hpp" #include "utilities/globalDefinitions.hpp"
#include "utilities/powerOfTwo.hpp" #include "utilities/powerOfTwo.hpp"

View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 2023, 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.
*
*/
#ifndef SHARE_UTILITIES_CHECKEDCAST_HPP
#define SHARE_UTILITIES_CHECKEDCAST_HPP
#include "utilities/debug.hpp"
// In many places we've added C-style casts to silence compiler
// warnings, for example when truncating a size_t to an int when we
// know the size_t is a small struct. Such casts are risky because
// they effectively disable useful compiler warnings. We can make our
// lives safer with this function, which ensures that any cast is
// reversible without loss of information. It doesn't check
// everything: it isn't intended to make sure that pointer types are
// compatible, for example.
template <typename T2, typename T1>
constexpr T2 checked_cast(T1 thing) {
T2 result = static_cast<T2>(thing);
assert(static_cast<T1>(result) == thing, "must be");
return result;
}
#endif // SHARE_UTILITIES_CHECKEDCAST_HPP

View file

@ -29,6 +29,7 @@
#include "jvm_io.h" #include "jvm_io.h"
#include "logging/log.hpp" #include "logging/log.hpp"
#include "memory/allocation.inline.hpp" #include "memory/allocation.inline.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/decoder.hpp" #include "utilities/decoder.hpp"
#include "utilities/elfFile.hpp" #include "utilities/elfFile.hpp"
#include "utilities/elfFuncDescTable.hpp" #include "utilities/elfFuncDescTable.hpp"

View file

@ -70,6 +70,7 @@ typedef Elf32_Sym Elf_Sym;
#include "jvm_md.h" #include "jvm_md.h"
#include "globalDefinitions.hpp" #include "globalDefinitions.hpp"
#include "memory/allocation.hpp" #include "memory/allocation.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/decoder.hpp" #include "utilities/decoder.hpp"
#ifdef ASSERT #ifdef ASSERT

View file

@ -27,6 +27,7 @@
#if !defined(_WINDOWS) && !defined(__APPLE__) #if !defined(_WINDOWS) && !defined(__APPLE__)
#include "memory/allocation.inline.hpp" #include "memory/allocation.inline.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/elfFuncDescTable.hpp" #include "utilities/elfFuncDescTable.hpp"
#include "utilities/elfSymbolTable.hpp" #include "utilities/elfSymbolTable.hpp"

View file

@ -475,6 +475,16 @@ inline size_t pointer_delta(const MetaWord* left, const MetaWord* right) {
return pointer_delta(left, right, sizeof(MetaWord)); return pointer_delta(left, right, sizeof(MetaWord));
} }
// pointer_delta_as_int is called to do pointer subtraction for nearby pointers that
// returns a non-negative int, usually used as a size of a code buffer range.
// This scales to sizeof(T).
template <typename T>
inline int pointer_delta_as_int(const volatile T* left, const volatile T* right) {
size_t delta = pointer_delta(left, right, sizeof(T));
assert(delta <= size_t(INT_MAX), "pointer delta out of range: %zu", delta);
return static_cast<int>(delta);
}
// //
// ANSI C++ does not allow casting from one pointer type to a function pointer // ANSI C++ does not allow casting from one pointer type to a function pointer
// directly without at best a warning. This macro accomplishes it silently // directly without at best a warning. This macro accomplishes it silently
@ -491,29 +501,6 @@ inline size_t pointer_delta(const MetaWord* left, const MetaWord* right) {
#define CAST_TO_FN_PTR(func_type, value) (reinterpret_cast<func_type>(value)) #define CAST_TO_FN_PTR(func_type, value) (reinterpret_cast<func_type>(value))
#define CAST_FROM_FN_PTR(new_type, func_ptr) ((new_type)((uintptr_t)(func_ptr))) #define CAST_FROM_FN_PTR(new_type, func_ptr) ((new_type)((uintptr_t)(func_ptr)))
// In many places we've added C-style casts to silence compiler
// warnings, for example when truncating a size_t to an int when we
// know the size_t is a small struct. Such casts are risky because
// they effectively disable useful compiler warnings. We can make our
// lives safer with this function, which ensures that any cast is
// reversible without loss of information. It doesn't check
// everything: it isn't intended to make sure that pointer types are
// compatible, for example.
template <typename T2, typename T1>
constexpr T2 checked_cast(T1 thing) {
T2 result = static_cast<T2>(thing);
assert(static_cast<T1>(result) == thing, "must be");
return result;
}
// pointer_delta_as_int is called to do pointer subtraction for nearby pointers that
// returns a non-negative int, usually used as a size of a code buffer range.
// This scales to sizeof(T).
template <typename T>
inline int pointer_delta_as_int(const volatile T* left, const volatile T* right) {
return checked_cast<int>(pointer_delta(left, right, sizeof(T)));
}
// Need the correct linkage to call qsort without warnings // Need the correct linkage to call qsort without warnings
extern "C" { extern "C" {
typedef int (*_sort_Fn)(const void *, const void *); typedef int (*_sort_Fn)(const void *, const void *);

View file

@ -26,6 +26,7 @@
#define SHARE_UTILITIES_POPULATION_COUNT_HPP #define SHARE_UTILITIES_POPULATION_COUNT_HPP
#include "metaprogramming/enableIf.hpp" #include "metaprogramming/enableIf.hpp"
#include "utilities/checkedCast.hpp"
#include "utilities/debug.hpp" #include "utilities/debug.hpp"
#include "utilities/globalDefinitions.hpp" #include "utilities/globalDefinitions.hpp"