Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
dart::NativeCallInstr Class Reference

#include <il.h>

Inheritance diagram for dart::NativeCallInstr:
dart::TemplateDartCall< 0 > dart::VariadicDefinition dart::Definition dart::Instruction dart::ZoneAllocated

Public Member Functions

 NativeCallInstr (const String &name, const Function &function, bool link_lazily, const InstructionSource &source, InputsArray &&args)
 
const Stringnative_name () const
 
const Functionfunction () const
 
NativeFunction native_c_function () const
 
bool is_bootstrap_native () const
 
bool is_auto_scope () const
 
bool link_lazily () const
 
virtual TokenPosition token_pos () const
 
virtual bool ComputeCanDeoptimize () const
 
virtual bool HasUnknownSideEffects () const
 
virtual bool CanCallDart () const
 
void SetupNative ()
 
 DECLARE_INSTRUCTION_SERIALIZABLE_FIELDS (NativeCallInstr, TemplateDartCall, FIELD_LIST) private
 
void set_is_bootstrap_native (bool value)
 
void set_is_auto_scope (bool value)
 
 DISALLOW_COPY_AND_ASSIGN (NativeCallInstr)
 
- Public Member Functions inherited from dart::TemplateDartCall< 0 >
 TemplateDartCall (intptr_t deopt_id, intptr_t type_args_len, const Array &argument_names, InputsArray &&inputs, const InstructionSource &source)
 
StringPtr Selector ()
 
virtual bool MayThrow () const
 
virtual bool CanCallDart () const
 
virtual bool ComputeCanDeoptimize () const
 
virtual bool ComputeCanDeoptimizeAfterCall () const
 
virtual intptr_t NumberOfInputsConsumedBeforeCall () const
 
intptr_t FirstArgIndex () const
 
ValueReceiver () const
 
intptr_t ArgumentCountWithoutTypeArgs () const
 
intptr_t ArgumentsSizeWithoutTypeArgs () const
 
intptr_t ArgumentCount () const
 
virtual intptr_t ArgumentsSize () const
 
virtual void SetMoveArguments (MoveArgumentsArray *move_arguments)
 
virtual MoveArgumentsArrayGetMoveArguments () const
 
virtual void ReplaceInputsWithMoveArguments (MoveArgumentsArray *move_arguments)
 
intptr_t type_args_len () const
 
const Arrayargument_names () const
 
virtual TokenPosition token_pos () const
 
ArrayPtr GetArgumentsDescriptor () const
 
- Public Member Functions inherited from dart::VariadicDefinition
 VariadicDefinition (InputsArray &&inputs, intptr_t deopt_id=DeoptId::kNone)
 
 VariadicDefinition (InputsArray &&inputs, const InstructionSource &source, intptr_t deopt_id=DeoptId::kNone)
 
 VariadicDefinition (const intptr_t num_inputs, intptr_t deopt_id=DeoptId::kNone)
 
intptr_t InputCount () const
 
ValueInputAt (intptr_t i) const
 
- Public Member Functions inherited from dart::Definition
 Definition (intptr_t deopt_id=DeoptId::kNone)
 
 Definition (const InstructionSource &source, intptr_t deopt_id=DeoptId::kNone)
 
virtual intptr_t CallCount () const
 
intptr_t temp_index () const
 
void set_temp_index (intptr_t index)
 
void ClearTempIndex ()
 
bool HasTemp () const
 
intptr_t ssa_temp_index () const
 
void set_ssa_temp_index (intptr_t index)
 
bool HasSSATemp () const
 
void ClearSSATempIndex ()
 
intptr_t vreg (intptr_t index) const
 
intptr_t location_count () const
 
bool HasPairRepresentation () const
 
CompileTypeType ()
 
bool HasType () const
 
bool IsInt64Definition ()
 
bool IsInt32Definition ()
 
virtual CompileType ComputeType () const
 
virtual bool RecomputeType ()
 
PRINT_OPERANDS_TO_SUPPORT PRINT_TO_SUPPORT bool UpdateType (CompileType new_type)
 
bool HasUses () const
 
bool HasOnlyUse (Value *use) const
 
bool HasOnlyInputUse (Value *use) const
 
Valueinput_use_list () const
 
void set_input_use_list (Value *head)
 
Valueenv_use_list () const
 
void set_env_use_list (Value *head)
 
ValueListIterable input_uses () const
 
void AddInputUse (Value *value)
 
void AddEnvUse (Value *value)
 
virtual bool MayCreateUnsafeUntaggedPointer () const
 
virtual bool CanReplaceWithConstant () const
 
virtual bool CanEliminate (const BlockEntryInstr *block) const
 
void ReplaceUsesWith (Definition *other)
 
void ReplaceWithResult (Instruction *replacement, Definition *replacement_for_uses, ForwardInstructionIterator *iterator)
 
void ReplaceWith (Definition *other, ForwardInstructionIterator *iterator)
 
Objectconstant_value ()
 
virtual void InferRange (RangeAnalysis *analysis, Range *range)
 
Rangerange () const
 
void set_range (const Range &)
 
virtual DefinitionCanonicalize (FlowGraph *flow_graph)
 
DefinitionReplacement ()
 
void SetReplacement (Definition *other)
 
virtual AliasIdentity Identity () const
 
virtual void SetIdentity (AliasIdentity identity)
 
DefinitionOriginalDefinition ()
 
virtual ValueRedefinedValue () const
 
DefinitionOriginalDefinitionIgnoreBoxingAndConstraints ()
 
virtual DefinitionAsDefinition ()
 
virtual const DefinitionAsDefinition () const
 
- Public Member Functions inherited from dart::Instruction
 Instruction (const InstructionSource &source, intptr_t deopt_id=DeoptId::kNone)
 
 Instruction (intptr_t deopt_id=DeoptId::kNone)
 
virtual ~Instruction ()
 
virtual Tag tag () const =0
 
virtual intptr_t statistics_tag () const
 
intptr_t deopt_id () const
 
virtual TokenPosition token_pos () const
 
InstructionSource source () const
 
virtual intptr_t InputCount () const =0
 
virtual ValueInputAt (intptr_t i) const =0
 
void SetInputAt (intptr_t i, Value *value)
 
InputsIterable inputs ()
 
void UnuseAllInputs ()
 
virtual intptr_t ArgumentCount () const
 
ValueArgumentValueAt (intptr_t index) const
 
DefinitionArgumentAt (intptr_t index) const
 
virtual void SetMoveArguments (MoveArgumentsArray *move_arguments)
 
virtual MoveArgumentsArrayGetMoveArguments () const
 
virtual void ReplaceInputsWithMoveArguments (MoveArgumentsArray *move_arguments)
 
bool HasMoveArguments () const
 
void RepairArgumentUsesInEnvironment () const
 
virtual bool ComputeCanDeoptimize () const =0
 
virtual bool ComputeCanDeoptimizeAfterCall () const
 
bool CanDeoptimize () const
 
virtual void Accept (InstructionVisitor *visitor)=0
 
Instructionprevious () const
 
void set_previous (Instruction *instr)
 
Instructionnext () const
 
void set_next (Instruction *instr)
 
void LinkTo (Instruction *next)
 
InstructionRemoveFromGraph (bool return_previous=true)
 
virtual intptr_t SuccessorCount () const
 
virtual BlockEntryInstrSuccessorAt (intptr_t index) const
 
SuccessorsIterable successors () const
 
void Goto (JoinEntryInstr *entry)
 
virtual const char * DebugName () const =0
 
void CheckField (const Field &field) const
 
const char * ToCString () const
 
 DECLARE_INSTRUCTION_TYPE_CHECK (BlockEntryWithInitialDefs, BlockEntryWithInitialDefs) template< typename T > T *Cast()
 
template<typename T >
const TCast () const
 
LocationSummarylocs ()
 
bool HasLocs () const
 
virtual LocationSummaryMakeLocationSummary (Zone *zone, bool is_optimizing) const =0
 
void InitializeLocationSummary (Zone *zone, bool optimizing)
 
virtual void EmitNativeCode (FlowGraphCompiler *compiler)
 
Environmentenv () const
 
void SetEnvironment (Environment *deopt_env)
 
void RemoveEnvironment ()
 
void ReplaceInEnvironment (Definition *current, Definition *replacement)
 
virtual intptr_t NumberOfInputsConsumedBeforeCall () const
 
intptr_t GetPassSpecificId (CompilerPass::Id pass) const
 
void SetPassSpecificId (CompilerPass::Id pass, intptr_t id)
 
bool HasPassSpecificId (CompilerPass::Id pass) const
 
bool HasUnmatchedInputRepresentations () const
 
virtual Representation RequiredInputRepresentation (intptr_t idx) const
 
SpeculativeMode SpeculativeModeOfInputs () const
 
virtual SpeculativeMode SpeculativeModeOfInput (intptr_t index) const
 
virtual Representation representation () const
 
bool WasEliminated () const
 
virtual intptr_t DeoptimizationTarget () const
 
virtual InstructionCanonicalize (FlowGraph *flow_graph)
 
void InsertBefore (Instruction *next)
 
void InsertAfter (Instruction *prev)
 
InstructionAppendInstruction (Instruction *tail)
 
virtual bool AllowsCSE () const
 
virtual bool HasUnknownSideEffects () const =0
 
virtual bool CanCallDart () const
 
virtual bool CanTriggerGC () const
 
virtual BlockEntryInstrGetBlock ()
 
virtual intptr_t inlining_id () const
 
virtual void set_inlining_id (intptr_t value)
 
virtual bool has_inlining_id () const
 
virtual uword Hash () const
 
bool Equals (const Instruction &other) const
 
virtual bool AttributesEqual (const Instruction &other) const
 
void InheritDeoptTarget (Zone *zone, Instruction *other)
 
bool NeedsEnvironment () const
 
virtual bool CanBecomeDeoptimizationTarget () const
 
void InheritDeoptTargetAfter (FlowGraph *flow_graph, Definition *call, Definition *result)
 
virtual bool MayThrow () const =0
 
virtual bool MayHaveVisibleEffect () const
 
virtual bool CanEliminate (const BlockEntryInstr *block) const
 
bool CanEliminate ()
 
bool IsDominatedBy (Instruction *dom)
 
void ClearEnv ()
 
void Unsupported (FlowGraphCompiler *compiler)
 
virtual bool UseSharedSlowPathStub (bool is_optimizing) const
 
Location::Kind RegisterKindForResult () const
 
- 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)
 

Public Attributes

NativeFunction native_c_function_ = nullptr
 
bool is_bootstrap_native_ = false
 
bool is_auto_scope_ = true
 
bool link_lazily_ = true
 

Additional Inherited Members

- Public Types inherited from dart::Instruction
enum  Tag { FOR_EACH_INSTRUCTION =(DECLARE_TAG) kNumInstructions }
 
enum  SpeculativeMode { kGuardInputs , kNotSpeculative }
 
using InputsIterable = InstructionIndexedPropertyIterable< InputsTrait >
 
using SuccessorsIterable = InstructionIndexedPropertyIterable< SuccessorsTrait >
 
- Static Public Member Functions inherited from dart::Definition
static bool IsArrayLength (Definition *def)
 
- Static Public Member Functions inherited from dart::Instruction
static const ICDataGetICData (const ZoneGrowableArray< const ICData * > &ic_data_array, intptr_t deopt_id, bool is_static_call)
 
static LocationSummaryMakeCallSummary (Zone *zone, const Instruction *instr, LocationSummary *locs=nullptr)
 
static bool SlowPathSharingSupported (bool is_optimizing)
 
- Static Public Attributes inherited from dart::Definition
static constexpr intptr_t kReplacementMarker = -2
 
- Static Public Attributes inherited from dart::Instruction
static const intptr_t kInstructionAttrs [kNumInstructions]
 
- Protected Member Functions inherited from dart::Definition
void set_type (CompileType *type)
 
- Protected Member Functions inherited from dart::Instruction
intptr_t GetDeoptId () const
 
virtual void CopyDeoptIdFrom (const Instruction &instr)
 
void WriteExtraWithoutInputs (FlowGraphSerializer *s)
 
void ReadExtraWithoutInputs (FlowGraphDeserializer *d)
 
- Protected Attributes inherited from dart::VariadicDefinition
InputsArray inputs_
 
- Protected Attributes inherited from dart::Definition
Rangerange_ = nullptr
 

Detailed Description

Definition at line 5997 of file il.h.

Constructor & Destructor Documentation

◆ NativeCallInstr()

dart::NativeCallInstr::NativeCallInstr ( const String name,
const Function function,
bool  link_lazily,
const InstructionSource source,
InputsArray &&  args 
)
inline

Definition at line 5999 of file il.h.

6005 0,
6006 Array::null_array(),
6007 std::move(args),
6008 source),
6009 native_name_(name),
6010 function_(function),
6011 token_pos_(source.token_pos),
6013 DEBUG_ASSERT(name.IsNotTemporaryScopedHandle());
6014 DEBUG_ASSERT(function.IsNotTemporaryScopedHandle());
6015 // +1 for return value placeholder.
6017 function.NumParameters() + (function.IsGeneric() ? 1 : 0) + 1);
6018 }
#define DEBUG_ASSERT(cond)
Definition: assert.h:321
static constexpr intptr_t kNone
Definition: deopt_id.h:27
bool IsGeneric() const
Definition: object.cc:8844
intptr_t NumParameters() const
Definition: object.cc:8877
InstructionSource source() const
Definition: il.h:1008
const Function & function() const
Definition: il.h:6023
bool link_lazily() const
Definition: il.h:6027
intptr_t ArgumentCount() const
Definition: il.h:4586
TemplateDartCall(intptr_t deopt_id, intptr_t type_args_len, const Array &argument_names, InputsArray &&inputs, const InstructionSource &source)
Definition: il.h:4550
#define ASSERT(E)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
const char *const name
const TokenPosition token_pos

Member Function Documentation

◆ CanCallDart()

virtual bool dart::NativeCallInstr::CanCallDart ( ) const
inlinevirtual

Reimplemented from dart::TemplateDartCall< 0 >.

Definition at line 6035 of file il.h.

6035{ return false; }

◆ ComputeCanDeoptimize()

virtual bool dart::NativeCallInstr::ComputeCanDeoptimize ( ) const
inlinevirtual

Reimplemented from dart::TemplateDartCall< 0 >.

Definition at line 6030 of file il.h.

6030{ return false; }

◆ DECLARE_INSTRUCTION_SERIALIZABLE_FIELDS()

dart::NativeCallInstr::DECLARE_INSTRUCTION_SERIALIZABLE_FIELDS ( NativeCallInstr  ,
TemplateDartCall  ,
FIELD_LIST   
)
inline

Definition at line 6046 of file il.h.

6051 :
6052 void set_native_c_function(NativeFunction value) {
6054 }
NativeFunction native_c_function_
Definition: il.h:6061
uint8_t value
void(* NativeFunction)(NativeArguments *arguments)

◆ DISALLOW_COPY_AND_ASSIGN()

dart::NativeCallInstr::DISALLOW_COPY_AND_ASSIGN ( NativeCallInstr  )

◆ function()

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

Definition at line 6023 of file il.h.

6023{ return function_; }

◆ HasUnknownSideEffects()

virtual bool dart::NativeCallInstr::HasUnknownSideEffects ( ) const
inlinevirtual

Implements dart::Instruction.

Definition at line 6032 of file il.h.

6032{ return true; }

◆ is_auto_scope()

bool dart::NativeCallInstr::is_auto_scope ( ) const
inline

Definition at line 6026 of file il.h.

6026{ return is_auto_scope_; }
bool is_auto_scope_
Definition: il.h:6063

◆ is_bootstrap_native()

bool dart::NativeCallInstr::is_bootstrap_native ( ) const
inline

Definition at line 6025 of file il.h.

6025{ return is_bootstrap_native_; }
bool is_bootstrap_native_
Definition: il.h:6062

◆ link_lazily()

bool dart::NativeCallInstr::link_lazily ( ) const
inline

Definition at line 6027 of file il.h.

6027{ return link_lazily_; }

◆ native_c_function()

NativeFunction dart::NativeCallInstr::native_c_function ( ) const
inline

Definition at line 6024 of file il.h.

6024{ return native_c_function_; }

◆ native_name()

const String & dart::NativeCallInstr::native_name ( ) const
inline

Definition at line 6022 of file il.h.

6022{ return native_name_; }

◆ set_is_auto_scope()

void dart::NativeCallInstr::set_is_auto_scope ( bool  value)
inline

Definition at line 6057 of file il.h.

6057{ is_auto_scope_ = value; }

◆ set_is_bootstrap_native()

void dart::NativeCallInstr::set_is_bootstrap_native ( bool  value)
inline

Definition at line 6056 of file il.h.

◆ SetupNative()

void dart::NativeCallInstr::SetupNative ( )

Definition at line 7347 of file il.cc.

7347 {
7348 if (link_lazily()) {
7349 // Resolution will happen during NativeEntry::LinkNativeCall.
7350 return;
7351 }
7352
7353 Thread* thread = Thread::Current();
7354 Zone* zone = thread->zone();
7355
7356 // Currently we perform unoptimized compilations only on mutator threads. If
7357 // the compiler has to resolve a native to a function pointer it calls out to
7358 // the embedder to do so.
7359 //
7360 // Unfortunately that embedder API was designed by giving it a handle to a
7361 // string. So the embedder will have to call back into the VM to convert it to
7362 // a C string - which requires an active isolate.
7363 //
7364 // => To allow this `dart-->jit-compiler-->embedder-->dart api` we set the
7365 // active isolate again.
7366 //
7367 ActiveIsolateScope active_isolate(thread);
7368
7369 const Class& cls = Class::Handle(zone, function().Owner());
7370 const Library& library = Library::Handle(zone, cls.library());
7371
7372 Dart_NativeEntryResolver resolver = library.native_entry_resolver();
7375
7376 const int num_params =
7378 bool auto_setup_scope = true;
7380 library, native_name(), num_params, &auto_setup_scope);
7381 if (native_function == nullptr) {
7382 if (has_inlining_id()) {
7383 UNIMPLEMENTED();
7384 }
7387 "native function '%s' (%" Pd " arguments) cannot be found",
7388 native_name().ToCString(), function().NumParameters());
7389 }
7390 set_is_auto_scope(auto_setup_scope);
7391 set_native_c_function(native_function);
7392}
static bool IsBootstrapResolver(Dart_NativeEntryResolver resolver)
const char * ToCString() const
Definition: il_printer.cc:1683
virtual bool has_inlining_id() const
Definition: il.h:1317
static intptr_t ParameterCountForResolution(const Function &function)
void set_is_bootstrap_native(bool value)
Definition: il.h:6056
const String & native_name() const
Definition: il.h:6022
virtual TokenPosition token_pos() const
Definition: il.h:6028
void set_is_auto_scope(bool value)
Definition: il.h:6057
bool is_bootstrap_native() const
Definition: il.h:6025
static NativeFunction ResolveNative(const Library &library, const String &function_name, int number_of_arguments, bool *auto_setup_scope)
Definition: native_entry.cc:37
static Object & Handle()
Definition: object.h:407
static void MessageF(Kind kind, const Script &script, TokenPosition token_pos, bool report_after_token, const char *format,...) PRINTF_ATTRIBUTE(5
Definition: report.cc:123
static constexpr bool AtLocation
Definition: report.h:29
static Thread * Current()
Definition: thread.h:362
Dart_NativeFunction(* Dart_NativeEntryResolver)(Dart_Handle name, int num_of_arguments, bool *auto_setup_scope)
Definition: dart_api.h:3234
#define UNIMPLEMENTED
#define Pd
Definition: globals.h:408

◆ token_pos()

virtual TokenPosition dart::NativeCallInstr::token_pos ( ) const
inlinevirtual

Reimplemented from dart::TemplateDartCall< 0 >.

Definition at line 6028 of file il.h.

6028{ return token_pos_; }

Member Data Documentation

◆ is_auto_scope_

bool dart::NativeCallInstr::is_auto_scope_ = true

Definition at line 6063 of file il.h.

◆ is_bootstrap_native_

bool dart::NativeCallInstr::is_bootstrap_native_ = false

Definition at line 6062 of file il.h.

◆ link_lazily_

bool dart::NativeCallInstr::link_lazily_ = true

Definition at line 6064 of file il.h.

◆ native_c_function_

NativeFunction dart::NativeCallInstr::native_c_function_ = nullptr

Definition at line 6061 of file il.h.


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