From 8987de3e848422ee0e4cc521615f8a0fba1b2963 Mon Sep 17 00:00:00 2001 From: bsimmers Date: Fri, 31 May 2013 16:30:29 -0700 Subject: [PATCH] Remove immstack.cpp It's dead but I missed it in my previous diff --- hphp/runtime/vm/jit/immstack.cpp | 103 ----------------------------- hphp/runtime/vm/jit/immstack.h | 72 -------------------- hphp/runtime/vm/jit/translator.cpp | 1 - hphp/runtime/vm/jit/translator.h | 1 - 4 files changed, 177 deletions(-) delete mode 100644 hphp/runtime/vm/jit/immstack.cpp delete mode 100644 hphp/runtime/vm/jit/immstack.h diff --git a/hphp/runtime/vm/jit/immstack.cpp b/hphp/runtime/vm/jit/immstack.cpp deleted file mode 100644 index 6cce4386e..000000000 --- a/hphp/runtime/vm/jit/immstack.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | HipHop for PHP | - +----------------------------------------------------------------------+ - | Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ -*/ - -#include "hphp/runtime/vm/jit/immstack.h" - -namespace HPHP { -/////////////////////////////////////////////////////////////////////////////// - -void ImmStack::processOpcode(const Opcode* opcode) { - StackTransInfo sti = instrStackTransInfo(opcode); - if (sti.kind == StackTransInfo::PushPop) { - for (int i = 0; i < sti.numPops; i++) { - pop(); - } - for (int i = 0; i < sti.numPushes; i++) { - pushUnknown(); - } - } else if (sti.kind == StackTransInfo::InsertMid) { - insUnknown(sti.pos); - } else { - assert(false); - } -} - -void ImmStack::pushUnknown() { - StackItem item; - - item.type = StackItem::StackType_Unknown; - m_stack.push_back(item); -} - -void ImmStack::insUnknown(int pos) { - int k = m_stack.size() - 1 - pos; - if (k >= 0 && k < (int)m_stack.size()) { - StackItem item; - item.type = StackItem::StackType_Unknown; - m_stack.insert(m_stack.begin() + k, item); - } -} - -void ImmStack::pop() { - // Since we only process on the basic block level, we obviously can pop - // locations that we don't track. We treat all these locations as unknowns. - - if (!m_stack.empty()) { - m_stack.pop_back(); - } -} - -void ImmStack::pushInt(int64_t value) { - StackItem item; - - item.type = StackItem::StackType_Int; - item.i64a = value; - - m_stack.push_back(item); -} - -void ImmStack::pushLitstr(Id value) { - StackItem item; - - item.type = StackItem::StackType_Litstr; - item.sa = value; - - m_stack.push_back(item); -} - -ImmStack::StackItem &ImmStack::get(int above) { - always_assert(above >= 0 && (size_t)above < m_stack.size()); - - return m_stack[m_stack.size() - above - 1]; -} - -bool ImmStack::isInt(int above) { - if (above >= (int)m_stack.size()) { - return false; - } - - return get(above).type == StackItem::StackType_Int; -} - -bool ImmStack::isLitstr(int above) { - if (above >= (int)m_stack.size()) { - return false; - } - - return get(above).type == StackItem::StackType_Litstr; -} - -} diff --git a/hphp/runtime/vm/jit/immstack.h b/hphp/runtime/vm/jit/immstack.h deleted file mode 100644 index 5bb00c0a7..000000000 --- a/hphp/runtime/vm/jit/immstack.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | HipHop for PHP | - +----------------------------------------------------------------------+ - | Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ -*/ - -#ifndef incl_HPHP_IMMSTACK_H_ -#define incl_HPHP_IMMSTACK_H_ - -#include "hphp/runtime/vm/bytecode.h" - -namespace HPHP { -/////////////////////////////////////////////////////////////////////////////// - -class ImmStack { -private: - struct StackItem { - enum StackType { - StackType_Unknown, - StackType_Int, - StackType_Litstr, - }; - - StackType type; - union { - int64_t i64a; - Id sa; - }; - }; - -public: - - // calls pop(), and pushUnknown() appropriately - void processOpcode(const Opcode* opcode); - - void pushUnknown(); - void insUnknown(int pos); - void pop(); - - // By using these methods (instead of the popUknown() above) you signify that - // the instruction most recently added via addInstr() is side-effect free, - // i.e. that if this particular value on the stack is not needed then - // the corresponding opcode can be removed. Thus we also cannot use - // these methods for opcodes which push multiple values on to the stack, - // such as dup. - void pushInt(int64_t value); - void pushLitstr(Id value); - - // 0 is the item most recently pushed on to the stack, followed by 1 etc. - bool isInt(int above); - bool isLitstr(Id above); - - StackItem &get(int above); - -private: - std::vector m_stack; -}; - -/////////////////////////////////////////////////////////////////////////////// -} - -#endif diff --git a/hphp/runtime/vm/jit/translator.cpp b/hphp/runtime/vm/jit/translator.cpp index 7dad35d3e..34deb419a 100644 --- a/hphp/runtime/vm/jit/translator.cpp +++ b/hphp/runtime/vm/jit/translator.cpp @@ -3228,7 +3228,6 @@ std::unique_ptr Translator::analyze(SrcKey sk, TRACE(1, "Translator::analyze %s:%d %s\n", file, lineNum, funcName); TraceletContext tas(&t, initialTypes); - ImmStack immStack; int stackFrameOffset = 0; int oldStackFrameOffset = 0; diff --git a/hphp/runtime/vm/jit/translator.h b/hphp/runtime/vm/jit/translator.h index bb3942e4f..47239709e 100644 --- a/hphp/runtime/vm/jit/translator.h +++ b/hphp/runtime/vm/jit/translator.h @@ -32,7 +32,6 @@ #include "hphp/util/timer.h" #include "hphp/runtime/base/execution_context.h" #include "hphp/runtime/vm/bytecode.h" -#include "hphp/runtime/vm/jit/immstack.h" #include "hphp/runtime/vm/jit/runtime-type.h" #include "hphp/runtime/vm/jit/fixup.h" #include "hphp/runtime/vm/jit/writelease.h"