5#ifndef RUNTIME_VM_EXCEPTIONS_H_
6#define RUNTIME_VM_EXCEPTIONS_H_
18class DartFrameIterator;
35 bool bypass_debugger =
false);
77 const Array& arguments);
80 DART_NORETURN
static void ThrowOOM();
86 intptr_t expected_from,
87 intptr_t expected_to);
105 uword program_counter,
108 bool clear_deopt_at_target);
143 dest_and_kind_(static_cast<intptr_t>(
SourceKind::kTaggedSlot)) {
207 return src_ == rhs.src_ && dest_and_kind_ == rhs.dest_and_kind_;
212#if !defined(DART_PRECOMPILED_RUNTIME)
216#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)
221 static intptr_t pair_slot_to_index(intptr_t slot) {
222 return (slot < 0) ? -2 * slot : 2 * slot + 1;
225 static intptr_t index_to_pair_slot(intptr_t index) {
227 return ((index & 1) != 0) ? (index >> 1) : -(index >> 1);
231 : src_(
src), dest_and_kind_(dest_and_kind) {}
236 using SourceKindField = BitField<int32_t, SourceKind, 0, 4>;
238 static constexpr intptr_t kHalfSourceBits = 16;
239 using LoSourceSlot = BitField<int32_t, int32_t, 0, kHalfSourceBits>;
241 BitField<int32_t, int32_t, kHalfSourceBits, kHalfSourceBits>;
244 int32_t dest_and_kind_;
257 result->count_ = num_moves;
265 intptr_t
count()
const {
return count_; }
274 const CatchEntryMove* Moves()
const {
275 return reinterpret_cast<const CatchEntryMove*
>(
this + 1);
290#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)
317 : moves_(
moves), ref_count_(new intptr_t(1)) {}
329 bool IsEmpty() {
return ref_count_ ==
nullptr; }
335 if (ref_count_ !=
nullptr) {
337 if (*ref_count_ == 0) {
345 moves_ =
state.moves_;
346 ref_count_ =
state.ref_count_;
347 if (ref_count_ !=
nullptr) {
352 const CatchEntryMoves* moves_;
353 intptr_t* ref_count_;
static constexpr int bitsize()
static constexpr T decode(S value)
static constexpr S encode(T value)
intptr_t dest_slot() const
static CatchEntryMove FromSlot(SourceKind kind, intptr_t src_slot, intptr_t dest_slot)
static CatchEntryMove FromConstant(intptr_t pool_id, intptr_t dest_slot)
intptr_t src_hi_slot() const
const char * ToCString() const
static intptr_t EncodePairSource(intptr_t src_lo_slot, intptr_t src_hi_slot)
bool operator==(const CatchEntryMove &rhs) const
void WriteTo(BaseWriteStream *stream)
intptr_t src_slot() const
SourceKind source_kind() const
static CatchEntryMove ReadFrom(ReadStream *stream)
intptr_t src_lo_slot() const
CatchEntryMoves * ReadMovesForPcOffset(intptr_t pc_offset)
CatchEntryMovesMapReader(const TypedData &bytes)
CatchEntryMovesRefPtr(const CatchEntryMovesRefPtr &state)
const CatchEntryMoves & moves()
CatchEntryMovesRefPtr & operator=(const CatchEntryMovesRefPtr &state)
CatchEntryMovesRefPtr(const CatchEntryMoves *moves)
const CatchEntryMove & At(intptr_t i) const
static void Free(const CatchEntryMoves *moves)
static CatchEntryMoves * Allocate(intptr_t num_moves)
CatchEntryMove & At(intptr_t i)
static DART_NORETURN void ThrowStateError(const Instance &arg)
static DART_NORETURN void ThrowStackOverflow()
static DART_NORETURN void JumpToFrame(Thread *thread, uword program_counter, uword stack_pointer, uword frame_pointer, bool clear_deopt_at_target)
static DART_NORETURN void ThrowByType(ExceptionType type, const Array &arguments)
static DART_NORETURN void ThrowOOM()
static DART_NORETURN void ThrowRangeError(const char *argument_name, const Integer &argument_value, intptr_t expected_from, intptr_t expected_to)
static DART_NORETURN void ThrowUnsupportedError(const char *msg)
static InstancePtr NewInstance(const char *class_name)
static DART_NORETURN void ThrowLateFieldAssignedDuringInitialization(const String &name)
static DART_NORETURN void Throw(Thread *thread, const Instance &exception)
static DART_NORETURN void ThrowArgumentError(const Instance &arg)
static DART_NORETURN void PropagateToEntry(const Error &error)
static ScriptPtr GetCallerScript(DartFrameIterator *iterator)
@ kCyclicInitializationError
@ kAbstractClassInstantiation
@ kLateFieldNotInitialized
@ kLateFieldAssignedDuringInitialization
@ kIntegerDivisionByZeroException
static StackTracePtr CurrentStackTrace()
static DART_NORETURN void ThrowLateFieldNotInitialized(const String &name)
static DART_NORETURN void ThrowCompileTimeError(const LanguageError &error)
static ObjectPtr Create(ExceptionType type, const Array &arguments)
static UnhandledExceptionPtr CreateUnhandledException(Zone *zone, ExceptionType type, const char *msg)
static DART_NORETURN void ReThrow(Thread *thread, const Instance &exception, const Instance &stacktrace, bool bypass_debugger=false)
static void CreateAndThrowTypeError(TokenPosition location, const AbstractType &src_type, const AbstractType &dst_type, const String &dst_name)
static DART_NORETURN void ThrowWithStackTrace(Thread *thread, const Instance &exception, const Instance &stacktrace)
static DART_NORETURN void PropagateError(const Error &error)
const uint8_t uint32_t uint32_t GError ** error
void * malloc(size_t size)
const char *const class_name
uint32_t handler_pc_offset