8288623: Move Continuation classes out of javaClasses.hpp

Reviewed-by: stefank, coleenp
This commit is contained in:
Ioi Lam 2022-06-24 04:29:48 +00:00
parent c8cc94a384
commit 64782a7524
25 changed files with 617 additions and 462 deletions

View file

@ -26,76 +26,15 @@
#define SHARE_CLASSFILE_JAVACLASSES_HPP
#include "classfile/vmClasses.hpp"
#include "oops/oop.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/stackChunkOop.hpp"
#include "oops/symbol.hpp"
#include "runtime/os.hpp"
#include "oops/oopsHierarchy.hpp"
#include "runtime/handles.hpp"
#include "utilities/macros.hpp"
#include "utilities/vmEnums.hpp"
class JvmtiThreadState;
class RecordComponent;
// Interface for manipulating the basic Java classes.
#define BASIC_JAVA_CLASSES_DO_PART1(f) \
f(java_lang_Class) \
f(java_lang_String) \
f(java_lang_ref_Reference) \
//end
#define BASIC_JAVA_CLASSES_DO_PART2(f) \
f(java_lang_System) \
f(java_lang_ClassLoader) \
f(java_lang_Throwable) \
f(java_lang_Thread) \
f(java_lang_Thread_FieldHolder) \
f(java_lang_Thread_Constants) \
f(java_lang_ThreadGroup) \
f(java_lang_VirtualThread) \
f(java_lang_InternalError) \
f(java_lang_AssertionStatusDirectives) \
f(java_lang_ref_SoftReference) \
f(java_lang_invoke_MethodHandle) \
f(java_lang_invoke_DirectMethodHandle) \
f(java_lang_invoke_MemberName) \
f(java_lang_invoke_ResolvedMethodName) \
f(java_lang_invoke_LambdaForm) \
f(java_lang_invoke_MethodType) \
f(java_lang_invoke_CallSite) \
f(java_lang_invoke_ConstantCallSite) \
f(java_lang_invoke_MethodHandleNatives_CallSiteContext) \
f(java_security_AccessControlContext) \
f(java_lang_reflect_AccessibleObject) \
f(java_lang_reflect_Method) \
f(java_lang_reflect_Constructor) \
f(java_lang_reflect_Field) \
f(java_lang_reflect_RecordComponent) \
f(reflect_ConstantPool) \
f(reflect_UnsafeStaticFieldAccessorImpl) \
f(java_lang_reflect_Parameter) \
f(java_lang_Module) \
f(java_lang_StackTraceElement) \
f(java_lang_StackFrameInfo) \
f(java_lang_LiveStackFrameInfo) \
f(jdk_internal_vm_ContinuationScope) \
f(jdk_internal_vm_Continuation) \
f(jdk_internal_vm_StackChunk) \
f(java_util_concurrent_locks_AbstractOwnableSynchronizer) \
f(jdk_internal_foreign_abi_NativeEntryPoint) \
f(jdk_internal_foreign_abi_ABIDescriptor) \
f(jdk_internal_foreign_abi_VMStorage) \
f(jdk_internal_foreign_abi_CallConv) \
f(jdk_internal_misc_UnsafeConstants) \
f(java_lang_boxing_object) \
f(vector_VectorPayload) \
//end
#define BASIC_JAVA_CLASSES_DO(f) \
BASIC_JAVA_CLASSES_DO_PART1(f) \
BASIC_JAVA_CLASSES_DO_PART2(f)
#define CHECK_INIT(offset) assert(offset != 0, "should be initialized"); return offset;
// Interface to java.lang.Object objects
@ -1078,112 +1017,6 @@ class java_lang_ref_SoftReference: public java_lang_ref_Reference {
static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
};
// Interface to jdk.internal.vm.ContinuationScope objects
class jdk_internal_vm_ContinuationScope: AllStatic {
friend class JavaClasses;
private:
static int _name_offset;
static void compute_offsets();
public:
static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
static inline oop name(oop ref);
};
// Interface to jdk.internal.vm.Continuation objects
class jdk_internal_vm_Continuation: AllStatic {
friend class JavaClasses;
private:
static int _scope_offset;
static int _target_offset;
static int _parent_offset;
static int _yieldInfo_offset;
static int _tail_offset;
static int _mounted_offset;
static int _done_offset;
static int _preempted_offset;
static void compute_offsets();
public:
static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
// Accessors
static inline oop scope(oop continuation);
static inline oop target(oop continuation);
static inline oop parent(oop continuation);
static inline oop yieldInfo(oop continuation);
static inline void set_yieldInfo(oop continuation, oop value);
static inline stackChunkOop tail(oop continuation);
static inline void set_tail(oop continuation, stackChunkOop value);
static inline bool on_local_stack(oop continuation, address adr);
static inline bool done(oop continuation);
static inline bool is_preempted(oop continuation);
static inline void set_preempted(oop continuation, bool value);
};
// Interface to jdk.internal.vm.StackChunk objects
#define STACKCHUNK_INJECTED_FIELDS(macro) \
macro(jdk_internal_vm_StackChunk, cont, continuation_signature, false) \
macro(jdk_internal_vm_StackChunk, flags, byte_signature, false) \
macro(jdk_internal_vm_StackChunk, pc, intptr_signature, false) \
macro(jdk_internal_vm_StackChunk, maxThawingSize, int_signature, false) \
class jdk_internal_vm_StackChunk: AllStatic {
friend class JavaClasses;
private:
static int _parent_offset;
static int _size_offset;
static int _sp_offset;
static int _pc_offset;
static int _argsize_offset;
static int _flags_offset;
static int _maxThawingSize_offset;
static int _cont_offset;
static void compute_offsets();
public:
static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
static inline int parent_offset() { return _parent_offset; }
static inline int cont_offset() { return _cont_offset; }
// Accessors
static inline oop parent(oop chunk);
static inline void set_parent(oop chunk, oop value);
template<typename P>
static inline bool is_parent_null(oop chunk); // bypasses barriers for a faster test
template<typename P>
static inline void set_parent_raw(oop chunk, oop value);
static inline int size(oop chunk);
static inline void set_size(HeapWord* chunk, int value);
static inline int sp(oop chunk);
static inline void set_sp(oop chunk, int value);
static inline void set_sp(HeapWord* chunk, int value); // used while allocating
static inline address pc(oop chunk);
static inline void set_pc(oop chunk, address value);
static inline int argsize(oop chunk);
static inline void set_argsize(oop chunk, int value);
static inline uint8_t flags(oop chunk);
static inline void set_flags(oop chunk, uint8_t value);
static inline uint8_t flags_acquire(oop chunk);
static inline void release_set_flags(oop chunk, uint8_t value);
static inline bool try_set_flags(oop chunk, uint8_t expected_value, uint8_t new_value);
static inline int maxThawingSize(oop chunk);
static inline void set_maxThawingSize(oop chunk, int value);
// cont oop's processing is essential for the chunk's GC protocol
static inline oop cont(oop chunk);
static inline void set_cont(oop chunk, oop value);
template<typename P>
static inline oop cont_raw(oop chunk);
template<typename P>
static inline void set_cont_raw(oop chunk, oop value);
};
// Interface to java.lang.invoke.MethodHandle objects
class java_lang_invoke_MethodHandle: AllStatic {
@ -2061,25 +1894,11 @@ class InjectedField {
}
};
#define DECLARE_INJECTED_FIELD_ENUM(klass, name, signature, may_be_java) \
klass##_##name##_enum,
#define ALL_INJECTED_FIELDS(macro) \
STRING_INJECTED_FIELDS(macro) \
CLASS_INJECTED_FIELDS(macro) \
CLASSLOADER_INJECTED_FIELDS(macro) \
RESOLVEDMETHOD_INJECTED_FIELDS(macro) \
MEMBERNAME_INJECTED_FIELDS(macro) \
CALLSITECONTEXT_INJECTED_FIELDS(macro) \
STACKFRAMEINFO_INJECTED_FIELDS(macro) \
MODULE_INJECTED_FIELDS(macro) \
THREAD_INJECTED_FIELDS(macro) \
INTERNALERROR_INJECTED_FIELDS(macro) \
STACKCHUNK_INJECTED_FIELDS(macro)
// Interface to hard-coded offset checking
enum class InjectedFieldID : int;
class JavaClasses : AllStatic {
private:
@ -2087,10 +1906,6 @@ class JavaClasses : AllStatic {
static bool check_offset(const char *klass_name, int offset, const char *field_name, const char* field_sig) PRODUCT_RETURN0;
public:
enum InjectedFieldID {
ALL_INJECTED_FIELDS(DECLARE_INJECTED_FIELD_ENUM)
MAX_enum
};
static int compute_injected_offset(InjectedFieldID id);
@ -2099,9 +1914,15 @@ class JavaClasses : AllStatic {
static void serialize_offsets(SerializeClosure* soc) NOT_CDS_RETURN;
static InjectedField* get_injected(Symbol* class_name, int* field_count);
static bool is_supported_for_archiving(oop obj) NOT_CDS_JAVA_HEAP_RETURN_(false);
static void compute_offset(int &dest_offset,
InstanceKlass* ik, Symbol* name_symbol, Symbol* signature_symbol,
bool is_static = false);
static void compute_offset(int& dest_offset, InstanceKlass* ik,
const char* name_string, Symbol* signature_symbol,
bool is_static = false);
};
#undef DECLARE_INJECTED_FIELD_ENUM
#undef CHECK_INIT
#endif // SHARE_CLASSFILE_JAVACLASSES_HPP