コード例 #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;
}
コード例 #2
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), m_extra(NULL)
#ifdef HHVM
    ,LABEL_INIT
#endif
{
  CPP_BUILTIN_CLASS_INIT(Continuation);
}
#undef LABEL_INIT

c_Continuation::~c_Continuation() {}

void c_Continuation::t___construct(
    int64 func, int64 extra, bool isMethod,
    CStrRef origFuncName, CVarRef obj, CArrRef args) {
  INSTANCE_METHOD_INJECTION_BUILTIN(Continuation, Continuation::__construct);
  m_callInfo     = (const CallInfo*) func;
  m_extra        = (void*) extra;
  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;
  ASSERT(m_callInfo);
}