Ejemplo n.º 1
0
void FrameState::forEachLocal(LocalFunc body) const {
  walkAllInlinedLocals(
  [&](uint32_t i, unsigned inlineIdx, const LocalState& local) {
    auto* value = local.unsafe ? nullptr : local.value;
    body(i, value);
  });
}
Ejemplo n.º 2
0
/**
 * This method changes any boxed local into a BoxedInitCell type. It's safe to
 * assume they're init because you can never have a reference to uninit.
 */
void FrameState::dropLocalRefsInnerTypes(LocalStateHook& hook) const {
  walkAllInlinedLocals(
  [&](uint32_t i, unsigned inlineIdx, const LocalState& local) {
    if (local.type.isBoxed()) {
      hook.dropLocalInnerType(i, inlineIdx);
    }
  });
}
Ejemplo n.º 3
0
/**
 * Called to clear out the tracked local values at a call site.  Calls kill all
 * registers, so we don't want to keep locals in registers across calls. We do
 * continue tracking the types in locals, however.
 */
void FrameState::killLocalsForCall(LocalStateHook& hook,
                                   bool skipThisFrame) const {
  walkAllInlinedLocals(
  [&](uint32_t i, unsigned inlineIdx, const LocalState& local) {
    auto* value = local.value;
    if (!value || value->inst()->is(DefConst)) return;

    hook.killLocalForCall(i, inlineIdx, value);
  },
  skipThisFrame);
}
Ejemplo n.º 4
0
//
// This method updates the tracked values and types of all locals that contain
// oldRef so that they now contain newRef.
// This should only be called for ref/boxed types.
//
void FrameState::updateLocalRefValues(LocalStateHook& hook,
                                      SSATmp* oldRef, SSATmp* newRef) const {
  assert(oldRef->type().isBoxed());
  assert(newRef->type().isBoxed());

  walkAllInlinedLocals(
  [&](uint32_t i, unsigned inlineIdx, const LocalState& local) {
    if (local.value != oldRef) return;

    hook.updateLocalRefValue(i, inlineIdx, oldRef, newRef);
  });
}
Ejemplo n.º 5
0
void FrameState::refineLocalValues(LocalStateHook& hook,
                                   SSATmp* oldVal, SSATmp* newVal) const {
  assert(newVal->inst()->is(CheckType, AssertType));
  assert(newVal->inst()->src(0) == oldVal);

  walkAllInlinedLocals(
  [&](uint32_t i, unsigned inlineIdx, const LocalState& local) {
    if (local.value == oldVal) {
      hook.refineLocalValue(i, inlineIdx, oldVal, newVal);
    }
  });
}
Ejemplo n.º 6
0
void FrameState::forEachLocal(LocalFunc body) const {
  walkAllInlinedLocals(
  [&](uint32_t i, unsigned inlineIdx, const LocalState& local) {
    body(i, local.value);
  });
}