1 /*
  2  * Copyright (c) 1997, 2022, 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 "precompiled.hpp"
 26 #include "classfile/javaClasses.hpp"
 27 #include "classfile/javaClassesImpl.hpp"
 28 #include "classfile/vmClasses.hpp"
 29 #include "classfile/vmSymbols.hpp"
 30 #include "runtime/continuationJavaClasses.hpp"
 31 
 32 // Support for jdk.internal.vm.ContinuationScope
 33 
 34 int jdk_internal_vm_ContinuationScope::_name_offset;
 35 
 36 #define CONTINUATIONSCOPE_FIELDS_DO(macro) \
 37   macro(_name_offset, k, vmSymbols::name_name(), string_signature, false);
 38 
 39 void jdk_internal_vm_ContinuationScope::compute_offsets() {
 40   InstanceKlass* k = vmClasses::ContinuationScope_klass();
 41   CONTINUATIONSCOPE_FIELDS_DO(FIELD_COMPUTE_OFFSET);
 42 }
 43 
 44 #if INCLUDE_CDS
 45 void jdk_internal_vm_ContinuationScope::serialize_offsets(SerializeClosure* f) {
 46   CONTINUATIONSCOPE_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
 47 }
 48 #endif
 49 
 50 // Support for jdk.internal.vm.Continuation
 51 int jdk_internal_vm_Continuation::_scope_offset;
 52 int jdk_internal_vm_Continuation::_target_offset;
 53 int jdk_internal_vm_Continuation::_tail_offset;
 54 int jdk_internal_vm_Continuation::_parent_offset;
 55 int jdk_internal_vm_Continuation::_yieldInfo_offset;
 56 int jdk_internal_vm_Continuation::_mounted_offset;
 57 int jdk_internal_vm_Continuation::_done_offset;
 58 int jdk_internal_vm_Continuation::_preempted_offset;
 59 
 60 #define CONTINUATION_FIELDS_DO(macro) \
 61   macro(_scope_offset,     k, vmSymbols::scope_name(),     continuationscope_signature, false); \
 62   macro(_target_offset,    k, vmSymbols::target_name(),    runnable_signature,          false); \
 63   macro(_parent_offset,    k, vmSymbols::parent_name(),    continuation_signature,      false); \
 64   macro(_yieldInfo_offset, k, vmSymbols::yieldInfo_name(), object_signature,            false); \
 65   macro(_tail_offset,      k, vmSymbols::tail_name(),      stackchunk_signature,        false); \
 66   macro(_mounted_offset,   k, vmSymbols::mounted_name(),   bool_signature,              false); \
 67   macro(_done_offset,      k, vmSymbols::done_name(),      bool_signature,              false); \
 68   macro(_preempted_offset, k, "preempted",                 bool_signature,              false);
 69 
 70 void jdk_internal_vm_Continuation::compute_offsets() {
 71   InstanceKlass* k = vmClasses::Continuation_klass();
 72   CONTINUATION_FIELDS_DO(FIELD_COMPUTE_OFFSET);
 73 }
 74 
 75 #if INCLUDE_CDS
 76 void jdk_internal_vm_Continuation::serialize_offsets(SerializeClosure* f) {
 77   CONTINUATION_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
 78 }
 79 #endif
 80 
 81 // Support for jdk.internal.vm.StackChunk
 82 
 83 int jdk_internal_vm_StackChunk::_parent_offset;
 84 int jdk_internal_vm_StackChunk::_size_offset;
 85 int jdk_internal_vm_StackChunk::_sp_offset;
 86 int jdk_internal_vm_StackChunk::_pc_offset;
 87 int jdk_internal_vm_StackChunk::_argsize_offset;
 88 int jdk_internal_vm_StackChunk::_flags_offset;
 89 int jdk_internal_vm_StackChunk::_maxThawingSize_offset;
 90 int jdk_internal_vm_StackChunk::_lockStackSize_offset;
 91 int jdk_internal_vm_StackChunk::_objectMonitor_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(_argsize_offset, k, vmSymbols::argsize_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