< prev index next >

src/hotspot/share/oops/stackChunkOop.hpp

Print this page

 41 // A continuation stack-chunk oop.
 42 // See InstanceStackChunkKlass for a description of continuation stack-chunks.
 43 //
 44 // size and sp are in machine words
 45 // max_size is the maximum space a thawed chunk would take up on the stack, *not* including top-most frame's metadata
 46 class stackChunkOopDesc : public instanceOopDesc {
 47 public:
 48   enum class BarrierType { Load, Store };
 49 
 50 private:
 51   template <BarrierType barrier> friend class DoBarriersStackClosure;
 52 
 53   // Chunk flags.
 54   // FLAG_HAS_INTERPRETED_FRAMES actually means "thaw slow because of some content-based chunk condition"
 55   // It is set whenever we freeze slow, but generally signifies there might be interpreted/deoptimized/stub frames
 56   static const uint8_t FLAG_HAS_INTERPRETED_FRAMES = 1 << 0;
 57   static const uint8_t FLAG_CLAIM_RELATIVIZE = 1 << 1; // Only one thread claims relativization of derived pointers
 58   static const uint8_t FLAG_NOTIFY_RELATIVIZE = 1 << 2; // Someone is waiting for relativization to complete
 59   static const uint8_t FLAG_GC_MODE = 1 << 3; // Once true it and FLAG_HAS_INTERPRETED_FRAMES can't change
 60   static const uint8_t FLAG_HAS_BITMAP = 1 << 4; // Can only be true if FLAG_GC_MODE is true


 61 
 62   bool try_acquire_relativization();
 63   void release_relativization();
 64 
 65 public:
 66   static inline stackChunkOop cast(oop obj);
 67 
 68   inline stackChunkOop parent() const;
 69   inline void set_parent(stackChunkOop value);
 70   template<typename P>
 71   inline void set_parent_raw(oop value);
 72   template<DecoratorSet decorators>
 73   inline void set_parent_access(oop value);
 74 
 75   inline int stack_size() const;
 76 
 77   inline int sp() const;
 78   inline void set_sp(int value);
 79 
 80   inline address pc() const;
 81   inline void set_pc(address value);
 82 
 83   inline int argsize() const;
 84   inline void set_argsize(int value);
 85 
 86   inline uint8_t flags() const;
 87   inline uint8_t flags_acquire() const;
 88   inline void set_flags(uint8_t value);
 89   inline void release_set_flags(uint8_t value);
 90 
 91   inline int max_thawing_size() const;
 92   inline void set_max_thawing_size(int value);
 93 






 94   inline oop cont() const;
 95   template<typename P>
 96   inline oop cont() const;
 97   inline void set_cont(oop value);
 98   template<typename P>
 99   inline void set_cont_raw(oop value);
100   template<DecoratorSet decorators>
101   inline void set_cont_access(oop value);
102 
103   inline int bottom() const;
104 
105   inline HeapWord* start_of_stack() const;
106 
107   inline intptr_t* start_address() const;
108   inline intptr_t* end_address() const;
109   inline intptr_t* bottom_address() const; // = end_address - argsize
110   inline intptr_t* sp_address() const;
111 
112 
113   inline int to_offset(intptr_t* p) const;
114   inline intptr_t* from_offset(int offset) const;
115 
116   inline bool is_empty() const;
117   inline bool is_in_chunk(void* p) const;
118   inline bool is_usable_in_chunk(void* p) const;
119 
120   inline bool is_flag(uint8_t flag) const;
121   inline bool is_flag_acquire(uint8_t flag) const;
122   inline void set_flag(uint8_t flag, bool value);
123   inline bool try_set_flags(uint8_t prev_flags, uint8_t new_flags);
124   inline void clear_flags();
125 
126   inline bool has_mixed_frames() const;
127   inline void set_has_mixed_frames(bool value);
128 







129   inline bool is_gc_mode() const;
130   inline bool is_gc_mode_acquire() const;
131   inline void set_gc_mode(bool value);
132 
133   inline bool has_bitmap() const;
134   inline void set_has_bitmap(bool value);
135 
136   inline bool has_thaw_slowpath_condition() const;
137 
138   inline bool requires_barriers();
139 
140   template <BarrierType>
141   void do_barriers();
142 
143   template <BarrierType, ChunkFrames frames, typename RegisterMapT>
144   inline void do_barriers(const StackChunkFrameStream<frames>& f, const RegisterMapT* map);
145 
146   template <typename RegisterMapT>
147   void fix_thawed_frame(const frame& f, const RegisterMapT* map);
148 





149   template <class StackChunkFrameClosureType>
150   inline void iterate_stack(StackChunkFrameClosureType* closure);
151 
152   // Derived pointers are relativized, with respect to their oop base.
153   void relativize_derived_pointers_concurrently();
154   void transform();
155 
156   inline void* gc_data() const;
157   inline BitMapView bitmap() const;
158   inline BitMap::idx_t bit_index_for(address p) const;
159   inline intptr_t* address_for_bit(BitMap::idx_t index) const;
160   template <typename OopT> inline BitMap::idx_t bit_index_for(OopT* p) const;
161   template <typename OopT> inline OopT* address_for_bit(BitMap::idx_t index) const;
162 
163   MemRegion range();
164 
165   // Returns a relative frame (with offset_sp, offset_unextended_sp, and offset_fp) that can be held
166   // during safepoints.  This is orthogonal to the relativizing of the actual content of interpreted frames.
167   // To be used, frame objects need to be derelativized with `derelativize`.
168   inline frame relativize(frame fr) const;

 41 // A continuation stack-chunk oop.
 42 // See InstanceStackChunkKlass for a description of continuation stack-chunks.
 43 //
 44 // size and sp are in machine words
 45 // max_size is the maximum space a thawed chunk would take up on the stack, *not* including top-most frame's metadata
 46 class stackChunkOopDesc : public instanceOopDesc {
 47 public:
 48   enum class BarrierType { Load, Store };
 49 
 50 private:
 51   template <BarrierType barrier> friend class DoBarriersStackClosure;
 52 
 53   // Chunk flags.
 54   // FLAG_HAS_INTERPRETED_FRAMES actually means "thaw slow because of some content-based chunk condition"
 55   // It is set whenever we freeze slow, but generally signifies there might be interpreted/deoptimized/stub frames
 56   static const uint8_t FLAG_HAS_INTERPRETED_FRAMES = 1 << 0;
 57   static const uint8_t FLAG_CLAIM_RELATIVIZE = 1 << 1; // Only one thread claims relativization of derived pointers
 58   static const uint8_t FLAG_NOTIFY_RELATIVIZE = 1 << 2; // Someone is waiting for relativization to complete
 59   static const uint8_t FLAG_GC_MODE = 1 << 3; // Once true it and FLAG_HAS_INTERPRETED_FRAMES can't change
 60   static const uint8_t FLAG_HAS_BITMAP = 1 << 4; // Can only be true if FLAG_GC_MODE is true
 61   static const uint8_t FLAG_PREEMPTED = 1 << 5; // Continuation was preempted
 62   static const uint8_t FLAG_HAS_LOCKSTACK = 1 << 6; // LockStack was copied into stackChunk
 63 
 64   bool try_acquire_relativization();
 65   void release_relativization();
 66 
 67 public:
 68   static inline stackChunkOop cast(oop obj);
 69 
 70   inline stackChunkOop parent() const;
 71   inline void set_parent(stackChunkOop value);
 72   template<typename P>
 73   inline void set_parent_raw(oop value);
 74   template<DecoratorSet decorators>
 75   inline void set_parent_access(oop value);
 76 
 77   inline int stack_size() const;
 78 
 79   inline int sp() const;
 80   inline void set_sp(int value);
 81 
 82   inline address pc() const;
 83   inline void set_pc(address value);
 84 
 85   inline int argsize() const;
 86   inline void set_argsize(int value);
 87 
 88   inline uint8_t flags() const;
 89   inline uint8_t flags_acquire() const;
 90   inline void set_flags(uint8_t value);
 91   inline void release_set_flags(uint8_t value);
 92 
 93   inline int max_thawing_size() const;
 94   inline void set_max_thawing_size(int value);
 95 
 96   inline uint8_t lockStackSize() const;
 97   inline void set_lockStackSize(uint8_t value);
 98 
 99   inline ObjectMonitor* objectMonitor() const;
100   inline void set_objectMonitor(ObjectMonitor* monitor);
101 
102   inline oop cont() const;
103   template<typename P>
104   inline oop cont() const;
105   inline void set_cont(oop value);
106   template<typename P>
107   inline void set_cont_raw(oop value);
108   template<DecoratorSet decorators>
109   inline void set_cont_access(oop value);
110 
111   inline int bottom() const;
112 
113   inline HeapWord* start_of_stack() const;
114 
115   inline intptr_t* start_address() const;
116   inline intptr_t* end_address() const;
117   inline intptr_t* bottom_address() const; // = end_address - argsize
118   inline intptr_t* sp_address() const;
119 
120 
121   inline int to_offset(intptr_t* p) const;
122   inline intptr_t* from_offset(int offset) const;
123 
124   inline bool is_empty() const;
125   inline bool is_in_chunk(void* p) const;
126   inline bool is_usable_in_chunk(void* p) const;
127 
128   inline bool is_flag(uint8_t flag) const;
129   inline bool is_flag_acquire(uint8_t flag) const;
130   inline void set_flag(uint8_t flag, bool value);
131   inline bool try_set_flags(uint8_t prev_flags, uint8_t new_flags);
132   inline void clear_flags();
133 
134   inline bool has_mixed_frames() const;
135   inline void set_has_mixed_frames(bool value);
136 
137   inline bool is_preempted() const;
138   inline void set_is_preempted(bool value);
139   inline bool preempted_on_monitorenter() const;
140 
141   inline bool has_lockStack() const;
142   inline void set_has_lockStack(bool value);
143 
144   inline bool is_gc_mode() const;
145   inline bool is_gc_mode_acquire() const;
146   inline void set_gc_mode(bool value);
147 
148   inline bool has_bitmap() const;
149   inline void set_has_bitmap(bool value);
150 
151   inline bool has_thaw_slowpath_condition() const;
152 
153   inline bool requires_barriers();
154 
155   template <BarrierType>
156   void do_barriers();
157 
158   template <BarrierType, ChunkFrames frames, typename RegisterMapT>
159   inline void do_barriers(const StackChunkFrameStream<frames>& f, const RegisterMapT* map);
160 
161   template <typename RegisterMapT>
162   void fix_thawed_frame(const frame& f, const RegisterMapT* map);
163 
164   void copy_lockstack(oop* start);
165 
166   template <typename OopT, class StackChunkLockStackClosureType>
167   inline void iterate_lockstack(StackChunkLockStackClosureType* closure);
168 
169   template <class StackChunkFrameClosureType>
170   inline void iterate_stack(StackChunkFrameClosureType* closure);
171 
172   // Derived pointers are relativized, with respect to their oop base.
173   void relativize_derived_pointers_concurrently();
174   void transform();
175 
176   inline void* gc_data() const;
177   inline BitMapView bitmap() const;
178   inline BitMap::idx_t bit_index_for(address p) const;
179   inline intptr_t* address_for_bit(BitMap::idx_t index) const;
180   template <typename OopT> inline BitMap::idx_t bit_index_for(OopT* p) const;
181   template <typename OopT> inline OopT* address_for_bit(BitMap::idx_t index) const;
182 
183   MemRegion range();
184 
185   // Returns a relative frame (with offset_sp, offset_unextended_sp, and offset_fp) that can be held
186   // during safepoints.  This is orthogonal to the relativizing of the actual content of interpreted frames.
187   // To be used, frame objects need to be derelativized with `derelativize`.
188   inline frame relativize(frame fr) const;
< prev index next >