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

#include <deferred_objects.h>

Inheritance diagram for dart::DeferredRetAddr:
dart::DeferredSlot

Public Member Functions

 DeferredRetAddr (intptr_t index, intptr_t deopt_id, ObjectPtr *slot, DeferredSlot *next)
 
virtual void Materialize (DeoptContext *deopt_context)
 
intptr_t index () const
 
- Public Member Functions inherited from dart::DeferredSlot
 DeferredSlot (ObjectPtr *slot, DeferredSlot *next)
 
virtual ~DeferredSlot ()
 
ObjectPtrslot () const
 
DeferredSlotnext () const
 
virtual void Materialize (DeoptContext *deopt_context)=0
 

Detailed Description

Definition at line 132 of file deferred_objects.h.

Constructor & Destructor Documentation

◆ DeferredRetAddr()

dart::DeferredRetAddr::DeferredRetAddr ( intptr_t  index,
intptr_t  deopt_id,
ObjectPtr slot,
DeferredSlot next 
)
inline

Definition at line 134 of file deferred_objects.h.

138 : DeferredSlot(slot, next), index_(index), deopt_id_(deopt_id) {}
intptr_t index() const
ObjectPtr * slot() const
DeferredSlot * next() const
DeferredSlot(ObjectPtr *slot, DeferredSlot *next)

Member Function Documentation

◆ index()

intptr_t dart::DeferredRetAddr::index ( ) const
inline

Definition at line 142 of file deferred_objects.h.

142{ return index_; }

◆ Materialize()

void dart::DeferredRetAddr::Materialize ( DeoptContext deopt_context)
virtual

Implements dart::DeferredSlot.

Definition at line 98 of file deferred_objects.cc.

98 {
99 Thread* thread = deopt_context->thread();
100 Zone* zone = deopt_context->zone();
101 Function& function = Function::Handle(zone);
102 function ^= deopt_context->ObjectAt(index_);
103 const Error& error =
105 if (!error.IsNull()) {
107 }
108 const Code& code = Code::Handle(zone, function.unoptimized_code());
109
110 uword continue_at_pc =
111 code.GetPcForDeoptId(deopt_id_, UntaggedPcDescriptors::kDeopt);
112 if (continue_at_pc == 0) {
113 FATAL("Can't locate continuation PC for deoptid %" Pd " within %s\n",
114 deopt_id_, function.ToFullyQualifiedCString());
115 }
116 uword* dest_addr = reinterpret_cast<uword*>(slot());
117 *dest_addr = continue_at_pc;
118
119 if (FLAG_trace_deoptimization_verbose) {
120 OS::PrintErr("materializing return addr at 0x%" Px ": 0x%" Px "\n",
121 reinterpret_cast<uword>(slot()), continue_at_pc);
122 }
123
124 uword pc = code.GetPcForDeoptId(deopt_id_, UntaggedPcDescriptors::kIcCall);
125 if (pc != 0) {
126 // If the deoptimization happened at an IC call, update the IC data
127 // to avoid repeated deoptimization at the same site next time around.
128 // We cannot use CodePatcher::GetInstanceCallAt because the call site
129 // may have switched to from referencing an ICData to a target Code or
130 // MegamorphicCache.
131 ICData& ic_data = ICData::Handle(zone, function.FindICData(deopt_id_));
132 ic_data.AddDeoptReason(deopt_context->deopt_reason());
133 // Propagate the reason to all ICData-s with same deopt_id since
134 // only unoptimized-code ICData (IC calls) are propagated.
135 function.SetDeoptReasonForAll(ic_data.deopt_id(),
136 deopt_context->deopt_reason());
137 } else {
138 if (deopt_context->HasDeoptFlag(ICData::kHoisted)) {
139 // Prevent excessive deoptimization.
140 function.SetProhibitsInstructionHoisting(true);
141 }
142
143 if (deopt_context->HasDeoptFlag(ICData::kGeneralized)) {
144 function.SetProhibitsBoundsCheckGeneralization(true);
145 }
146 }
147}
static ErrorPtr EnsureUnoptimizedCode(Thread *thread, const Function &function)
Definition: compiler.cc:854
static DART_NORETURN void PropagateError(const Error &error)
Definition: exceptions.cc:1003
@ kGeneralized
Definition: object.h:2525
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static Object & Handle()
Definition: object.h:407
#define FATAL(error)
const uint8_t uint32_t uint32_t GError ** error
Dart_NativeFunction function
Definition: fuchsia.cc:51
uintptr_t uword
Definition: globals.h:501
#define Px
Definition: globals.h:410
#define Pd
Definition: globals.h:408

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