Esempio n. 1
0
c_Continuation::c_Continuation(const ObjectStaticCallbacks *cb) :
    ExtObjectData(cb),
#ifndef HHVM
    LABEL_INIT,
#endif
    m_index(-1LL),
    m_value(Variant::nullInit), m_received(Variant::nullInit),
    m_done(false), m_running(false), m_should_throw(false),
    m_isMethod(false), m_callInfo(NULL)
#ifdef HHVM
    , LABEL_INIT
#endif
{
}
#undef LABEL_INIT

c_Continuation::~c_Continuation() {
  if (hhvm) {
    VM::ActRec* ar = actRec();

    // The first local is the object itself, and it wasn't increffed at creation
    // time (see createContinuation()). Overwrite its type to exempt it from
    // refcounting here.
    TypedValue* contLocal = frame_local(ar, 0);
    ASSERT(contLocal->m_data.pobj == this);
    contLocal->m_type = KindOfNull;

    if (ar->hasVarEnv()) {
      VM::VarEnv::destroy(ar->getVarEnv());
    } else {
      frame_free_locals_inl(ar, m_vmFunc->numLocals());
    }
  }
}

void c_Continuation::t___construct(
    int64 func, int64 extra, bool isMethod,
    CStrRef origFuncName, CVarRef obj, CArrRef args) {
  INSTANCE_METHOD_INJECTION_BUILTIN(Continuation, Continuation::__construct);
  if (hhvm) {
    m_vmFunc       = (VM::Func*) extra;
    ASSERT(m_vmFunc);
  } else {
    m_callInfo     = (const CallInfo*) func;
    ASSERT(m_callInfo);
  }
  m_isMethod     = isMethod;
  m_origFuncName = origFuncName;

  if (!obj.isNull()) {
    m_obj = obj.toObject();
    ASSERT(!m_obj.isNull());
  } else {
    ASSERT(m_obj.isNull());
  }
  m_args = args;
}
Esempio n. 2
0
c_Continuation::~c_Continuation() {
  VM::ActRec* ar = actRec();

  // The first local is the object itself, and it wasn't increffed at creation
  // time (see createContinuation()). Overwrite its type to exempt it from
  // refcounting here.
  TypedValue* contLocal = frame_local(ar, 0);
  assert(contLocal->m_data.pobj == this);
  contLocal->m_type = KindOfNull;

  if (ar->hasVarEnv()) {
    VM::VarEnv::destroy(ar->getVarEnv());
  } else {
    frame_free_locals_inl(ar, m_vmFunc->numLocals());
  }
}