Skip to content
Permalink
Browse files

remove code in {Unit,Func} used only to support create_function

Reviewed By: jano, alexeyt

Differential Revision: D13633740

fbshipit-source-id: b33542a52491f0cc135d93daa3e5e766c3bf6736
  • Loading branch information...
billf authored and hhvm-bot committed Jan 25, 2019
1 parent f523344 commit cbd85cf7087deca819f88a0e7f8f75635cf75ef1
Showing with 0 additions and 55 deletions.
  1. +0 −8 hphp/runtime/vm/func.cpp
  2. +0 −5 hphp/runtime/vm/func.h
  3. +0 −9 hphp/runtime/vm/unit-inl.h
  4. +0 −18 hphp/runtime/vm/unit.cpp
  5. +0 −15 hphp/runtime/vm/unit.h
@@ -224,14 +224,6 @@ void Func::rescope(Class* ctx, Attr attrs) {
setFullName(numParams());
}

void Func::rename(const StringData* name) {
m_name = name;
setFullName(numParams());
// bind the renamed function
Unit::bindFunc(this);
}


///////////////////////////////////////////////////////////////////////////////
// Initialization.

@@ -239,11 +239,6 @@ struct Func final {
*/
void freeClone();

/*
* Rename a function and reload it.
*/
void rename(const StringData* name);

/*
* Verify that a Func's data is coherent.
*
@@ -112,11 +112,6 @@ Unit::MergeInfo::MutableFuncRange Unit::MergeInfo::nonMainFuncs() const {
return { funcBegin() + 1, funcEnd() };
}

inline
Unit::MergeInfo::MutableFuncRange Unit::MergeInfo::hoistableFuncs() const {
return { funcHoistableBegin(), funcEnd() };
}

inline void*& Unit::MergeInfo::mergeableObj(int idx) {
return m_mergeables[idx];
}
@@ -273,10 +268,6 @@ inline folly::Range<const PreClassPtr*> Unit::preclasses() const {
return { m_preClasses.data(), m_preClasses.size() };
}

inline Func* Unit::firstHoistable() const {
return *mergeInfo()->funcHoistableBegin();
}

template<class Fn> void Unit::forEachFunc(Fn fn) const {
for (auto& func : funcs()) {
fn(func);
@@ -629,24 +629,6 @@ Func* Unit::getCachedEntryPoint() const {
return m_cachedEntryPoint;
}

void Unit::renameFunc(const StringData* oldName, const StringData* newName) {
// We do a linear scan over all the functions in the unit searching for the
// func with a given name; in practice this is okay because the units created
// by create_function() will always have the function being renamed at the
// beginning
assertx(oldName && oldName->isStatic());
assertx(newName && newName->isStatic());

for (auto& func : mergeInfo()->hoistableFuncs()) {
auto const name = func->name();
assertx(name);
if (name->same(oldName)) {
func->rename(newName);
break;
}
}
}

///////////////////////////////////////////////////////////////////////////////
// Func lookup.

@@ -278,7 +278,6 @@ struct Unit {
FuncRange funcs() const;
MutableFuncRange mutableFuncs() const;
MutableFuncRange nonMainFuncs() const;
MutableFuncRange hoistableFuncs() const;

/*
* Get a reference or pointer to the mergeable at index `idx'.
@@ -500,20 +499,6 @@ struct Unit {

// Return the cached EntryPoint
Func* getCachedEntryPoint() const;
/*
* The first hoistable Func in the Unit.
*
* This is only used for the create_function() implementation, to access the
* __lambda_func() we define for the user.
*/
Func* firstHoistable() const;

/*
* Rename the Func in this Unit given by `oldName' to `newName'.
*
* This should only be called by ExecutionContext::createFunction().
*/
void renameFunc(const StringData* oldName, const StringData* newName);

/*
* Visit all functions and methods in this unit.

0 comments on commit cbd85cf

Please sign in to comment.
You can’t perform that action at this time.