本文整理汇总了C++中ActRec类的典型用法代码示例。如果您正苦于以下问题:C++ ActRec类的具体用法?C++ ActRec怎么用?C++ ActRec使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ActRec类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: actRec
c_Continuation::~c_Continuation() {
ActRec* ar = actRec();
if (ar->hasVarEnv()) {
ar->getVarEnv()->detach(ar);
} else {
frame_free_locals_inl(ar, ar->m_func->numLocals());
}
}
示例2: f_get_called_class
Variant f_get_called_class() {
EagerCallerFrame cf;
ActRec* ar = cf();
if (ar) {
if (ar->hasThis()) return Variant(ar->getThis()->o_getClassName());
if (ar->hasClass()) return Variant(ar->getClass()->preClass()->name());
}
return Variant(false);
}
示例3: f_func_get_args
Variant f_func_get_args() {
EagerCallerFrame cf;
ActRec* ar = cf.actRecForArgs();
if (ar && ar->hasVarEnv() && ar->getVarEnv()->isGlobalScope()) {
raise_warning(
"func_get_args(): Called from the global scope - no function context"
);
return false;
}
return hhvm_get_frame_args(ar);
}
示例4: TRACE
const Func*
StaticMethodCache::lookup(RDS::Handle handle, const NamedEntity *ne,
const StringData* clsName,
const StringData* methName) {
StaticMethodCache* thiz = static_cast<StaticMethodCache*>
(handleToPtr(handle));
Stats::inc(Stats::TgtCache_StaticMethodMiss);
Stats::inc(Stats::TgtCache_StaticMethodHit, -1);
TRACE(1, "miss %s :: %s caller %p\n",
clsName->data(), methName->data(), __builtin_return_address(0));
Transl::VMRegAnchor _; // needed for lookupClsMethod.
ActRec* ar = reinterpret_cast<ActRec*>(vmsp() - kNumActRecCells);
const Func* f;
VMExecutionContext* ec = g_vmContext;
const Class* cls = Unit::loadClass(ne, clsName);
if (UNLIKELY(!cls)) {
raise_error(Strings::UNKNOWN_CLASS, clsName->data());
}
LookupResult res = ec->lookupClsMethod(f, cls, methName,
nullptr, // there may be an active this,
// but we can just fall through
// in that case.
arGetContextClass(ec->getFP()),
false /*raise*/);
if (LIKELY(res == LookupResult::MethodFoundNoThis &&
!f->isAbstract() &&
f->isStatic())) {
f->validate();
TRACE(1, "fill %s :: %s -> %p\n", clsName->data(),
methName->data(), f);
// Do the | here instead of on every call.
thiz->m_cls = (Class*)(uintptr_t(cls) | 1);
thiz->m_func = f;
ar->setClass(const_cast<Class*>(cls));
return f;
}
assert(res != LookupResult::MethodFoundWithThis); // Not possible: no this.
// We've already sync'ed regs; this is some hard case, we might as well
// just let the interpreter handle this entirely.
assert(toOp(*vmpc()) == OpFPushClsMethodD);
Stats::inc(Stats::Instr_InterpOneFPushClsMethodD);
Stats::inc(Stats::Instr_TC, -1);
ec->opFPushClsMethodD();
// Return whatever func the instruction produced; if nothing was
// possible we'll either have fataled or thrown.
assert(ar->m_func);
ar->m_func->validate();
// Don't update the cache; this case was too scary to memoize.
TRACE(1, "unfillable miss %s :: %s -> %p\n", clsName->data(),
methName->data(), ar->m_func);
// Indicate to the caller that there is no work to do.
return nullptr;
}
示例5: actRec
c_Continuation::~c_Continuation() {
ActRec* ar = actRec();
if (ar->hasVarEnv()) {
ar->getVarEnv()->detach(ar);
} else {
// Free locals, but don't trigger the EventHook for FunctionExit
// since the continuation function has already been exited. We
// don't want redundant calls.
frame_free_locals_inl_no_hook<false>(ar, ar->m_func->numLocals());
}
}
示例6: actRec
void c_Continuation::dupContVar(const StringData* name, TypedValue* src) {
ActRec *fp = actRec();
Id destId = fp->m_func->lookupVarId(name);
if (destId != kInvalidId) {
// Copy the value of the local to the cont object.
tvDupFlattenVars(src, frame_local(fp, destId));
} else {
if (!fp->hasVarEnv()) {
fp->setVarEnv(VarEnv::createLocal(fp));
}
fp->getVarEnv()->setWithRef(name, src);
}
}
示例7: phpDebuggerStepIn
void phpDebuggerStepIn() {
// If this is called in the middle of a flow command we short-circuit the
// other commands
auto& req_data = RID();
req_data.setDebuggerStepIn(true);
req_data.setDebuggerStepOut(StepOutState::NONE);
req_data.setDebuggerNext(false);
// Ensure the flow filter is fresh
auto flow_filter = getFlowFilter();
flow_filter->clear();
// Check if the site is valid.
VMRegAnchor _;
ActRec* fp = vmfp();
PC pc = vmpc();
if (fp == nullptr || pc == nullptr) {
TRACE(5, "Could not grab stack or program counter\n");
return;
}
// Try to get needed context info. Bail if we can't
const Func* func = fp->func();
const Unit* unit = func != nullptr ? func->unit() : nullptr;
if (func == nullptr || func == nullptr) {
TRACE(5, "Could not grab the current unit or function\n");
return;
}
// We use line1 here because it works better than line0 in our
// bytecode-source mapping.
int line;
SourceLoc source_loc;
if (unit->getSourceLoc(unit->offsetOf(pc), source_loc)) {
line = source_loc.line1;
} else {
TRACE(5, "Could not grab the current line number\n");
return;
}
TRACE(3, "Prepare location filter for %s:%d, unit %p:\n",
unit->filepath()->data(), line, unit);
// Get offset ranges for the whole line.
OffsetRangeVec ranges;
if (!unit->getOffsetRanges(line, ranges)) {
ranges.clear();
}
flow_filter->addRanges(unit, ranges);
}
示例8: f_func_num_args
int64 f_func_num_args() {
if (hhvm) {
CallerFrame cf;
ActRec* ar = cf();
if (ar == NULL) {
return -1;
}
return ar->numArgs();
} else {
// we shouldn't be here, since code generation will inline this function
ASSERT(false);
return -1;
}
}
示例9: f_func_num_args
int64_t f_func_num_args() {
EagerCallerFrame cf;
ActRec* ar = cf.actRecForArgs();
if (ar == NULL) {
return -1;
}
if (ar->hasVarEnv() && ar->getVarEnv()->isGlobalScope()) {
raise_warning(
"func_num_args(): Called from the global scope - no function context"
);
return -1;
}
return ar->numArgs();
}
示例10: TRACE
int DebuggerProxy::getStackDepth() {
TRACE(2, "DebuggerProxy::getStackDepth\n");
int depth = 0;
VMExecutionContext* context = g_vmContext;
ActRec *fp = context->getFP();
if (!fp) return 0;
ActRec *prev = fp->arGetSfp();
while (fp != prev) {
fp = prev;
prev = fp->arGetSfp();
depth++;
}
return depth;
}
示例11: assert
c_Generator::~c_Generator() {
if (LIKELY(getState() == State::Done)) {
return;
}
assert(getState() != State::Running);
tvRefcountedDecRef(m_key);
tvRefcountedDecRef(m_value);
// Free locals, but don't trigger the EventHook for FunctionReturn since
// the generator has already been exited. We don't want redundant calls.
ActRec* ar = actRec();
frame_free_locals_inl_no_hook<false>(ar, ar->func()->numLocals());
}
示例12: HHVM_FUNCTION
int64_t HHVM_FUNCTION(func_num_args) {
EagerCallerFrame cf;
ActRec* ar = cf.actRecForArgs();
if (ar == nullptr) {
return -1;
}
if (ar->func()->isPseudoMain()) {
raise_warning(
"func_num_args(): Called from the global scope - no function context"
);
return -1;
}
return ar->numArgs();
}
示例13: func_num_args_impl
ALWAYS_INLINE
static int64_t func_num_args_impl() {
EagerCallerFrame cf;
ActRec* ar = cf.actRecForArgs();
if (ar == nullptr) {
return -1;
}
if (ar->func()->isPseudoMain()) {
raise_warning(
"func_num_args(): Called from the global scope - no function context"
);
return -1;
}
return ar->numArgs();
}
示例14: f_get_called_class
Variant f_get_called_class() {
CallerFrame cf;
ActRec* ar = cf();
if (ar == NULL) {
return Variant(false);
}
if (ar->hasThis()) {
ObjectData* obj = ar->getThis();
return obj->o_getClassName();
} else if (ar->hasClass()) {
return ar->getClass()->preClass()->name()->data();
} else {
return Variant(false);
}
}
示例15: func_get_arg_impl
ALWAYS_INLINE
static Variant func_get_arg_impl(int arg_num) {
CallerFrame cf;
ActRec* ar = cf.actRecForArgs();
if (ar == nullptr) {
return false;
}
if (ar->func()->isPseudoMain()) {
raise_warning(
"func_get_arg(): Called from the global scope - no function context"
);
return false;
}
if (arg_num < 0) {
raise_warning(
"func_get_arg(): The argument number should be >= 0"
);
return false;
}
if (arg_num >= ar->numArgs()) {
raise_warning(
"func_get_arg(): Argument %d not passed to function", arg_num
);
return false;
}
const int numParams = ar->m_func->numNonVariadicParams();
if (arg_num < numParams) {
// Formal parameter. Value is on the stack.
TypedValue* loc =
(TypedValue*)(uintptr_t(ar) - (arg_num + 1) * sizeof(TypedValue));
return tvAsVariant(loc);
}
const int numArgs = ar->numArgs();
const int extraArgs = numArgs - numParams;
// Not a formal parameter. Value is potentially in the
// ExtraArgs/VarEnv.
const int extraArgNum = arg_num - numParams;
if (extraArgNum < extraArgs) {
return tvAsVariant(ar->getExtraArg(extraArgNum));
}
return false;
}