void compile(goal const & g) { expr * lhs; expr * rhs; unsigned sz = g.size(); for (unsigned i = 0; i < sz; i++) { expr * f = g.form(i); TRACE("diff_neq_tactic", tout << "processing: " << mk_ismt2_pp(f, m) << "\n";); if (u.is_le(f, lhs, rhs)) process_le(lhs, rhs); else if (u.is_ge(f, lhs, rhs)) process_le(rhs, lhs); else if (m.is_not(f, f) && m.is_eq(f, lhs, rhs)) process_neq(lhs, rhs); else throw_not_supported(); }
static Array HHVM_FUNCTION(getrusage, int64_t who /* = 0 */) { struct rusage usg; memset(&usg, 0, sizeof(struct rusage)); int actual_who; switch (who) { case 1: actual_who = RUSAGE_CHILDREN; break; case 2: #ifdef RUSAGE_THREAD actual_who = RUSAGE_THREAD; #else throw_not_supported(__func__, "RUSAGE_THREAD is not defined on this sytem"); #endif break; default: actual_who = RUSAGE_SELF; break; } if (getrusage(actual_who, &usg) == -1) { raise_error("getrusage returned %d: %s", errno, folly::errnoStr(errno).c_str()); } return Array(ArrayInit(17, ArrayInit::Mixed{}). set(PHP_RUSAGE_PARA(ru_oublock)). set(PHP_RUSAGE_PARA(ru_inblock)). set(PHP_RUSAGE_PARA(ru_msgsnd)). set(PHP_RUSAGE_PARA(ru_msgrcv)). set(PHP_RUSAGE_PARA(ru_maxrss)). set(PHP_RUSAGE_PARA(ru_ixrss)). set(PHP_RUSAGE_PARA(ru_idrss)). set(PHP_RUSAGE_PARA(ru_minflt)). set(PHP_RUSAGE_PARA(ru_majflt)). set(PHP_RUSAGE_PARA(ru_nsignals)). set(PHP_RUSAGE_PARA(ru_nvcsw)). set(PHP_RUSAGE_PARA(ru_nivcsw)). set(PHP_RUSAGE_PARA(ru_nswap)). set(s_ru_utime_tv_usec, (int64_t)usg.ru_utime.tv_usec). set(s_ru_utime_tv_sec, (int64_t)usg.ru_utime.tv_sec). set(s_ru_stime_tv_usec, (int64_t)usg.ru_stime.tv_usec). set(s_ru_stime_tv_sec, (int64_t)usg.ru_stime.tv_sec). toArray()); }
// assert_impl already defined in util/assertions.h static Variant impl_assert(const Variant& assertion, const Variant& message /* = null */) { if (!s_option_data->assertActive) return true; CallerFrame cf; Offset callerOffset; auto const fp = cf(&callerOffset); auto const passed = [&]() -> bool { if (assertion.isString()) { if (RuntimeOption::EvalAuthoritativeMode) { // We could support this with compile-time string literals, // but it's not yet implemented. throw_not_supported("assert()", "assert with strings argument in RepoAuthoritative mode"); } return eval_for_assert(fp, assertion.toString()).toBoolean(); } return assertion.toBoolean(); }(); if (passed) return true; if (!s_option_data->assertCallback.isNull()) { auto const unit = fp->m_func->unit(); PackedArrayInit ai(3); ai.append(String(const_cast<StringData*>(unit->filepath()))); ai.append(Variant(unit->getLineNumber(callerOffset))); ai.append(assertion.isString() ? assertion : empty_string_variant_ref); HHVM_FN(call_user_func)(s_option_data->assertCallback, ai.toArray()); } String name(message.isNull() ? "Assertion" : message.toString()); if (s_option_data->assertWarning) { auto const str = !assertion.isString() ? " failed" : concat3(" \"", assertion.toString(), "\" failed"); raise_warning("%s%s", name.data(), str.data()); } if (s_option_data->assertBail) { throw ExtendedException("An assertion was raised."); } return init_null(); }
void c_WaitHandle::t___construct() { throw_not_supported( __func__, "WaitHandles cannot be constructed directly"); }
bool HHVM_FUNCTION(output_reset_rewrite_vars) { throw_not_supported(__func__, "bad coding style"); }
bool HHVM_FUNCTION(output_add_rewrite_var, const String& name, const String& value) { throw_not_supported(__func__, "bad coding style"); }
static Variant eval_for_assert(ActRec* const curFP, const String& codeStr) { String prefixedCode = concat3("<?php return ", codeStr, ";"); auto const oldErrorLevel = s_option_data->assertQuietEval ? HHVM_FN(error_reporting)(Variant(0)) : 0; SCOPE_EXIT { if (s_option_data->assertQuietEval) HHVM_FN(error_reporting)(oldErrorLevel); }; auto const unit = g_context->compileEvalString(prefixedCode.get()); if (unit == nullptr) { raise_recoverable_error("Syntax error in assert()"); // Failure to compile the eval string doesn't count as an // assertion failure. return Variant(true); } if (!(curFP->func()->attrs() & AttrMayUseVV)) { throw_not_supported("assert()", "assert called from non-varenv function"); } if (!curFP->hasVarEnv()) { curFP->setVarEnv(VarEnv::createLocal(curFP)); } auto varEnv = curFP->getVarEnv(); if (curFP != vmfp()) { // If we aren't using FCallBuiltin, the stack frame of the call to assert // will be in middle of the code we are about to eval and our caller, whose // varEnv we want to use. The invokeFunc below will get very confused if // this is the case, since it will be using a varEnv that belongs to the // wrong function on the stack. So, we rebind it here, to match what // invokeFunc will expect. assert(!vmfp()->hasVarEnv()); vmfp()->setVarEnv(varEnv); varEnv->enterFP(curFP, vmfp()); } ObjectData* thiz = nullptr; Class* cls = nullptr; Class* ctx = curFP->func()->cls(); if (ctx) { if (curFP->hasThis()) { thiz = curFP->getThis(); cls = thiz->getVMClass(); } else { cls = curFP->getClass(); } } auto const func = unit->getMain(ctx); return Variant::attach( g_context->invokeFunc( func, init_null_variant, thiz, cls, varEnv, nullptr, ExecutionContext::InvokePseudoMain ) ); }
static bool HHVM_FUNCTION(set_magic_quotes_runtime, bool new_setting) { if (new_setting) { throw_not_supported(__func__, "not using magic quotes"); } return true; }