< prev index next >

src/hotspot/share/oops/instanceStackChunkKlass.inline.hpp

Print this page

  1 /* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
  2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  3  *
  4  * This code is free software; you can redistribute it and/or modify it
  5  * under the terms of the GNU General Public License version 2 only, as
  6  * published by the Free Software Foundation.
  7  *
  8  * This code is distributed in the hope that it will be useful, but WITHOUT
  9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 11  * version 2 for more details (a copy is included in the LICENSE file that
 12  * accompanied this code).
 13  *
 14  * You should have received a copy of the GNU General Public License version
 15  * 2 along with this work; if not, write to the Free Software Foundation,
 16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 17  *
 18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 19  * or visit www.oracle.com if you need additional information or have any
 20  * questions.
 21  *

 48   return align_up(size_in_bits, BitsPerWord);
 49 }
 50 
 51 inline size_t InstanceStackChunkKlass::gc_data_size(size_t stack_size_in_words) {
 52   // At the moment all GCs are okay with GC data big enough to fit a bit map
 53   return bitmap_size(stack_size_in_words);
 54 }
 55 
 56 inline size_t InstanceStackChunkKlass::bitmap_size(size_t stack_size_in_words) {
 57   return bitmap_size_in_bits(stack_size_in_words) >> LogBitsPerWord;
 58 }
 59 
 60 template <typename T, class OopClosureType>
 61 void InstanceStackChunkKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
 62   stackChunkOop chunk = stackChunkOopDesc::cast(obj);
 63   if (Devirtualizer::do_metadata(closure)) {
 64     Devirtualizer::do_klass(closure, this);
 65   }
 66   oop_oop_iterate_stack<T>(chunk, closure);
 67   oop_oop_iterate_header<T>(chunk, closure);

 68 }
 69 
 70 template <typename T, class OopClosureType>
 71 void InstanceStackChunkKlass::oop_oop_iterate_reverse(oop obj, OopClosureType* closure) {
 72   assert(!Devirtualizer::do_metadata(closure), "Code to handle metadata is not implemented");
 73   stackChunkOop chunk = stackChunkOopDesc::cast(obj);
 74   oop_oop_iterate_stack<T>(chunk, closure);
 75   oop_oop_iterate_header<T>(chunk, closure);

 76 }
 77 
 78 template <typename T, class OopClosureType>
 79 void InstanceStackChunkKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
 80   stackChunkOop chunk = stackChunkOopDesc::cast(obj);
 81   if (Devirtualizer::do_metadata(closure)) {
 82     if (mr.contains(obj)) {
 83       Devirtualizer::do_klass(closure, this);
 84     }
 85   }
 86   oop_oop_iterate_stack_bounded<T>(chunk, closure, mr);
 87   oop_oop_iterate_header_bounded<T>(chunk, closure, mr);

 88 }
 89 
 90 template <typename T, class OopClosureType>
 91 void InstanceStackChunkKlass::oop_oop_iterate_header(stackChunkOop chunk, OopClosureType* closure) {
 92   T* parent_addr = chunk->field_addr<T>(jdk_internal_vm_StackChunk::parent_offset());
 93   T* cont_addr = chunk->field_addr<T>(jdk_internal_vm_StackChunk::cont_offset());
 94   Devirtualizer::do_oop(closure, parent_addr);
 95   Devirtualizer::do_oop(closure, cont_addr);
 96 }
 97 
 98 template <typename T, class OopClosureType>
 99 void InstanceStackChunkKlass::oop_oop_iterate_header_bounded(stackChunkOop chunk, OopClosureType* closure, MemRegion mr) {
100   T* parent_addr = chunk->field_addr<T>(jdk_internal_vm_StackChunk::parent_offset());
101   T* cont_addr = chunk->field_addr<T>(jdk_internal_vm_StackChunk::cont_offset());
102   if (mr.contains(parent_addr)) {
103     Devirtualizer::do_oop(closure, parent_addr);
104   }
105   if (mr.contains(cont_addr)) {
106     Devirtualizer::do_oop(closure, cont_addr);
107   }

  1 /* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
  2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  3  *
  4  * This code is free software; you can redistribute it and/or modify it
  5  * under the terms of the GNU General Public License version 2 only, as
  6  * published by the Free Software Foundation.
  7  *
  8  * This code is distributed in the hope that it will be useful, but WITHOUT
  9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 11  * version 2 for more details (a copy is included in the LICENSE file that
 12  * accompanied this code).
 13  *
 14  * You should have received a copy of the GNU General Public License version
 15  * 2 along with this work; if not, write to the Free Software Foundation,
 16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 17  *
 18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 19  * or visit www.oracle.com if you need additional information or have any
 20  * questions.
 21  *

 48   return align_up(size_in_bits, BitsPerWord);
 49 }
 50 
 51 inline size_t InstanceStackChunkKlass::gc_data_size(size_t stack_size_in_words) {
 52   // At the moment all GCs are okay with GC data big enough to fit a bit map
 53   return bitmap_size(stack_size_in_words);
 54 }
 55 
 56 inline size_t InstanceStackChunkKlass::bitmap_size(size_t stack_size_in_words) {
 57   return bitmap_size_in_bits(stack_size_in_words) >> LogBitsPerWord;
 58 }
 59 
 60 template <typename T, class OopClosureType>
 61 void InstanceStackChunkKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
 62   stackChunkOop chunk = stackChunkOopDesc::cast(obj);
 63   if (Devirtualizer::do_metadata(closure)) {
 64     Devirtualizer::do_klass(closure, this);
 65   }
 66   oop_oop_iterate_stack<T>(chunk, closure);
 67   oop_oop_iterate_header<T>(chunk, closure);
 68   oop_oop_iterate_lockstack<T>(chunk, closure, chunk->range());
 69 }
 70 
 71 template <typename T, class OopClosureType>
 72 void InstanceStackChunkKlass::oop_oop_iterate_reverse(oop obj, OopClosureType* closure) {
 73   assert(!Devirtualizer::do_metadata(closure), "Code to handle metadata is not implemented");
 74   stackChunkOop chunk = stackChunkOopDesc::cast(obj);
 75   oop_oop_iterate_stack<T>(chunk, closure);
 76   oop_oop_iterate_header<T>(chunk, closure);
 77   oop_oop_iterate_lockstack<T>(chunk, closure, chunk->range());
 78 }
 79 
 80 template <typename T, class OopClosureType>
 81 void InstanceStackChunkKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
 82   stackChunkOop chunk = stackChunkOopDesc::cast(obj);
 83   if (Devirtualizer::do_metadata(closure)) {
 84     if (mr.contains(obj)) {
 85       Devirtualizer::do_klass(closure, this);
 86     }
 87   }
 88   oop_oop_iterate_stack_bounded<T>(chunk, closure, mr);
 89   oop_oop_iterate_header_bounded<T>(chunk, closure, mr);
 90   oop_oop_iterate_lockstack<T>(chunk, closure, mr);
 91 }
 92 
 93 template <typename T, class OopClosureType>
 94 void InstanceStackChunkKlass::oop_oop_iterate_header(stackChunkOop chunk, OopClosureType* closure) {
 95   T* parent_addr = chunk->field_addr<T>(jdk_internal_vm_StackChunk::parent_offset());
 96   T* cont_addr = chunk->field_addr<T>(jdk_internal_vm_StackChunk::cont_offset());
 97   Devirtualizer::do_oop(closure, parent_addr);
 98   Devirtualizer::do_oop(closure, cont_addr);
 99 }
100 
101 template <typename T, class OopClosureType>
102 void InstanceStackChunkKlass::oop_oop_iterate_header_bounded(stackChunkOop chunk, OopClosureType* closure, MemRegion mr) {
103   T* parent_addr = chunk->field_addr<T>(jdk_internal_vm_StackChunk::parent_offset());
104   T* cont_addr = chunk->field_addr<T>(jdk_internal_vm_StackChunk::cont_offset());
105   if (mr.contains(parent_addr)) {
106     Devirtualizer::do_oop(closure, parent_addr);
107   }
108   if (mr.contains(cont_addr)) {
109     Devirtualizer::do_oop(closure, cont_addr);
110   }
< prev index next >