Remove namespace fallback behavior for functions from autocomplete
[hiphop-php.git] / hphp / hhbbc / hhbbc.h
blob8c2730e7bb08f62895bb4474aa063281efa898a9
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
16 #ifndef incl_HPHP_HHBBC_H_
17 #define incl_HPHP_HHBBC_H_
19 #include <atomic>
20 #include <deque>
21 #include <vector>
22 #include <memory>
23 #include <string>
24 #include <utility>
26 #include "hphp/hhbbc/options.h"
28 #include "hphp/runtime/base/repo-auth-type-array.h"
30 #include "hphp/util/lock.h"
31 #include "hphp/util/synchronizable.h"
33 namespace HPHP { struct UnitEmitter; }
34 namespace HPHP { namespace HHBBC {
36 //////////////////////////////////////////////////////////////////////
39 * This is the public API to this subsystem.
42 //////////////////////////////////////////////////////////////////////
44 // Create a method map for the options structure from a SinglePassReadableRange
45 // containing a list of Class::methodName strings.
46 template<class SinglePassReadableRange>
47 MethodMap make_method_map(SinglePassReadableRange&);
49 template<class SinglePassReadableRange>
50 OpcodeSet make_bytecode_map(SinglePassReadableRange& bcs);
52 //////////////////////////////////////////////////////////////////////
54 struct UnitEmitterQueue : Synchronizable {
55 // Add another ue. Adding nullptr marks us done.
56 void push(std::unique_ptr<UnitEmitter> ue);
57 // Get the next ue, or nullptr to indicate we're done.
58 std::unique_ptr<UnitEmitter> pop();
59 // Fetch any remaining ues.
60 // Must be called in single threaded mode, after we've stopped adding ues.
61 void fetch(std::vector<std::unique_ptr<UnitEmitter>>& ues);
62 // Clear done flag, and get us ready for reuse.
63 void reset();
64 private:
65 std::deque<std::unique_ptr<UnitEmitter>> m_ues;
66 std::atomic<bool> m_done{};
70 * Perform whole-program optimization on a set of UnitEmitters.
72 * Currently this process relies on some information from HPHPc. It
73 * expects traits are already flattened (it might be wrong if they
74 * aren't).
76 void whole_program(std::vector<std::unique_ptr<UnitEmitter>>,
77 UnitEmitterQueue& ueq,
78 std::unique_ptr<ArrayTypeTable::Builder>& arrTable,
79 int num_threads = 0);
81 //////////////////////////////////////////////////////////////////////
84 * Main entry point when the program should behave like hhbbc.
86 int main(int argc, char** argv);
88 //////////////////////////////////////////////////////////////////////
92 #endif