New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8288623: Move Continuation classes out of javaClasses.hpp #9191
Closed
iklam
wants to merge
11
commits into
openjdk:master
from
iklam:8288623-move-continuation-out-of-javaClasses-hpp
Closed
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
001c215
8288623: Move Continuation classes out of javaClasses.hpp
ioilam caf085a
added missing includes that were hidden by previously unnedded includes
ioilam ebc3f9f
fixed include guard macro and copyright year
ioilam 145e44a
@stefank review comments
ioilam 9d998d7
moved to runtime/continuationJavaClasses.hpp
ioilam 2012fc6
Review comments
stefank 2b78367
Merge branch 'master' into 8288623-move-continuation-out-of-javaClass…
iklam 6798bb4
added missing javaClasses.inline.hpp after merge with javaThread.hpp …
iklam 9adf490
fixed GHA build failures
iklam a217928
one more missing header
iklam cd06342
Merge branch 'master' into 8288623-move-continuation-out-of-javaClass…
iklam File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
110 changes: 110 additions & 0 deletions
110
src/hotspot/share/classfile/continuationJavaClasses.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/* | ||
* Copyright (c) 1997, 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. | ||
* | ||
*/ | ||
|
||
#include "precompiled.hpp" | ||
#include "classfile/javaClassesImpl.hpp" | ||
#include "classfile/javaClasses.hpp" | ||
#include "classfile/continuationJavaClasses.hpp" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Include order |
||
#include "classfile/vmClasses.hpp" | ||
#include "classfile/vmSymbols.hpp" | ||
|
||
// Support for jdk.internal.vm.ContinuationScope | ||
|
||
int jdk_internal_vm_ContinuationScope::_name_offset; | ||
|
||
#define CONTINUATIONSCOPE_FIELDS_DO(macro) \ | ||
macro(_name_offset, k, vmSymbols::name_name(), string_signature, false); | ||
|
||
void jdk_internal_vm_ContinuationScope::compute_offsets() { | ||
InstanceKlass* k = vmClasses::ContinuationScope_klass(); | ||
CONTINUATIONSCOPE_FIELDS_DO(FIELD_COMPUTE_OFFSET); | ||
} | ||
|
||
#if INCLUDE_CDS | ||
void jdk_internal_vm_ContinuationScope::serialize_offsets(SerializeClosure* f) { | ||
CONTINUATIONSCOPE_FIELDS_DO(FIELD_SERIALIZE_OFFSET); | ||
} | ||
#endif | ||
|
||
// Support for jdk.internal.vm.Continuation | ||
int jdk_internal_vm_Continuation::_scope_offset; | ||
int jdk_internal_vm_Continuation::_target_offset; | ||
int jdk_internal_vm_Continuation::_tail_offset; | ||
int jdk_internal_vm_Continuation::_parent_offset; | ||
int jdk_internal_vm_Continuation::_yieldInfo_offset; | ||
int jdk_internal_vm_Continuation::_mounted_offset; | ||
int jdk_internal_vm_Continuation::_done_offset; | ||
int jdk_internal_vm_Continuation::_preempted_offset; | ||
|
||
#define CONTINUATION_FIELDS_DO(macro) \ | ||
macro(_scope_offset, k, vmSymbols::scope_name(), continuationscope_signature, false); \ | ||
macro(_target_offset, k, vmSymbols::target_name(), runnable_signature, false); \ | ||
macro(_parent_offset, k, vmSymbols::parent_name(), continuation_signature, false); \ | ||
macro(_yieldInfo_offset, k, vmSymbols::yieldInfo_name(), object_signature, false); \ | ||
macro(_tail_offset, k, vmSymbols::tail_name(), stackchunk_signature, false); \ | ||
macro(_mounted_offset, k, vmSymbols::mounted_name(), bool_signature, false); \ | ||
macro(_done_offset, k, vmSymbols::done_name(), bool_signature, false); \ | ||
macro(_preempted_offset, k, "preempted", bool_signature, false); | ||
|
||
void jdk_internal_vm_Continuation::compute_offsets() { | ||
InstanceKlass* k = vmClasses::Continuation_klass(); | ||
CONTINUATION_FIELDS_DO(FIELD_COMPUTE_OFFSET); | ||
} | ||
|
||
#if INCLUDE_CDS | ||
void jdk_internal_vm_Continuation::serialize_offsets(SerializeClosure* f) { | ||
CONTINUATION_FIELDS_DO(FIELD_SERIALIZE_OFFSET); | ||
} | ||
#endif | ||
|
||
// Support for jdk.internal.vm.StackChunk | ||
|
||
int jdk_internal_vm_StackChunk::_parent_offset; | ||
int jdk_internal_vm_StackChunk::_size_offset; | ||
int jdk_internal_vm_StackChunk::_sp_offset; | ||
int jdk_internal_vm_StackChunk::_pc_offset; | ||
int jdk_internal_vm_StackChunk::_argsize_offset; | ||
int jdk_internal_vm_StackChunk::_flags_offset; | ||
int jdk_internal_vm_StackChunk::_maxThawingSize_offset; | ||
int jdk_internal_vm_StackChunk::_cont_offset; | ||
|
||
#define STACKCHUNK_FIELDS_DO(macro) \ | ||
macro(_parent_offset, k, vmSymbols::parent_name(), stackchunk_signature, false); \ | ||
macro(_size_offset, k, vmSymbols::size_name(), int_signature, false); \ | ||
macro(_sp_offset, k, vmSymbols::sp_name(), int_signature, false); \ | ||
macro(_argsize_offset, k, vmSymbols::argsize_name(), int_signature, false); | ||
|
||
void jdk_internal_vm_StackChunk::compute_offsets() { | ||
InstanceKlass* k = vmClasses::StackChunk_klass(); | ||
STACKCHUNK_FIELDS_DO(FIELD_COMPUTE_OFFSET); | ||
STACKCHUNK_INJECTED_FIELDS(INJECTED_FIELD_COMPUTE_OFFSET); | ||
} | ||
|
||
#if INCLUDE_CDS | ||
void jdk_internal_vm_StackChunk::serialize_offsets(SerializeClosure* f) { | ||
STACKCHUNK_FIELDS_DO(FIELD_SERIALIZE_OFFSET); | ||
STACKCHUNK_INJECTED_FIELDS(INJECTED_FIELD_SERIALIZE_OFFSET); | ||
} | ||
#endif | ||
|
139 changes: 139 additions & 0 deletions
139
src/hotspot/share/classfile/continuationJavaClasses.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
/* | ||
* Copyright (c) 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. | ||
* | ||
*/ | ||
|
||
#ifndef SHARE_CLASSFILE_CONTINUATIONJAVACLASSES_HPP | ||
#define SHARE_CLASSFILE_CONTINUATIONJAVACLASSES_HPP | ||
|
||
#include "memory/allStatic.hpp" | ||
#include "oops/oop.hpp" | ||
|
||
class SerializeClosure; | ||
|
||
// 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); | ||
}; | ||
|
||
#endif // SHARE_CLASSFILE_CONTINUATIONJAVACLASSES_HPP |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should also move to runtime/