Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
dart::FlowGraphSerializer Class Reference

#include <il_serializer.h>

Inheritance diagram for dart::FlowGraphSerializer:
dart::ValueObject

Classes

struct  WriteRefTrait
 
struct  WriteTrait
 
struct  WriteTrait< const GrowableArray< T > & >
 
struct  WriteTrait< const ZoneGrowableArray< T > & >
 
struct  WriteTrait< GrowableArray< T > >
 
struct  WriteTrait< T, std::enable_if_t< std::is_same_v< intptr_t, T > &&!std::is_same_v< intptr_t, int32_t > &&!std::is_same_v< intptr_t, int64_t > > >
 
struct  WriteTrait< T, std::enable_if_t< std::is_same_v< uintptr_t, T > &&!std::is_same_v< uintptr_t, uint32_t > &&!std::is_same_v< uintptr_t, uint64_t > > >
 
struct  WriteTrait< ZoneGrowableArray< T > * >
 

Public Member Functions

 FlowGraphSerializer (NonStreamingWriteStream *stream)
 
 ~FlowGraphSerializer ()
 
void WriteFlowGraph (const FlowGraph &flow_graph, const ZoneGrowableArray< Definition * > &detached_defs)
 
template<typename T >
void Write (typename WriteTrait< T >::ArgType x)
 
template<typename T >
void WriteRef (T x)
 
template<typename T >
void WriteGrowableArrayOfRefs (const GrowableArray< T > &array)
 
BaseWriteStreamstream () const
 
Zonezone () const
 
Threadthread () const
 
IsolateGroupisolate_group () const
 
Heapheap () const
 
bool can_write_refs () const
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Detailed Description

Definition at line 146 of file il_serializer.h.

Constructor & Destructor Documentation

◆ FlowGraphSerializer()

dart::FlowGraphSerializer::FlowGraphSerializer ( NonStreamingWriteStream stream)
explicit

Definition at line 28 of file il_serializer.cc.

29 : stream_(stream),
30 zone_(Thread::Current()->zone()),
31 thread_(Thread::Current()),
32 isolate_group_(IsolateGroup::Current()),
33 heap_(IsolateGroup::Current()->heap()) {}
BaseWriteStream * stream() const
static IsolateGroup * Current()
Definition isolate.h:534
static Thread * Current()
Definition thread.h:361

◆ ~FlowGraphSerializer()

dart::FlowGraphSerializer::~FlowGraphSerializer ( )

Definition at line 35 of file il_serializer.cc.

35 {
36 heap_->ResetObjectIdTable();
37}
void ResetObjectIdTable()
Definition heap.cc:888

Member Function Documentation

◆ can_write_refs()

bool dart::FlowGraphSerializer::can_write_refs ( ) const
inline

Definition at line 304 of file il_serializer.h.

304{ return can_write_refs_; }

◆ heap()

Heap * dart::FlowGraphSerializer::heap ( ) const
inline

Definition at line 303 of file il_serializer.h.

303{ return heap_; }

◆ isolate_group()

IsolateGroup * dart::FlowGraphSerializer::isolate_group ( ) const
inline

Definition at line 302 of file il_serializer.h.

302{ return isolate_group_; }

◆ stream()

BaseWriteStream * dart::FlowGraphSerializer::stream ( ) const
inline

Definition at line 299 of file il_serializer.h.

299{ return stream_; }

◆ thread()

Thread * dart::FlowGraphSerializer::thread ( ) const
inline

Definition at line 301 of file il_serializer.h.

301{ return thread_; }

◆ Write()

template<typename T >
void dart::FlowGraphSerializer::Write ( typename WriteTrait< T >::ArgType  x)
inline

Definition at line 260 of file il_serializer.h.

260 {
261 WriteTrait<T>::Write(this, x);
262 }
double x
void Write(FlowGraphSerializer *s, const AbstractType *x)

◆ WriteFlowGraph()

void dart::FlowGraphSerializer::WriteFlowGraph ( const FlowGraph flow_graph,
const ZoneGrowableArray< Definition * > &  detached_defs 
)

Definition at line 654 of file il_serializer.cc.

656 {
657 ASSERT(!flow_graph.is_licm_allowed());
658
659 Write<intptr_t>(flow_graph.current_ssa_temp_index());
660 Write<intptr_t>(flow_graph.max_block_id());
661 Write<intptr_t>(flow_graph.inlining_id());
662 Write<const Array&>(flow_graph.coverage_array());
663
664 PrologueInfo prologue_info = flow_graph.prologue_info();
665 Write<intptr_t>(prologue_info.min_block_id);
666 Write<intptr_t>(prologue_info.max_block_id);
667
668 // Write instructions
669 for (auto block : flow_graph.reverse_postorder()) {
670 Write<Instruction*>(block);
671 for (auto current : block->instructions()) {
672 Write<Instruction*>(current);
673 }
674 }
675 Write<Instruction*>(nullptr);
676 Write<const ZoneGrowableArray<Definition*>&>(detached_defs);
677 can_write_refs_ = true;
678
679 // Write instructions extra info.
680 // It may contain references to other instructions.
681 for (auto block : flow_graph.reverse_postorder()) {
682 block->WriteExtra(this);
683 for (auto current : block->instructions()) {
684 current->WriteExtra(this);
685 }
686 }
687 for (auto* instr : detached_defs) {
688 instr->WriteExtra(this);
689 }
690
691 const auto& optimized_block_order = flow_graph.optimized_block_order();
692 Write<intptr_t>(optimized_block_order.length());
693 for (intptr_t i = 0, n = optimized_block_order.length(); i < n; ++i) {
694 WriteRef<BlockEntryInstr*>(optimized_block_order[i]);
695 }
696
697 const auto* captured_parameters = flow_graph.captured_parameters();
698 if (captured_parameters->IsEmpty()) {
699 Write<bool>(false);
700 } else {
701 Write<bool>(true);
702 // Captured parameters are rare so write their bit numbers
703 // instead of writing BitVector.
704 GrowableArray<intptr_t> indices(Z, 0);
705 for (intptr_t i = 0, n = captured_parameters->length(); i < n; ++i) {
706 if (captured_parameters->Contains(i)) {
707 indices.Add(i);
708 }
709 }
710 Write<GrowableArray<intptr_t>>(indices);
711 }
712}
#define Z
#define ASSERT(E)

◆ WriteGrowableArrayOfRefs()

template<typename T >
void dart::FlowGraphSerializer::WriteGrowableArrayOfRefs ( const GrowableArray< T > &  array)
inline

Definition at line 291 of file il_serializer.h.

291 {
292 const intptr_t len = array.length();
293 Write<intptr_t>(len);
294 for (intptr_t i = 0; i < len; ++i) {
295 WriteRef<T>(array[i]);
296 }
297 }

◆ WriteRef()

template<typename T >
void dart::FlowGraphSerializer::WriteRef ( T  x)
inline

Definition at line 286 of file il_serializer.h.

286 {
288 }
void WriteRef(FlowGraphSerializer *s, BlockEntryInstr *x)

◆ zone()

Zone * dart::FlowGraphSerializer::zone ( ) const
inline

Definition at line 300 of file il_serializer.h.

300{ return zone_; }

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