Skip to content

Commit

Permalink
Revert D64702800
Browse files Browse the repository at this point in the history
Summary:
This diff reverts D64702800
Seeing logs in logview

Reviewed By: voorka

Differential Revision: D65148746

fbshipit-source-id: b4701cf355cb0f98b17329716420f51e1f626871
  • Loading branch information
generatedunixname89002005232357 authored and facebook-github-bot committed Oct 29, 2024
1 parent 3b5d5ff commit b0428ee
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 65 deletions.
3 changes: 1 addition & 2 deletions hphp/runtime/base/intercept.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ bool register_intercept(const String& name, const Variant& callback) {
if (!meth || meth->cls() != cls) return nullptr;
return meth;
} else {
auto const f = Func::load(name.get());
return f->unwrap();
return Func::load(name.get());
}
}();

Expand Down
2 changes: 1 addition & 1 deletion hphp/runtime/base/runtime-option.h
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ struct RuntimeOption {
F(bool, FastMethodIntercept, false) \
F(bool, LogHttpServerSignalSource, true) \
F(bool, CrashOnStaticAnalysisError, debug) \
F(bool, ReplaceTrivialBuiltins, true) \
F(bool, ReplaceTrivialBuiltins, false) \
/* */

private:
Expand Down
11 changes: 4 additions & 7 deletions hphp/runtime/vm/bytecode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3902,13 +3902,10 @@ OPTBLD_INLINE JitResumeAddr iopFCallFunc(bool retToJit, PC origpc, PC& pc,
OPTBLD_INLINE JitResumeAddr iopFCallFuncD(bool retToJit, PC origpc, PC& pc,
FCallArgs fca, Id id) {
auto const nep = vmfp()->unit()->lookupNamedFuncPairId(id);
auto const func = [&]() {
auto const f = Func::resolve(nep.second, nep.first, vmfp()->func());
if (UNLIKELY(f == nullptr)) {
raise_call_to_undefined(vmfp()->unit()->lookupLitstrId(id));
}
return f->unwrap();
}();
auto const func = Func::resolve(nep.second, nep.first, vmfp()->func());
if (UNLIKELY(func == nullptr)) {
raise_call_to_undefined(vmfp()->unit()->lookupLitstrId(id));
}

return fcallImpl<false>(retToJit, origpc, pc, fca, func, NoCtx{});
}
Expand Down
2 changes: 1 addition & 1 deletion hphp/runtime/vm/func-emitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ namespace {
}();
if (attrs & AttrBuiltin) {
if (Cfg::Jit::BuiltinsInterceptableByDefault) {
return Cfg::Eval::NonInterceptableFunctions.count(fullname) == 0;
return true;
} else {
return (Cfg::Eval::InterceptableBuiltins.count(fullname) == 1);
}
Expand Down
35 changes: 2 additions & 33 deletions hphp/runtime/vm/func-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
#include "hphp/util/configs/eval.h"

namespace HPHP {

namespace {
const StaticString s_TrivialHHVMBuiltinWrapper("TrivialHHVMBuiltinWrapper");
}
///////////////////////////////////////////////////////////////////////////////
// EH table.

Expand Down Expand Up @@ -798,41 +794,14 @@ inline bool Func::hasReifiedGenerics() const {
return shared()->m_allFlags.m_hasReifiedGenerics;
}

// If the function is a trivial builtin, that is not interceptable, and
// is persistent, then unwrap it.
inline Func* Func::unwrap() {
if (!RO::EvalReplaceTrivialBuiltins) return this;
// Already unwrapped
if (RO::RepoAuthoritative) return this;
if (RO::funcIsRenamable(name())) return this;

auto const it = userAttributes().find(s_TrivialHHVMBuiltinWrapper.get());
if (it != userAttributes().end()) {
assertx(tvIsVec(it->second));
auto const args = it->second.m_data.parr;
assertx(args->size() == 1);
auto const wrappedFunc = args->at(int64_t{0});
assertx(tvIsString(wrappedFunc));
assertx(wrappedFunc.m_data.pstr->isStatic());
auto const resolved_ne = NamedFunc::getOrCreate(wrappedFunc.m_data.pstr);
return resolved_ne->func();
}
return this;
}

/*
* Find a function which always uniquely maps to the given name in the context
* of the given unit. A function so returned can be used directly in the TC as
* it will not change.
*/
inline const Func::FuncLookup Func::lookupKnownMaybe(const StringData* name, const Unit* unit) {
auto const func = [&]() -> const Func* {
auto const ne = NamedFunc::getOrCreate(name);
auto const f = ne->func();
if (!f) return nullptr;
return f->unwrap();
}();

auto const ne = NamedFunc::getOrCreate(name);
auto const func = ne->func();
if (!func || RO::funcIsRenamable(func->name())) return Func::none();
// In non-repo mode while the function must be available in this unit, it
// may be de-duplication on load. This may mean that while the func is
Expand Down
5 changes: 0 additions & 5 deletions hphp/runtime/vm/func.h
Original file line number Diff line number Diff line change
Expand Up @@ -1041,11 +1041,6 @@ struct Func final {
*/
const ReifiedGenericsInfo& getReifiedGenericsInfo() const;

/*
* Does this function wrap a builtin?
*/
Func* unwrap();

/////////////////////////////////////////////////////////////////////////////
// Unit table entries. [const]

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
string(3) "bar"
string(3) "foo"
1 change: 0 additions & 1 deletion hphp/test/slow/hhbbc/trivial-hhvm-builtin-wrapper.php.opts

This file was deleted.

12 changes: 0 additions & 12 deletions hphp/test/slow/trivial_builtins/success.php

This file was deleted.

1 change: 0 additions & 1 deletion hphp/test/slow/trivial_builtins/success.php.expect

This file was deleted.

1 change: 0 additions & 1 deletion hphp/test/slow/trivial_builtins/success.php.opts

This file was deleted.

0 comments on commit b0428ee

Please sign in to comment.