Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
dart::Environment Class Reference

#include <il.h>

Inheritance diagram for dart::Environment:
dart::ZoneAllocated

Classes

class  DeepIterator
 
class  ShallowIterator
 

Public Member Functions

void set_locations (Location *locations)
 
intptr_t GetDeoptId () const
 
intptr_t LazyDeoptPruneCount () const
 
bool LazyDeoptToBeforeDeoptId () const
 
void MarkAsLazyDeoptToBeforeDeoptId ()
 
bool IsHoisted () const
 
void MarkAsHoisted ()
 
EnvironmentGetLazyDeoptEnv (Zone *zone)
 
Environmentouter () const
 
EnvironmentOutermost ()
 
ValueValueAt (intptr_t ix) const
 
void PushValue (Value *value)
 
intptr_t Length () const
 
Location LocationAt (intptr_t index) const
 
ValueValueAtUseIndex (intptr_t index) const
 
intptr_t fixed_parameter_count () const
 
intptr_t CountArgsPushed ()
 
const Functionfunction () const
 
EnvironmentDeepCopy (Zone *zone) const
 
void DeepCopyTo (Zone *zone, Instruction *instr) const
 
void DeepCopyToOuter (Zone *zone, Instruction *instr, intptr_t outer_deopt_id) const
 
void DeepCopyAfterTo (Zone *zone, Instruction *instr, intptr_t argc, Definition *dead, Definition *result) const
 
void PrintTo (BaseTextBuffer *f) const
 
const char * ToCString () const
 
EnvironmentDeepCopy (Zone *zone, intptr_t length) const
 
void Write (FlowGraphSerializer *s) const
 
 Environment (FlowGraphDeserializer *d)
 
- Public Member Functions inherited from dart::ZoneAllocated
 ZoneAllocated ()
 
void * operator new (size_t size)
 
void * operator new (size_t size, Zone *zone)
 
void operator delete (void *pointer)
 

Static Public Member Functions

static EnvironmentFrom (Zone *zone, const GrowableArray< Definition * > &definitions, intptr_t fixed_parameter_count, intptr_t lazy_deopt_pruning_count, const ParsedFunction &parsed_function)
 

Friends

class ShallowIterator
 
class compiler::BlockBuilder
 

Detailed Description

Definition at line 11547 of file il.h.

Constructor & Destructor Documentation

◆ Environment()

dart::Environment::Environment ( FlowGraphDeserializer d)
explicit

Definition at line 635 of file il_serializer.cc.

636 : values_(d->Read<GrowableArray<Value*>>()),
637 locations_(nullptr),
638 fixed_parameter_count_(d->Read<intptr_t>()),
639 bitfield_(d->Read<uintptr_t>()),
640 function_(d->Read<const Function&>()),
641 outer_(d->Read<Environment*>()) {
642 for (intptr_t i = 0, n = values_.length(); i < n; ++i) {
643 Value* value = values_[i];
644 value->definition()->AddEnvUse(value);
645 }
646 if (d->Read<bool>()) {
647 locations_ = d->zone()->Alloc<Location>(values_.length());
648 for (intptr_t i = 0, n = values_.length(); i < n; ++i) {
649 locations_[i] = Location::Read(d);
650 }
651 }
652}
intptr_t length() const
Environment(FlowGraphDeserializer *d)
static Location Read(FlowGraphDeserializer *d)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition: main.cc:19
uint8_t value

Member Function Documentation

◆ CountArgsPushed()

intptr_t dart::Environment::CountArgsPushed ( )
inline

Definition at line 11732 of file il.h.

11732 {
11733 intptr_t count = 0;
11734 for (Environment::DeepIterator it(this); !it.Done(); it.Advance()) {
11735 if (it.CurrentValue()->definition()->IsMoveArgument()) {
11736 count++;
11737 }
11738 }
11739 return count;
11740 }
int count
Definition: FontMgrTest.cpp:50

◆ DeepCopy() [1/2]

Environment * dart::Environment::DeepCopy ( Zone zone) const
inline

Definition at line 11744 of file il.h.

11744{ return DeepCopy(zone, Length()); }
intptr_t Length() const
Definition: il.h:11712
Environment * DeepCopy(Zone *zone) const
Definition: il.h:11744

◆ DeepCopy() [2/2]

Environment * dart::Environment::DeepCopy ( Zone zone,
intptr_t  length 
) const

Definition at line 6461 of file il.cc.

6461 {
6462 ASSERT(length <= values_.length());
6463 Environment* copy = new (zone) Environment(
6464 length, fixed_parameter_count_, LazyDeoptPruneCount(), function_,
6465 (outer_ == nullptr) ? nullptr : outer_->DeepCopy(zone));
6466 copy->SetDeoptId(DeoptIdBits::decode(bitfield_));
6467 copy->SetLazyDeoptToBeforeDeoptId(LazyDeoptToBeforeDeoptId());
6468 if (IsHoisted()) {
6469 copy->MarkAsHoisted();
6470 }
6471 if (locations_ != nullptr) {
6472 Location* new_locations = zone->Alloc<Location>(length);
6473 copy->set_locations(new_locations);
6474 }
6475 for (intptr_t i = 0; i < length; ++i) {
6476 copy->values_.Add(values_[i]->CopyWithType(zone));
6477 if (locations_ != nullptr) {
6478 copy->locations_[i] = locations_[i].Copy();
6479 }
6480 }
6481 return copy;
6482}
static void copy(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
Definition: SkSwizzler.cpp:31
intptr_t LazyDeoptPruneCount() const
Definition: il.h:11670
bool LazyDeoptToBeforeDeoptId() const
Definition: il.h:11674
bool IsHoisted() const
Definition: il.h:11686
Location Copy() const
Definition: locations.cc:468
#define ASSERT(E)
size_t length
Definition: copy.py:1
static DecodeResult decode(std::string path)
Definition: png_codec.cpp:124

◆ DeepCopyAfterTo()

void dart::Environment::DeepCopyAfterTo ( Zone zone,
Instruction instr,
intptr_t  argc,
Definition dead,
Definition result 
) const

Definition at line 6498 of file il.cc.

6502 {
6503 for (Environment::DeepIterator it(instr->env()); !it.Done(); it.Advance()) {
6504 it.CurrentValue()->RemoveFromUseList();
6505 }
6506
6507 Environment* copy =
6508 DeepCopy(zone, values_.length() - argc - LazyDeoptPruneCount());
6509 copy->SetLazyDeoptPruneCount(0);
6510 for (intptr_t i = 0; i < argc; i++) {
6511 copy->values_.Add(new (zone) Value(dead));
6512 }
6513 copy->values_.Add(new (zone) Value(result));
6514
6515 instr->SetEnvironment(copy);
6516 for (Environment::DeepIterator it(copy); !it.Done(); it.Advance()) {
6517 Value* value = it.CurrentValue();
6518 value->definition()->AddEnvUse(value);
6519 }
6520}
GAsyncResult * result

◆ DeepCopyTo()

void dart::Environment::DeepCopyTo ( Zone zone,
Instruction instr 
) const

Definition at line 6485 of file il.cc.

6485 {
6486 for (Environment::DeepIterator it(instr->env()); !it.Done(); it.Advance()) {
6487 it.CurrentValue()->RemoveFromUseList();
6488 }
6489
6490 Environment* copy = DeepCopy(zone);
6491 instr->SetEnvironment(copy);
6492 for (Environment::DeepIterator it(copy); !it.Done(); it.Advance()) {
6493 Value* value = it.CurrentValue();
6494 value->definition()->AddEnvUse(value);
6495 }
6496}

◆ DeepCopyToOuter()

void dart::Environment::DeepCopyToOuter ( Zone zone,
Instruction instr,
intptr_t  outer_deopt_id 
) const

Definition at line 6524 of file il.cc.

6526 {
6527 // Create a deep copy removing caller arguments from the environment.
6528 ASSERT(instr->env()->outer() == nullptr);
6529 intptr_t argument_count = instr->env()->fixed_parameter_count();
6531 DeepCopy(zone, values_.length() - argument_count - LazyDeoptPruneCount());
6532 outer->SetDeoptId(outer_deopt_id);
6533 outer->SetLazyDeoptPruneCount(0);
6534 instr->env()->outer_ = outer;
6535 intptr_t use_index = instr->env()->Length(); // Start index after inner.
6536 for (Environment::DeepIterator it(outer); !it.Done(); it.Advance()) {
6537 Value* value = it.CurrentValue();
6538 value->set_instruction(instr);
6539 value->set_use_index(use_index++);
6540 value->definition()->AddEnvUse(value);
6541 }
6542}
Environment * outer() const
Definition: il.h:11699
int argument_count
Definition: fuchsia.cc:52

◆ fixed_parameter_count()

intptr_t dart::Environment::fixed_parameter_count ( ) const
inline

Definition at line 11730 of file il.h.

11730{ return fixed_parameter_count_; }

◆ From()

Environment * dart::Environment::From ( Zone zone,
const GrowableArray< Definition * > &  definitions,
intptr_t  fixed_parameter_count,
intptr_t  lazy_deopt_pruning_count,
const ParsedFunction parsed_function 
)
static

Definition at line 6443 of file il.cc.

6447 {
6448 Environment* env = new (zone) Environment(
6449 definitions.length(), fixed_parameter_count, lazy_deopt_pruning_count,
6450 parsed_function.function(), nullptr);
6451 for (intptr_t i = 0; i < definitions.length(); ++i) {
6452 env->values_.Add(new (zone) Value(definitions[i]));
6453 }
6454 return env;
6455}
intptr_t fixed_parameter_count() const
Definition: il.h:11730
Definition: __init__.py:1

◆ function()

const Function & dart::Environment::function ( ) const
inline

Definition at line 11742 of file il.h.

11742{ return function_; }

◆ GetDeoptId()

intptr_t dart::Environment::GetDeoptId ( ) const
inline

Definition at line 11665 of file il.h.

11665 {
11667 return DeoptIdBits::decode(bitfield_);
11668 }
static constexpr intptr_t kNone
Definition: deopt_id.h:27

◆ GetLazyDeoptEnv()

Environment * dart::Environment::GetLazyDeoptEnv ( Zone zone)
inline

Definition at line 11690 of file il.h.

11690 {
11693 }
11694 const intptr_t num_args_to_prune = LazyDeoptPruneCount();
11695 if (num_args_to_prune == 0) return this;
11696 return DeepCopy(zone, Length() - num_args_to_prune);
11697 }

◆ IsHoisted()

bool dart::Environment::IsHoisted ( ) const
inline

Definition at line 11686 of file il.h.

11686{ return Hoisted::decode(bitfield_); }

◆ LazyDeoptPruneCount()

intptr_t dart::Environment::LazyDeoptPruneCount ( ) const
inline

Definition at line 11670 of file il.h.

11670 {
11671 return LazyDeoptPruningBits::decode(bitfield_);
11672 }

◆ LazyDeoptToBeforeDeoptId()

bool dart::Environment::LazyDeoptToBeforeDeoptId ( ) const
inline

Definition at line 11674 of file il.h.

11674 {
11675 return LazyDeoptToBeforeDeoptId::decode(bitfield_);
11676 }

◆ Length()

intptr_t dart::Environment::Length ( ) const
inline

Definition at line 11712 of file il.h.

11712{ return values_.length(); }

◆ LocationAt()

Location dart::Environment::LocationAt ( intptr_t  index) const
inline

Definition at line 11714 of file il.h.

11714 {
11715 ASSERT((index >= 0) && (index < values_.length()));
11716 return locations_[index];
11717 }

◆ MarkAsHoisted()

void dart::Environment::MarkAsHoisted ( )
inline

Definition at line 11688 of file il.h.

11688{ bitfield_ = Hoisted::update(true, bitfield_); }

◆ MarkAsLazyDeoptToBeforeDeoptId()

void dart::Environment::MarkAsLazyDeoptToBeforeDeoptId ( )
inline

Definition at line 11678 of file il.h.

11678 {
11679 bitfield_ = LazyDeoptToBeforeDeoptId::update(true, bitfield_);
11680 // As eager and lazy deopts will target the before environment, we do not
11681 // want to prune inputs on lazy deopts.
11682 bitfield_ = LazyDeoptPruningBits::update(0, bitfield_);
11683 }

◆ outer()

Environment * dart::Environment::outer ( ) const
inline

Definition at line 11699 of file il.h.

11699{ return outer_; }

◆ Outermost()

Environment * dart::Environment::Outermost ( )
inline

Definition at line 11701 of file il.h.

11701 {
11702 Environment* result = this;
11703 while (result->outer() != nullptr)
11704 result = result->outer();
11705 return result;
11706 }

◆ PrintTo()

void dart::Environment::PrintTo ( BaseTextBuffer f) const

◆ PushValue()

void dart::Environment::PushValue ( Value value)

Definition at line 6457 of file il.cc.

6457 {
6458 values_.Add(value);
6459}
void Add(const T &value)

◆ set_locations()

void dart::Environment::set_locations ( Location locations)
inline

Definition at line 11657 of file il.h.

11657 {
11658 ASSERT(locations_ == nullptr);
11659 locations_ = locations;
11660 }

◆ ToCString()

const char * dart::Environment::ToCString ( ) const

◆ ValueAt()

Value * dart::Environment::ValueAt ( intptr_t  ix) const
inline

Definition at line 11708 of file il.h.

11708{ return values_[ix]; }

◆ ValueAtUseIndex()

Value * dart::Environment::ValueAtUseIndex ( intptr_t  index) const
inline

Definition at line 11720 of file il.h.

11720 {
11721 const Environment* env = this;
11722 while (index >= env->Length()) {
11723 ASSERT(env->outer_ != nullptr);
11724 index -= env->Length();
11725 env = env->outer_;
11726 }
11727 return env->ValueAt(index);
11728 }

◆ Write()

void dart::Environment::Write ( FlowGraphSerializer s) const

Definition at line 619 of file il_serializer.cc.

619 {
620 s->Write<GrowableArray<Value*>>(values_);
621 s->Write<intptr_t>(fixed_parameter_count_);
622 s->Write<uintptr_t>(bitfield_);
623 s->Write<const Function&>(function_);
624 s->Write<Environment*>(outer_);
625 if (locations_ == nullptr) {
626 s->Write<bool>(false);
627 } else {
628 s->Write<bool>(true);
629 for (intptr_t i = 0, n = values_.length(); i < n; ++i) {
630 locations_[i].Write(s);
631 }
632 }
633}
void Write(FlowGraphSerializer *s) const
struct MyStruct s

Friends And Related Function Documentation

◆ compiler::BlockBuilder

friend class compiler::BlockBuilder
friend

Definition at line 11770 of file il.h.

◆ ShallowIterator

friend class ShallowIterator
friend

Definition at line 11769 of file il.h.


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