1 /*
2 * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "classfile/javaClasses.hpp"
26 #include "classfile/javaClassesImpl.hpp"
27 #include "classfile/vmClasses.hpp"
28 #include "classfile/vmSymbols.hpp"
29 #include "runtime/continuationJavaClasses.hpp"
30
31 // Support for jdk.internal.vm.ContinuationScope
32
33 int jdk_internal_vm_ContinuationScope::_name_offset;
34
35 #define CONTINUATIONSCOPE_FIELDS_DO(macro) \
36 macro(_name_offset, k, vmSymbols::name_name(), string_signature, false);
37
38 void jdk_internal_vm_ContinuationScope::compute_offsets() {
39 InstanceKlass* k = vmClasses::ContinuationScope_klass();
40 CONTINUATIONSCOPE_FIELDS_DO(FIELD_COMPUTE_OFFSET);
41 }
42
43 #if INCLUDE_CDS
44 void jdk_internal_vm_ContinuationScope::serialize_offsets(SerializeClosure* f) {
45 CONTINUATIONSCOPE_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
46 }
47 #endif
48
49 // Support for jdk.internal.vm.Continuation
50 int jdk_internal_vm_Continuation::_scope_offset;
51 int jdk_internal_vm_Continuation::_target_offset;
52 int jdk_internal_vm_Continuation::_tail_offset;
53 int jdk_internal_vm_Continuation::_parent_offset;
54 int jdk_internal_vm_Continuation::_yieldInfo_offset;
55 int jdk_internal_vm_Continuation::_mounted_offset;
56 int jdk_internal_vm_Continuation::_done_offset;
57 int jdk_internal_vm_Continuation::_preempted_offset;
58
59 #define CONTINUATION_FIELDS_DO(macro) \
60 macro(_scope_offset, k, vmSymbols::scope_name(), continuationscope_signature, false); \
61 macro(_target_offset, k, vmSymbols::target_name(), runnable_signature, false); \
62 macro(_parent_offset, k, vmSymbols::parent_name(), continuation_signature, false); \
63 macro(_yieldInfo_offset, k, vmSymbols::yieldInfo_name(), object_signature, false); \
64 macro(_tail_offset, k, vmSymbols::tail_name(), stackchunk_signature, false); \
65 macro(_mounted_offset, k, vmSymbols::mounted_name(), bool_signature, false); \
66 macro(_done_offset, k, vmSymbols::done_name(), bool_signature, false); \
67 macro(_preempted_offset, k, "preempted", bool_signature, false);
68
69 void jdk_internal_vm_Continuation::compute_offsets() {
70 InstanceKlass* k = vmClasses::Continuation_klass();
71 CONTINUATION_FIELDS_DO(FIELD_COMPUTE_OFFSET);
72 }
73
74 #if INCLUDE_CDS
75 void jdk_internal_vm_Continuation::serialize_offsets(SerializeClosure* f) {
76 CONTINUATION_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
77 }
78 #endif
79
80 // Support for jdk.internal.vm.StackChunk
81
82 int jdk_internal_vm_StackChunk::_parent_offset;
83 int jdk_internal_vm_StackChunk::_size_offset;
84 int jdk_internal_vm_StackChunk::_sp_offset;
85 int jdk_internal_vm_StackChunk::_pc_offset;
86 int jdk_internal_vm_StackChunk::_bottom_offset;
87 int jdk_internal_vm_StackChunk::_flags_offset;
88 int jdk_internal_vm_StackChunk::_maxThawingSize_offset;
89 int jdk_internal_vm_StackChunk::_lockStackSize_offset;
90 int jdk_internal_vm_StackChunk::_atKlassInit_offset;
91 int jdk_internal_vm_StackChunk::_hasArgsAtTop_offset;
92 int jdk_internal_vm_StackChunk::_cont_offset;
93
94 #define STACKCHUNK_FIELDS_DO(macro) \
95 macro(_parent_offset, k, vmSymbols::parent_name(), stackchunk_signature, false); \
96 macro(_size_offset, k, vmSymbols::size_name(), int_signature, false); \
97 macro(_sp_offset, k, vmSymbols::sp_name(), int_signature, false); \
98 macro(_bottom_offset, k, vmSymbols::bottom_name(), int_signature, false);
99
100 void jdk_internal_vm_StackChunk::compute_offsets() {
101 InstanceKlass* k = vmClasses::StackChunk_klass();
102 STACKCHUNK_FIELDS_DO(FIELD_COMPUTE_OFFSET);
103 STACKCHUNK_INJECTED_FIELDS(INJECTED_FIELD_COMPUTE_OFFSET);
104 }
105
106 #if INCLUDE_CDS
107 void jdk_internal_vm_StackChunk::serialize_offsets(SerializeClosure* f) {
108 STACKCHUNK_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
109 STACKCHUNK_INJECTED_FIELDS(INJECTED_FIELD_SERIALIZE_OFFSET);
110 }
111 #endif
112