Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
dart::CompressedStackMaps::Iterator< PayloadHandle > Class Template Reference

#include <object.h>

Public Member Functions

 Iterator (const PayloadHandle &maps, const PayloadHandle &global_table)
 
 Iterator (const Iterator &it)
 
bool MoveNext ()
 
bool Find (uint32_t pc_offset)
 
uint32_t pc_offset () const
 
intptr_t Length () const
 
intptr_t SpillSlotBitCount () const
 
bool IsObject (intptr_t bit_index) const
 

Friends

class StackMapEntry
 

Detailed Description

template<typename PayloadHandle>
class dart::CompressedStackMaps::Iterator< PayloadHandle >

Definition at line 6355 of file object.h.

Constructor & Destructor Documentation

◆ Iterator() [1/2]

template<typename PayloadHandle >
dart::CompressedStackMaps::Iterator< PayloadHandle >::Iterator ( const PayloadHandle &  maps,
const PayloadHandle &  global_table 
)
inline

Definition at line 6357 of file object.h.

6358 : maps_(maps),
6359 bits_container_(maps.UsesGlobalTable() ? global_table : maps) {
6360 ASSERT(!maps_.IsNull());
6361 ASSERT(!bits_container_.IsNull());
6362 ASSERT(!maps_.IsGlobalTable());
6363 ASSERT(!maps_.UsesGlobalTable() || bits_container_.IsGlobalTable());
6364 }
#define ASSERT(E)

◆ Iterator() [2/2]

template<typename PayloadHandle >
dart::CompressedStackMaps::Iterator< PayloadHandle >::Iterator ( const Iterator< PayloadHandle > &  it)
inline

Definition at line 6366 of file object.h.

6367 : maps_(it.maps_),
6368 bits_container_(it.bits_container_),
6369 next_offset_(it.next_offset_),
6370 current_pc_offset_(it.current_pc_offset_),
6371 current_global_table_offset_(it.current_global_table_offset_),
6372 current_spill_slot_bit_count_(it.current_spill_slot_bit_count_),
6373 current_non_spill_slot_bit_count_(it.current_spill_slot_bit_count_),
6374 current_bits_offset_(it.current_bits_offset_) {}

Member Function Documentation

◆ Find()

template<typename PayloadHandle >
bool dart::CompressedStackMaps::Iterator< PayloadHandle >::Find ( uint32_t  pc_offset)
inline

Definition at line 6430 of file object.h.

6430 {
6431 // We should never have an entry with a PC offset of 0 inside an
6432 // non-empty CSM, so fail.
6433 if (pc_offset == 0) return false;
6434 do {
6435 if (current_pc_offset_ >= pc_offset) break;
6436 } while (MoveNext());
6437 return current_pc_offset_ == pc_offset;
6438 }

◆ IsObject()

template<typename PayloadHandle >
bool dart::CompressedStackMaps::Iterator< PayloadHandle >::IsObject ( intptr_t  bit_index) const
inline

Definition at line 6461 of file object.h.

6461 {
6462 EnsureFullyLoadedEntry();
6463 ASSERT(bit_index >= 0 && bit_index < Length());
6464 const intptr_t byte_index = bit_index >> kBitsPerByteLog2;
6465 const intptr_t bit_remainder = bit_index & (kBitsPerByte - 1);
6466 uint8_t byte_mask = 1U << bit_remainder;
6467 const intptr_t byte_offset = current_bits_offset_ + byte_index;
6468 NoSafepointScope scope;
6469 return (bits_container_.data()[byte_offset] & byte_mask) != 0;
6470 }
constexpr intptr_t kBitsPerByteLog2
Definition globals.h:462
constexpr intptr_t kBitsPerByte
Definition globals.h:463

◆ Length()

template<typename PayloadHandle >
intptr_t dart::CompressedStackMaps::Iterator< PayloadHandle >::Length ( ) const
inline

Definition at line 6450 of file object.h.

6450 {
6451 EnsureFullyLoadedEntry();
6452 return current_spill_slot_bit_count_ + current_non_spill_slot_bit_count_;
6453 }

◆ MoveNext()

template<typename PayloadHandle >
bool dart::CompressedStackMaps::Iterator< PayloadHandle >::MoveNext ( )
inline

Definition at line 6378 of file object.h.

6378 {
6379 if (next_offset_ >= maps_.payload_size()) {
6380 return false;
6381 }
6382
6383 NoSafepointScope scope;
6384 ReadStream stream(maps_.data(), maps_.payload_size(), next_offset_);
6385
6386 auto const pc_delta = stream.ReadLEB128();
6387 ASSERT(pc_delta <= (kMaxUint32 - current_pc_offset_));
6388 current_pc_offset_ += pc_delta;
6389
6390 // Table-using CSMs have a table offset after the PC offset delta, whereas
6391 // the post-delta part of inlined entries has the same information as
6392 // global table entries.
6393 // See comments in UntaggedCompressedStackMaps for description of
6394 // encoding.
6395 if (maps_.UsesGlobalTable()) {
6396 current_global_table_offset_ = stream.ReadLEB128();
6397 ASSERT(current_global_table_offset_ < bits_container_.payload_size());
6398
6399 // Since generally we only use entries in the GC and the GC only needs
6400 // the rest of the entry information if the PC offset matches, we lazily
6401 // load and cache the information stored in the global object when it is
6402 // actually requested.
6403 current_spill_slot_bit_count_ = -1;
6404 current_non_spill_slot_bit_count_ = -1;
6405 current_bits_offset_ = -1;
6406
6407 next_offset_ = stream.Position();
6408 } else {
6409 current_spill_slot_bit_count_ = stream.ReadLEB128();
6410 ASSERT(current_spill_slot_bit_count_ >= 0);
6411
6412 current_non_spill_slot_bit_count_ = stream.ReadLEB128();
6413 ASSERT(current_non_spill_slot_bit_count_ >= 0);
6414
6415 const auto stackmap_bits =
6416 current_spill_slot_bit_count_ + current_non_spill_slot_bit_count_;
6417 const uintptr_t stackmap_size =
6418 Utils::RoundUp(stackmap_bits, kBitsPerByte) >> kBitsPerByteLog2;
6419 ASSERT(stackmap_size <= (maps_.payload_size() - stream.Position()));
6420
6421 current_bits_offset_ = stream.Position();
6422 next_offset_ = current_bits_offset_ + stackmap_size;
6423 }
6424
6425 return true;
6426 }
static constexpr T RoundUp(T x, uintptr_t alignment, uintptr_t offset=0)
Definition utils.h:105
constexpr uint32_t kMaxUint32
Definition globals.h:484

◆ pc_offset()

template<typename PayloadHandle >
uint32_t dart::CompressedStackMaps::Iterator< PayloadHandle >::pc_offset ( ) const
inline

Definition at line 6444 of file object.h.

6444 {
6445 ASSERT(HasLoadedEntry());
6446 return current_pc_offset_;
6447 }

◆ SpillSlotBitCount()

template<typename PayloadHandle >
intptr_t dart::CompressedStackMaps::Iterator< PayloadHandle >::SpillSlotBitCount ( ) const
inline

Definition at line 6455 of file object.h.

6455 {
6456 EnsureFullyLoadedEntry();
6457 return current_spill_slot_bit_count_;
6458 }

Friends And Related Symbol Documentation

◆ StackMapEntry

template<typename PayloadHandle >
friend class StackMapEntry
friend

Definition at line 6523 of file object.h.


The documentation for this class was generated from the following file: