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

#include <compiler_state.h>

Inheritance diagram for dart::CompilerState:
dart::ThreadStackResource dart::StackResource

Public Member Functions

 CompilerState (Thread *thread, bool is_aot, bool is_optimizing, CompilerTracing tracing=CompilerTracing::kOn)
 
 ~CompilerState ()
 
CHAcha ()
 
intptr_t deopt_id () const
 
void set_deopt_id (int value)
 
intptr_t GetNextDeoptId ()
 
SlotCacheslot_cache () const
 
void set_slot_cache (SlotCache *cache)
 
bool is_aot () const
 
bool is_optimizing () const
 
bool should_clone_fields ()
 
bool should_trace () const
 
const ClassComparableClass ()
 
const FunctionStringBaseInterpolate ()
 
const FunctionStringBaseInterpolateSingle ()
 
const FunctionTypedListGetFloat32 ()
 
const FunctionTypedListSetFloat32 ()
 
const FunctionTypedListGetFloat64 ()
 
const FunctionTypedListSetFloat64 ()
 
const FunctionTypedListGetFloat32x4 ()
 
const FunctionTypedListSetFloat32x4 ()
 
const FunctionTypedListGetInt32x4 ()
 
const FunctionTypedListSetInt32x4 ()
 
const FunctionTypedListGetFloat64x2 ()
 
const FunctionTypedListSetFloat64x2 ()
 
const ClassArrayClass ()
 
const ClassCompoundClass ()
 
const ClassStructClass ()
 
const ClassTypedDataClass ()
 
const ClassUnionClass ()
 
const FieldCompoundOffsetInBytesField ()
 
const FieldCompoundTypedDataBaseField ()
 
const Functionfunction () const
 
void set_function (const Function &function)
 
void set_current_pass (const CompilerPass *pass, const CompilerPassState *pass_state)
 
const CompilerPasspass () const
 
const CompilerPassStatepass_state () const
 
void ReportCrash ()
 
- Public Member Functions inherited from dart::ThreadStackResource
 ThreadStackResource (Thread *T)
 
 ~ThreadStackResource ()
 
Threadthread () const
 
Isolateisolate () const
 
IsolateGroupisolate_group () const
 
- Public Member Functions inherited from dart::StackResource
 StackResource (ThreadState *thread)
 
virtual ~StackResource ()
 
ThreadStatethread () const
 

Static Public Member Functions

static CompilerStateCurrent ()
 
static bool ShouldTrace ()
 
static CompilerTracing ShouldTrace (const Function &func)
 
- Static Public Member Functions inherited from dart::StackResource
static void Unwind (ThreadState *thread)
 
static void UnwindAbove (ThreadState *thread, StackResource *new_top)
 

Detailed Description

Definition at line 34 of file compiler_state.h.

Constructor & Destructor Documentation

◆ CompilerState()

dart::CompilerState::CompilerState ( Thread thread,
bool  is_aot,
bool  is_optimizing,
CompilerTracing  tracing = CompilerTracing::kOn 
)
inline

Definition at line 36 of file compiler_state.h.

41 cha_(thread),
42 is_aot_(is_aot),
43 is_optimizing_(is_optimizing),
44 tracing_(tracing) {
45 previous_ = thread->SetCompilerState(this);
46 }
bool is_optimizing() const

◆ ~CompilerState()

dart::CompilerState::~CompilerState ( )
inline

Definition at line 48 of file compiler_state.h.

48 {
49 ASSERT(&thread()->compiler_state() == this);
50 thread()->SetCompilerState(previous_);
51 }
#define ASSERT(E)

Member Function Documentation

◆ ArrayClass()

const Class & dart::CompilerState::ArrayClass ( )

◆ cha()

CHA & dart::CompilerState::cha ( )
inline

Definition at line 53 of file compiler_state.h.

53{ return cha_; }

◆ ComparableClass()

const Class & dart::CompilerState::ComparableClass ( )

Definition at line 45 of file compiler_state.cc.

45 {
46 if (comparable_class_ == nullptr) {
47 Thread* thread = Thread::Current();
48 Zone* zone = thread->zone();
49
50 // When obfuscation is enabled we need to obfuscate the name of the
51 // class before looking it up.
52 String& name = String::Handle(zone, Symbols::New(thread, "Comparable"));
53 if (thread->isolate_group()->obfuscate()) {
54 Obfuscator obfuscator(thread, Object::null_string());
55 name = obfuscator.Rename(name);
56 }
57
58 const Library& lib = Library::Handle(zone, Library::CoreLibrary());
59 const Class& cls = Class::ZoneHandle(zone, lib.LookupClass(name));
60 ASSERT(!cls.IsNull());
61 comparable_class_ = &cls;
62 }
63 return *comparable_class_;
64}
static LibraryPtr CoreLibrary()
Definition object.cc:14834
static Object & Handle()
Definition object.h:407
static Object & ZoneHandle()
Definition object.h:419
static StringPtr New(Thread *thread, const char *cstr)
Definition symbols.h:722
Zone * zone() const
static Thread * Current()
Definition thread.h:361
IsolateGroup * isolate_group() const
Definition thread.h:540
const char *const name

◆ CompoundClass()

const Class & dart::CompilerState::CompoundClass ( )

◆ CompoundOffsetInBytesField()

const Field & dart::CompilerState::CompoundOffsetInBytesField ( )

Definition at line 152 of file compiler_state.cc.

152 {
153 if (compound_offset_in_bytes_field_ == nullptr) {
154 Thread* thread = Thread::Current();
155 Zone* zone = thread->zone();
156 const auto& field =
157 Field::ZoneHandle(zone, CompoundClass().LookupInstanceFieldAllowPrivate(
158 Symbols::_offsetInBytes()));
159 ASSERT(!field.IsNull());
160 compound_offset_in_bytes_field_ = &field;
161 }
162 return *compound_offset_in_bytes_field_;
163}
const Class & CompoundClass()

◆ CompoundTypedDataBaseField()

const Field & dart::CompilerState::CompoundTypedDataBaseField ( )

Definition at line 165 of file compiler_state.cc.

165 {
166 if (compound_typed_data_base_field_ == nullptr) {
167 Thread* thread = Thread::Current();
168 Zone* zone = thread->zone();
169 const auto& field =
170 Field::ZoneHandle(zone, CompoundClass().LookupInstanceFieldAllowPrivate(
171 Symbols::_typedDataBase()));
172 ASSERT(!field.IsNull());
173 compound_typed_data_base_field_ = &field;
174 }
175 return *compound_typed_data_base_field_;
176}

◆ Current()

static CompilerState & dart::CompilerState::Current ( )
inlinestatic

Definition at line 68 of file compiler_state.h.

68 {
70 }
CompilerState & compiler_state()
Definition thread.h:583

◆ deopt_id()

intptr_t dart::CompilerState::deopt_id ( ) const
inline

Definition at line 55 of file compiler_state.h.

55{ return deopt_id_; }

◆ function()

const Function * dart::CompilerState::function ( ) const
inline

Definition at line 117 of file compiler_state.h.

117{ return function_; }

◆ GetNextDeoptId()

intptr_t dart::CompilerState::GetNextDeoptId ( )
inline

Definition at line 61 of file compiler_state.h.

61 {
62 ASSERT(deopt_id_ != DeoptId::kNone);
63 const intptr_t id = deopt_id_;
64 deopt_id_ = DeoptId::Next(deopt_id_);
65 return id;
66 }
static constexpr intptr_t kNone
Definition deopt_id.h:27
static intptr_t Next(intptr_t deopt_id)
Definition deopt_id.h:29
const uintptr_t id

◆ is_aot()

bool dart::CompilerState::is_aot ( ) const
inline

Definition at line 75 of file compiler_state.h.

75{ return is_aot_; }

◆ is_optimizing()

bool dart::CompilerState::is_optimizing ( ) const
inline

Definition at line 77 of file compiler_state.h.

77{ return is_optimizing_; }

◆ pass()

const CompilerPass * dart::CompilerState::pass ( ) const
inline

Definition at line 126 of file compiler_state.h.

126{ return pass_; }

◆ pass_state()

const CompilerPassState * dart::CompilerState::pass_state ( ) const
inline

Definition at line 127 of file compiler_state.h.

127{ return pass_state_; }

◆ ReportCrash()

void dart::CompilerState::ReportCrash ( )

Definition at line 178 of file compiler_state.cc.

178 {
179 OS::PrintErr("=== Crash occurred when compiling %s in %s mode in %s pass\n",
180 function() != nullptr ? function()->ToFullyQualifiedCString()
181 : "unknown function",
182 is_aot() ? "AOT"
183 : is_optimizing() ? "optimizing JIT"
184 : "unoptimized JIT",
185 pass() != nullptr ? pass()->name() : "unknown");
186 if (pass_state() != nullptr && pass()->id() == CompilerPass::kGenerateCode) {
187 if (pass_state()->graph_compiler->current_block() != nullptr) {
188 OS::PrintErr("=== When compiling block %s\n",
189 pass_state()->graph_compiler->current_block()->ToCString());
190 }
191 if (pass_state()->graph_compiler->current_instruction() != nullptr) {
193 "=== When compiling instruction %s\n",
194 pass_state()->graph_compiler->current_instruction()->ToCString());
195 }
196 }
197 if (pass_state() != nullptr && pass_state()->flow_graph() != nullptr) {
198 pass_state()->flow_graph()->Print(pass()->name());
199 } else {
200 OS::PrintErr("=== Flow Graph not available\n");
201 }
202}
const CompilerPass * pass() const
const CompilerPassState * pass_state() const
const Function * function() const
void Print(const char *phase="unknown")
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
FlowGraph * flow_graph() const

◆ set_current_pass()

void dart::CompilerState::set_current_pass ( const CompilerPass pass,
const CompilerPassState pass_state 
)
inline

Definition at line 120 of file compiler_state.h.

121 {
122 pass_ = pass;
123 pass_state_ = pass_state;
124 }

◆ set_deopt_id()

void dart::CompilerState::set_deopt_id ( int  value)
inline

Definition at line 56 of file compiler_state.h.

56 {
57 ASSERT(value >= 0);
58 deopt_id_ = value;
59 }
uint8_t value

◆ set_function()

void dart::CompilerState::set_function ( const Function function)
inline

Definition at line 119 of file compiler_state.h.

119{ function_ = &function; }

◆ set_slot_cache()

void dart::CompilerState::set_slot_cache ( SlotCache cache)
inline

Definition at line 73 of file compiler_state.h.

73{ slot_cache_ = cache; }
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent cache
Definition switches.h:191

◆ should_clone_fields()

bool dart::CompilerState::should_clone_fields ( )
inline

Definition at line 78 of file compiler_state.h.

78 {
79 return !is_aot() && (is_optimizing() || FLAG_force_clone_compiler_objects);
80 }

◆ should_trace()

bool dart::CompilerState::should_trace ( ) const
inline

Definition at line 82 of file compiler_state.h.

82{ return tracing_ == CompilerTracing::kOn; }

◆ ShouldTrace() [1/2]

static bool dart::CompilerState::ShouldTrace ( )
inlinestatic

Definition at line 84 of file compiler_state.h.

84{ return Current().should_trace(); }
bool should_trace() const
static CompilerState & Current()

◆ ShouldTrace() [2/2]

CompilerTracing dart::CompilerState::ShouldTrace ( const Function func)
static

Definition at line 40 of file compiler_state.cc.

40 {
43}
static bool ShouldPrint(const Function &function, uint8_t **compiler_pass_filter=nullptr)

◆ slot_cache()

SlotCache * dart::CompilerState::slot_cache ( ) const
inline

Definition at line 72 of file compiler_state.h.

72{ return slot_cache_; }

◆ StringBaseInterpolate()

const Function & dart::CompilerState::StringBaseInterpolate ( )

Definition at line 81 of file compiler_state.cc.

81 {
82 if (interpolate_ == nullptr) {
83 Thread* thread = Thread::Current();
84 Zone* zone = thread->zone();
85
86 const Class& cls =
87 Class::Handle(Library::LookupCoreClass(Symbols::StringBase()));
88 ASSERT(!cls.IsNull());
89 interpolate_ = &Function::ZoneHandle(
90 zone, cls.LookupFunctionAllowPrivate(Symbols::Interpolate()));
91 ASSERT(!interpolate_->IsNull());
92 }
93 return *interpolate_;
94}
static ClassPtr LookupCoreClass(const String &class_name)
Definition object.cc:14736
bool IsNull() const
Definition object.h:363

◆ StringBaseInterpolateSingle()

const Function & dart::CompilerState::StringBaseInterpolateSingle ( )

Definition at line 66 of file compiler_state.cc.

66 {
67 if (interpolate_single_ == nullptr) {
68 Thread* thread = Thread::Current();
69 Zone* zone = thread->zone();
70
71 const Class& cls =
72 Class::Handle(Library::LookupCoreClass(Symbols::StringBase()));
73 ASSERT(!cls.IsNull());
74 interpolate_single_ = &Function::ZoneHandle(
75 zone, cls.LookupFunctionAllowPrivate(Symbols::InterpolateSingle()));
76 ASSERT(!interpolate_single_->IsNull());
77 }
78 return *interpolate_single_;
79}

◆ StructClass()

const Class & dart::CompilerState::StructClass ( )

◆ TypedDataClass()

const Class & dart::CompilerState::TypedDataClass ( )

◆ TypedListGetFloat32()

const Function & dart::CompilerState::TypedListGetFloat32 ( )

◆ TypedListGetFloat32x4()

const Function & dart::CompilerState::TypedListGetFloat32x4 ( )

◆ TypedListGetFloat64()

const Function & dart::CompilerState::TypedListGetFloat64 ( )

◆ TypedListGetFloat64x2()

const Function & dart::CompilerState::TypedListGetFloat64x2 ( )

◆ TypedListGetInt32x4()

const Function & dart::CompilerState::TypedListGetInt32x4 ( )

◆ TypedListSetFloat32()

const Function & dart::CompilerState::TypedListSetFloat32 ( )

◆ TypedListSetFloat32x4()

const Function & dart::CompilerState::TypedListSetFloat32x4 ( )

◆ TypedListSetFloat64()

const Function & dart::CompilerState::TypedListSetFloat64 ( )

◆ TypedListSetFloat64x2()

const Function & dart::CompilerState::TypedListSetFloat64x2 ( )

◆ TypedListSetInt32x4()

const Function & dart::CompilerState::TypedListSetInt32x4 ( )

◆ UnionClass()

const Class & dart::CompilerState::UnionClass ( )

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