Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 11493 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
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 11678 of file il.h.

11678 {
11679 intptr_t count = 0;
11680 for (Environment::DeepIterator it(this); !it.Done(); it.Advance()) {
11681 if (it.CurrentValue()->definition()->IsMoveArgument()) {
11682 count++;
11683 }
11684 }
11685 return count;
11686 }
int count

◆ DeepCopy() [1/2]

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

Definition at line 11690 of file il.h.

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

◆ DeepCopy() [2/2]

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

Definition at line 6469 of file il.cc.

6469 {
6470 ASSERT(length <= values_.length());
6471 Environment* copy = new (zone) Environment(
6472 length, fixed_parameter_count_, LazyDeoptPruneCount(), function_,
6473 (outer_ == nullptr) ? nullptr : outer_->DeepCopy(zone));
6474 copy->SetDeoptId(DeoptIdBits::decode(bitfield_));
6475 copy->SetLazyDeoptToBeforeDeoptId(LazyDeoptToBeforeDeoptId());
6476 if (IsHoisted()) {
6477 copy->MarkAsHoisted();
6478 }
6479 if (locations_ != nullptr) {
6480 Location* new_locations = zone->Alloc<Location>(length);
6481 copy->set_locations(new_locations);
6482 }
6483 for (intptr_t i = 0; i < length; ++i) {
6484 copy->values_.Add(values_[i]->CopyWithType(zone));
6485 if (locations_ != nullptr) {
6486 copy->locations_[i] = locations_[i].Copy();
6487 }
6488 }
6489 return copy;
6490}
intptr_t LazyDeoptPruneCount() const
Definition il.h:11616
bool LazyDeoptToBeforeDeoptId() const
Definition il.h:11620
bool IsHoisted() const
Definition il.h:11632
Environment(FlowGraphDeserializer *d)
Location Copy() const
Definition locations.cc:468
#define ASSERT(E)
size_t length
Definition copy.py:1

◆ DeepCopyAfterTo()

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

Definition at line 6506 of file il.cc.

6510 {
6511 for (Environment::DeepIterator it(instr->env()); !it.Done(); it.Advance()) {
6512 it.CurrentValue()->RemoveFromUseList();
6513 }
6514
6515 Environment* copy =
6516 DeepCopy(zone, values_.length() - argc - LazyDeoptPruneCount());
6517 copy->SetLazyDeoptPruneCount(0);
6518 for (intptr_t i = 0; i < argc; i++) {
6519 copy->values_.Add(new (zone) Value(dead));
6520 }
6521 copy->values_.Add(new (zone) Value(result));
6522
6523 instr->SetEnvironment(copy);
6524 for (Environment::DeepIterator it(copy); !it.Done(); it.Advance()) {
6525 Value* value = it.CurrentValue();
6526 value->definition()->AddEnvUse(value);
6527 }
6528}
GAsyncResult * result

◆ DeepCopyTo()

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

Definition at line 6493 of file il.cc.

6493 {
6494 for (Environment::DeepIterator it(instr->env()); !it.Done(); it.Advance()) {
6495 it.CurrentValue()->RemoveFromUseList();
6496 }
6497
6498 Environment* copy = DeepCopy(zone);
6499 instr->SetEnvironment(copy);
6500 for (Environment::DeepIterator it(copy); !it.Done(); it.Advance()) {
6501 Value* value = it.CurrentValue();
6502 value->definition()->AddEnvUse(value);
6503 }
6504}

◆ DeepCopyToOuter()

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

Definition at line 6532 of file il.cc.

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

◆ fixed_parameter_count()

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

Definition at line 11676 of file il.h.

11676{ 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 6451 of file il.cc.

6455 {
6456 Environment* env = new (zone) Environment(
6457 definitions.length(), fixed_parameter_count, lazy_deopt_pruning_count,
6458 parsed_function.function(), nullptr);
6459 for (intptr_t i = 0; i < definitions.length(); ++i) {
6460 env->values_.Add(new (zone) Value(definitions[i]));
6461 }
6462 return env;
6463}
intptr_t fixed_parameter_count() const
Definition il.h:11676
Definition __init__.py:1

◆ function()

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

Definition at line 11688 of file il.h.

11688{ return function_; }

◆ GetDeoptId()

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

Definition at line 11611 of file il.h.

11611 {
11613 return DeoptIdBits::decode(bitfield_);
11614 }
static constexpr intptr_t kNone
Definition deopt_id.h:27

◆ GetLazyDeoptEnv()

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

Definition at line 11636 of file il.h.

11636 {
11639 }
11640 const intptr_t num_args_to_prune = LazyDeoptPruneCount();
11641 if (num_args_to_prune == 0) return this;
11642 return DeepCopy(zone, Length() - num_args_to_prune);
11643 }

◆ IsHoisted()

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

Definition at line 11632 of file il.h.

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

◆ LazyDeoptPruneCount()

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

Definition at line 11616 of file il.h.

11616 {
11617 return LazyDeoptPruningBits::decode(bitfield_);
11618 }

◆ LazyDeoptToBeforeDeoptId()

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

Definition at line 11620 of file il.h.

11620 {
11621 return LazyDeoptToBeforeDeoptId::decode(bitfield_);
11622 }

◆ Length()

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

Definition at line 11658 of file il.h.

11658{ return values_.length(); }

◆ LocationAt()

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

Definition at line 11660 of file il.h.

11660 {
11661 ASSERT((index >= 0) && (index < values_.length()));
11662 return locations_[index];
11663 }

◆ MarkAsHoisted()

void dart::Environment::MarkAsHoisted ( )
inline

Definition at line 11634 of file il.h.

11634{ bitfield_ = Hoisted::update(true, bitfield_); }
static constexpr uintptr_t update(bool value, uintptr_t original)
Definition bitfield.h:190

◆ MarkAsLazyDeoptToBeforeDeoptId()

void dart::Environment::MarkAsLazyDeoptToBeforeDeoptId ( )
inline

Definition at line 11624 of file il.h.

11624 {
11625 bitfield_ = LazyDeoptToBeforeDeoptId::update(true, bitfield_);
11626 // As eager and lazy deopts will target the before environment, we do not
11627 // want to prune inputs on lazy deopts.
11628 bitfield_ = LazyDeoptPruningBits::update(0, bitfield_);
11629 }

◆ outer()

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

Definition at line 11645 of file il.h.

11645{ return outer_; }

◆ Outermost()

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

Definition at line 11647 of file il.h.

11647 {
11648 Environment* result = this;
11649 while (result->outer() != nullptr)
11650 result = result->outer();
11651 return result;
11652 }

◆ PrintTo()

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

◆ PushValue()

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

Definition at line 6465 of file il.cc.

6465 {
6466 values_.Add(value);
6467}
void Add(const T &value)

◆ set_locations()

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

Definition at line 11603 of file il.h.

11603 {
11604 ASSERT(locations_ == nullptr);
11605 locations_ = locations;
11606 }

◆ ToCString()

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

◆ ValueAt()

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

Definition at line 11654 of file il.h.

11654{ return values_[ix]; }

◆ ValueAtUseIndex()

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

Definition at line 11666 of file il.h.

11666 {
11667 const Environment* env = this;
11668 while (index >= env->Length()) {
11669 ASSERT(env->outer_ != nullptr);
11670 index -= env->Length();
11671 env = env->outer_;
11672 }
11673 return env->ValueAt(index);
11674 }

◆ 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 Symbol Documentation

◆ compiler::BlockBuilder

friend class compiler::BlockBuilder
friend

Definition at line 11716 of file il.h.

◆ ShallowIterator

friend class ShallowIterator
friend

Definition at line 11715 of file il.h.


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