Skip to content

Commit 7492aa1

Browse files
committed
Bytecode liveness should live on UnlinkedCodeBlock so it can be shared amongst CodeBlocks
https://bugs.webkit.org/show_bug.cgi?id=178949 Reviewed by Keith Miller. This patch stores BytecodeLiveness on UnlinkedCodeBlock instead of CodeBlock so that we don't need to recompute liveness for the same UnlinkedCodeBlock more than once. To do this, this patch solidifies the invariant that CodeBlock linking can't do anything that would change the result of liveness. For example, it can't introduce new locals. This invariant was met my JSC before, because we didn't do anything in bytecode linking that would change liveness. However, it is now a correctness requirement that we don't do anything that would change the result of running liveness. To support this change, I've refactored BytecodeGraph to not be tied to a CodeBlockType*. Things that perform liveness will pass in CodeBlockType* and the instruction stream as needed. This means that we may compute liveness with one CodeBlock*'s instruction stream, and then perform queries on that analysis with a different CodeBlock*'s instruction stream. This seems to be a 2% JSBench progression. * bytecode/BytecodeGeneratorification.cpp: (JSC::BytecodeGeneratorification::BytecodeGeneratorification): (JSC::BytecodeGeneratorification::graph): (JSC::BytecodeGeneratorification::storageForGeneratorLocal): (JSC::GeneratorLivenessAnalysis::run): (JSC::BytecodeGeneratorification::run): * bytecode/BytecodeGraph.h: (JSC::BytecodeGraph::BytecodeGraph): (JSC::BytecodeGraph::codeBlock const): Deleted. (JSC::BytecodeGraph::instructions): Deleted. (JSC::BytecodeGraph<Block>::BytecodeGraph): Deleted. * bytecode/BytecodeLivenessAnalysis.cpp: (JSC::BytecodeLivenessAnalysis::BytecodeLivenessAnalysis): (JSC::BytecodeLivenessAnalysis::getLivenessInfoAtBytecodeOffset): (JSC::BytecodeLivenessAnalysis::computeFullLiveness): (JSC::BytecodeLivenessAnalysis::computeKills): (JSC::BytecodeLivenessAnalysis::dumpResults): (JSC::BytecodeLivenessAnalysis::operandIsLiveAtBytecodeOffset): Deleted. (JSC::BytecodeLivenessAnalysis::compute): Deleted. * bytecode/BytecodeLivenessAnalysis.h: * bytecode/BytecodeLivenessAnalysisInlines.h: (JSC::BytecodeLivenessPropagation::stepOverInstruction): (JSC::BytecodeLivenessPropagation::computeLocalLivenessForBytecodeOffset): (JSC::BytecodeLivenessPropagation::computeLocalLivenessForBlock): (JSC::BytecodeLivenessPropagation::getLivenessInfoAtBytecodeOffset): (JSC::BytecodeLivenessPropagation::runLivenessFixpoint): * bytecode/BytecodeRewriter.cpp: (JSC::BytecodeRewriter::applyModification): (JSC::BytecodeRewriter::execute): (JSC::BytecodeRewriter::adjustJumpTargetsInFragment): * bytecode/BytecodeRewriter.h: (JSC::BytecodeRewriter::BytecodeRewriter): (JSC::BytecodeRewriter::removeBytecode): (JSC::BytecodeRewriter::graph): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffsetSlow): (JSC::CodeBlock::validate): (JSC::CodeBlock::livenessAnalysisSlow): Deleted. * bytecode/CodeBlock.h: (JSC::CodeBlock::livenessAnalysis): * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::applyModification): (JSC::UnlinkedCodeBlock::livenessAnalysisSlow): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::livenessAnalysis): * dfg/DFGGraph.cpp: (JSC::DFG::Graph::livenessFor): (JSC::DFG::Graph::killsFor): * dfg/DFGPlan.cpp: (JSC::DFG::Plan::cleanMustHandleValuesIfNecessary): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): Canonical link: https://commits.webkit.org/195109@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224138 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent b902280 commit 7492aa1

15 files changed

Lines changed: 214 additions & 143 deletions

‎Source/JavaScriptCore/ChangeLog‎

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,79 @@
1+
2017-10-27 Saam Barati <sbarati@apple.com>
2+
3+
Bytecode liveness should live on UnlinkedCodeBlock so it can be shared amongst CodeBlocks
4+
https://bugs.webkit.org/show_bug.cgi?id=178949
5+
6+
Reviewed by Keith Miller.
7+
8+
This patch stores BytecodeLiveness on UnlinkedCodeBlock instead of CodeBlock
9+
so that we don't need to recompute liveness for the same UnlinkedCodeBlock
10+
more than once. To do this, this patch solidifies the invariant that CodeBlock
11+
linking can't do anything that would change the result of liveness. For example,
12+
it can't introduce new locals. This invariant was met my JSC before, because we
13+
didn't do anything in bytecode linking that would change liveness. However, it is
14+
now a correctness requirement that we don't do anything that would change the
15+
result of running liveness. To support this change, I've refactored BytecodeGraph
16+
to not be tied to a CodeBlockType*. Things that perform liveness will pass in
17+
CodeBlockType* and the instruction stream as needed. This means that we may
18+
compute liveness with one CodeBlock*'s instruction stream, and then perform
19+
queries on that analysis with a different CodeBlock*'s instruction stream.
20+
21+
This seems to be a 2% JSBench progression.
22+
23+
* bytecode/BytecodeGeneratorification.cpp:
24+
(JSC::BytecodeGeneratorification::BytecodeGeneratorification):
25+
(JSC::BytecodeGeneratorification::graph):
26+
(JSC::BytecodeGeneratorification::storageForGeneratorLocal):
27+
(JSC::GeneratorLivenessAnalysis::run):
28+
(JSC::BytecodeGeneratorification::run):
29+
* bytecode/BytecodeGraph.h:
30+
(JSC::BytecodeGraph::BytecodeGraph):
31+
(JSC::BytecodeGraph::codeBlock const): Deleted.
32+
(JSC::BytecodeGraph::instructions): Deleted.
33+
(JSC::BytecodeGraph<Block>::BytecodeGraph): Deleted.
34+
* bytecode/BytecodeLivenessAnalysis.cpp:
35+
(JSC::BytecodeLivenessAnalysis::BytecodeLivenessAnalysis):
36+
(JSC::BytecodeLivenessAnalysis::getLivenessInfoAtBytecodeOffset):
37+
(JSC::BytecodeLivenessAnalysis::computeFullLiveness):
38+
(JSC::BytecodeLivenessAnalysis::computeKills):
39+
(JSC::BytecodeLivenessAnalysis::dumpResults):
40+
(JSC::BytecodeLivenessAnalysis::operandIsLiveAtBytecodeOffset): Deleted.
41+
(JSC::BytecodeLivenessAnalysis::compute): Deleted.
42+
* bytecode/BytecodeLivenessAnalysis.h:
43+
* bytecode/BytecodeLivenessAnalysisInlines.h:
44+
(JSC::BytecodeLivenessPropagation::stepOverInstruction):
45+
(JSC::BytecodeLivenessPropagation::computeLocalLivenessForBytecodeOffset):
46+
(JSC::BytecodeLivenessPropagation::computeLocalLivenessForBlock):
47+
(JSC::BytecodeLivenessPropagation::getLivenessInfoAtBytecodeOffset):
48+
(JSC::BytecodeLivenessPropagation::runLivenessFixpoint):
49+
* bytecode/BytecodeRewriter.cpp:
50+
(JSC::BytecodeRewriter::applyModification):
51+
(JSC::BytecodeRewriter::execute):
52+
(JSC::BytecodeRewriter::adjustJumpTargetsInFragment):
53+
* bytecode/BytecodeRewriter.h:
54+
(JSC::BytecodeRewriter::BytecodeRewriter):
55+
(JSC::BytecodeRewriter::removeBytecode):
56+
(JSC::BytecodeRewriter::graph):
57+
* bytecode/CodeBlock.cpp:
58+
(JSC::CodeBlock::finishCreation):
59+
(JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffsetSlow):
60+
(JSC::CodeBlock::validate):
61+
(JSC::CodeBlock::livenessAnalysisSlow): Deleted.
62+
* bytecode/CodeBlock.h:
63+
(JSC::CodeBlock::livenessAnalysis):
64+
* bytecode/UnlinkedCodeBlock.cpp:
65+
(JSC::UnlinkedCodeBlock::applyModification):
66+
(JSC::UnlinkedCodeBlock::livenessAnalysisSlow):
67+
* bytecode/UnlinkedCodeBlock.h:
68+
(JSC::UnlinkedCodeBlock::livenessAnalysis):
69+
* dfg/DFGGraph.cpp:
70+
(JSC::DFG::Graph::livenessFor):
71+
(JSC::DFG::Graph::killsFor):
72+
* dfg/DFGPlan.cpp:
73+
(JSC::DFG::Plan::cleanMustHandleValuesIfNecessary):
74+
* jit/JIT.cpp:
75+
(JSC::JIT::privateCompileMainPass):
76+
177
2017-10-27 Keith Miller <keith_miller@apple.com>
278

379
Add unified source list files and build scripts to Xcode project navigator

‎Source/JavaScriptCore/bytecode/BytecodeGeneratorification.cpp‎

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ class BytecodeGeneratorification {
5353
typedef Vector<YieldData> Yields;
5454

5555
BytecodeGeneratorification(UnlinkedCodeBlock* codeBlock, UnlinkedCodeBlock::UnpackedInstructions& instructions, SymbolTable* generatorFrameSymbolTable, int generatorFrameSymbolTableIndex)
56-
: m_graph(codeBlock, instructions)
56+
: m_codeBlock(codeBlock)
57+
, m_instructions(instructions)
58+
, m_graph(m_codeBlock, m_instructions)
5759
, m_generatorFrameSymbolTable(*codeBlock->vm(), generatorFrameSymbolTable)
5860
, m_generatorFrameSymbolTableIndex(generatorFrameSymbolTableIndex)
5961
{
6062
for (BytecodeBasicBlock* block : m_graph) {
6163
for (unsigned bytecodeOffset : block->offsets()) {
62-
const UnlinkedInstruction* pc = &m_graph.instructions()[bytecodeOffset];
64+
const UnlinkedInstruction* pc = &instructions[bytecodeOffset];
6365
switch (pc->u.opcode) {
6466
case op_enter: {
6567
m_enterPoint = bytecodeOffset;
@@ -91,7 +93,7 @@ class BytecodeGeneratorification {
9193

9294
void run();
9395

94-
BytecodeGraph<UnlinkedCodeBlock>& graph() { return m_graph; }
96+
BytecodeGraph& graph() { return m_graph; }
9597

9698
const Yields& yields() const
9799
{
@@ -121,10 +123,9 @@ class BytecodeGeneratorification {
121123
if (std::optional<Storage> storage = m_storages[index])
122124
return *storage;
123125

124-
UnlinkedCodeBlock* codeBlock = m_graph.codeBlock();
125126
Identifier identifier = Identifier::fromUid(PrivateName());
126-
unsigned identifierIndex = codeBlock->numberOfIdentifiers();
127-
codeBlock->addIdentifier(identifier);
127+
unsigned identifierIndex = m_codeBlock->numberOfIdentifiers();
128+
m_codeBlock->addIdentifier(identifier);
128129
ScopeOffset scopeOffset = m_generatorFrameSymbolTable->takeNextScopeOffset(NoLockingNecessary);
129130
m_generatorFrameSymbolTable->set(NoLockingNecessary, identifier.impl(), SymbolTableEntry(VarOffset(scopeOffset)));
130131

@@ -138,7 +139,9 @@ class BytecodeGeneratorification {
138139
}
139140

140141
unsigned m_enterPoint { 0 };
141-
BytecodeGraph<UnlinkedCodeBlock> m_graph;
142+
UnlinkedCodeBlock* m_codeBlock;
143+
UnlinkedCodeBlock::UnpackedInstructions& m_instructions;
144+
BytecodeGraph m_graph;
142145
Vector<std::optional<Storage>> m_storages;
143146
Yields m_yields;
144147
Strong<SymbolTable> m_generatorFrameSymbolTable;
@@ -152,15 +155,15 @@ class GeneratorLivenessAnalysis : public BytecodeLivenessPropagation {
152155
{
153156
}
154157

155-
void run()
158+
void run(UnlinkedCodeBlock* codeBlock, UnlinkedCodeBlock::UnpackedInstructions& instructions)
156159
{
157160
// Perform modified liveness analysis to determine which locals are live at the merge points.
158161
// This produces the conservative results for the question, "which variables should be saved and resumed?".
159162

160-
runLivenessFixpoint(m_generatorification.graph());
163+
runLivenessFixpoint(codeBlock, instructions, m_generatorification.graph());
161164

162165
for (YieldData& data : m_generatorification.yields())
163-
data.liveness = getLivenessInfoAtBytecodeOffset(m_generatorification.graph(), data.point + opcodeLength(op_yield));
166+
data.liveness = getLivenessInfoAtBytecodeOffset(codeBlock, instructions, m_generatorification.graph(), data.point + opcodeLength(op_yield));
164167
}
165168

166169
private:
@@ -173,18 +176,17 @@ void BytecodeGeneratorification::run()
173176

174177
{
175178
GeneratorLivenessAnalysis pass(*this);
176-
pass.run();
179+
pass.run(m_codeBlock, m_instructions);
177180
}
178181

179-
UnlinkedCodeBlock* codeBlock = m_graph.codeBlock();
180-
BytecodeRewriter rewriter(m_graph);
182+
BytecodeRewriter rewriter(m_graph, m_codeBlock, m_instructions);
181183

182184
// Setup the global switch for the generator.
183185
{
184186
unsigned nextToEnterPoint = enterPoint() + opcodeLength(op_enter);
185-
unsigned switchTableIndex = m_graph.codeBlock()->numberOfSwitchJumpTables();
187+
unsigned switchTableIndex = m_codeBlock->numberOfSwitchJumpTables();
186188
VirtualRegister state = virtualRegisterForArgument(static_cast<int32_t>(JSGeneratorFunction::GeneratorArgument::State));
187-
auto& jumpTable = m_graph.codeBlock()->addSwitchJumpTable();
189+
auto& jumpTable = m_codeBlock->addSwitchJumpTable();
188190
jumpTable.min = 0;
189191
jumpTable.branchOffsets.resize(m_yields.size() + 1);
190192
jumpTable.branchOffsets.fill(0);
@@ -227,7 +229,7 @@ void BytecodeGeneratorification::run()
227229
VirtualRegister operand = virtualRegisterForLocal(index);
228230
Storage storage = storageForGeneratorLocal(index);
229231

230-
UnlinkedValueProfile profile = codeBlock->addValueProfile();
232+
UnlinkedValueProfile profile = m_codeBlock->addValueProfile();
231233
fragment.appendInstruction(
232234
op_get_from_scope,
233235
operand.offset(), // dst

‎Source/JavaScriptCore/bytecode/BytecodeGraph.h‎

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,16 @@ namespace JSC {
3535

3636
class BytecodeBasicBlock;
3737

38-
template<typename Block>
3938
class BytecodeGraph {
4039
WTF_MAKE_FAST_ALLOCATED;
4140
WTF_MAKE_NONCOPYABLE(BytecodeGraph);
4241
public:
43-
typedef Block CodeBlock;
44-
typedef typename Block::Instruction Instruction;
4542
typedef Vector<std::unique_ptr<BytecodeBasicBlock>> BasicBlocksVector;
4643

47-
typedef WTF::IndexedContainerIterator<BytecodeGraph<Block>> iterator;
44+
typedef WTF::IndexedContainerIterator<BytecodeGraph> iterator;
4845

49-
inline BytecodeGraph(Block*, typename Block::UnpackedInstructions&);
50-
51-
Block* codeBlock() const { return m_codeBlock; }
52-
53-
typename Block::UnpackedInstructions& instructions() { return m_instructions; }
46+
template <typename CodeBlockType>
47+
inline BytecodeGraph(CodeBlockType*, typename CodeBlockType::UnpackedInstructions&);
5448

5549
WTF::IteratorRange<BasicBlocksVector::reverse_iterator> basicBlocksInReverseOrder()
5650
{
@@ -106,19 +100,14 @@ class BytecodeGraph {
106100
BytecodeBasicBlock* last() { return at(size() - 1); }
107101

108102
private:
109-
Block* m_codeBlock;
110103
BasicBlocksVector m_basicBlocks;
111-
typename Block::UnpackedInstructions& m_instructions;
112104
};
113105

114106

115-
template<typename Block>
116-
BytecodeGraph<Block>::BytecodeGraph(Block* codeBlock, typename Block::UnpackedInstructions& instructions)
117-
: m_codeBlock(codeBlock)
118-
, m_instructions(instructions)
107+
template<typename CodeBlockType>
108+
BytecodeGraph::BytecodeGraph(CodeBlockType* codeBlock, typename CodeBlockType::UnpackedInstructions& instructions)
119109
{
120-
ASSERT(m_codeBlock);
121-
BytecodeBasicBlock::compute(m_codeBlock, instructions.begin(), instructions.size(), m_basicBlocks);
110+
BytecodeBasicBlock::compute(codeBlock, instructions.begin(), instructions.size(), m_basicBlocks);
122111
ASSERT(m_basicBlocks.size());
123112
}
124113

‎Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.cpp‎

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -40,40 +40,33 @@ namespace JSC {
4040
BytecodeLivenessAnalysis::BytecodeLivenessAnalysis(CodeBlock* codeBlock)
4141
: m_graph(codeBlock, codeBlock->instructions())
4242
{
43-
compute();
43+
runLivenessFixpoint(codeBlock, codeBlock->instructions(), m_graph);
44+
45+
if (Options::dumpBytecodeLivenessResults())
46+
dumpResults(codeBlock);
4447
}
4548

46-
void BytecodeLivenessAnalysis::getLivenessInfoAtBytecodeOffset(unsigned bytecodeOffset, FastBitVector& result)
49+
void BytecodeLivenessAnalysis::getLivenessInfoAtBytecodeOffset(CodeBlock* codeBlock, unsigned bytecodeOffset, FastBitVector& result)
4750
{
4851
BytecodeBasicBlock* block = m_graph.findBasicBlockForBytecodeOffset(bytecodeOffset);
4952
ASSERT(block);
5053
ASSERT(!block->isEntryBlock());
5154
ASSERT(!block->isExitBlock());
5255
result.resize(block->out().numBits());
53-
computeLocalLivenessForBytecodeOffset(m_graph, block, bytecodeOffset, result);
56+
computeLocalLivenessForBytecodeOffset(codeBlock, codeBlock->instructions(), m_graph, block, bytecodeOffset, result);
5457
}
5558

56-
bool BytecodeLivenessAnalysis::operandIsLiveAtBytecodeOffset(int operand, unsigned bytecodeOffset)
57-
{
58-
if (operandIsAlwaysLive(operand))
59-
return true;
60-
FastBitVector result;
61-
getLivenessInfoAtBytecodeOffset(bytecodeOffset, result);
62-
return operandThatIsNotAlwaysLiveIsLive(result, operand);
63-
}
64-
65-
FastBitVector BytecodeLivenessAnalysis::getLivenessInfoAtBytecodeOffset(unsigned bytecodeOffset)
59+
FastBitVector BytecodeLivenessAnalysis::getLivenessInfoAtBytecodeOffset(CodeBlock* codeBlock, unsigned bytecodeOffset)
6660
{
6761
FastBitVector out;
68-
getLivenessInfoAtBytecodeOffset(bytecodeOffset, out);
62+
getLivenessInfoAtBytecodeOffset(codeBlock, bytecodeOffset, out);
6963
return out;
7064
}
7165

72-
void BytecodeLivenessAnalysis::computeFullLiveness(FullBytecodeLiveness& result)
66+
void BytecodeLivenessAnalysis::computeFullLiveness(CodeBlock* codeBlock, FullBytecodeLiveness& result)
7367
{
7468
FastBitVector out;
75-
CodeBlock* codeBlock = m_graph.codeBlock();
76-
69+
7770
result.m_map.resize(codeBlock->instructions().size());
7871

7972
for (std::unique_ptr<BytecodeBasicBlock>& block : m_graph.basicBlocksInReverseOrder()) {
@@ -84,17 +77,17 @@ void BytecodeLivenessAnalysis::computeFullLiveness(FullBytecodeLiveness& result)
8477

8578
for (unsigned i = block->offsets().size(); i--;) {
8679
unsigned bytecodeOffset = block->offsets()[i];
87-
stepOverInstruction(m_graph, bytecodeOffset, out);
80+
stepOverInstruction(codeBlock, codeBlock->instructions(), m_graph, bytecodeOffset, out);
8881
result.m_map[bytecodeOffset] = out;
8982
}
9083
}
9184
}
9285

93-
void BytecodeLivenessAnalysis::computeKills(BytecodeKills& result)
86+
void BytecodeLivenessAnalysis::computeKills(CodeBlock* codeBlock, BytecodeKills& result)
9487
{
88+
UNUSED_PARAM(result);
9589
FastBitVector out;
96-
97-
CodeBlock* codeBlock = m_graph.codeBlock();
90+
9891
result.m_codeBlock = codeBlock;
9992
result.m_killSets = std::make_unique<BytecodeKills::KillSet[]>(codeBlock->instructions().size());
10093

@@ -107,7 +100,7 @@ void BytecodeLivenessAnalysis::computeKills(BytecodeKills& result)
107100
for (unsigned i = block->offsets().size(); i--;) {
108101
unsigned bytecodeOffset = block->offsets()[i];
109102
stepOverInstruction(
110-
m_graph, bytecodeOffset,
103+
codeBlock, codeBlock->instructions(), m_graph, bytecodeOffset,
111104
[&] (unsigned index) {
112105
// This is for uses.
113106
if (out[index])
@@ -123,9 +116,8 @@ void BytecodeLivenessAnalysis::computeKills(BytecodeKills& result)
123116
}
124117
}
125118

126-
void BytecodeLivenessAnalysis::dumpResults()
119+
void BytecodeLivenessAnalysis::dumpResults(CodeBlock* codeBlock)
127120
{
128-
CodeBlock* codeBlock = m_graph.codeBlock();
129121
dataLog("\nDumping bytecode liveness for ", *codeBlock, ":\n");
130122
Instruction* instructionsBegin = codeBlock->instructions().begin();
131123
unsigned i = 0;
@@ -178,7 +170,7 @@ void BytecodeLivenessAnalysis::dumpResults()
178170
const Instruction* currentInstruction = &instructionsBegin[bytecodeOffset];
179171

180172
dataLogF("Live variables:");
181-
FastBitVector liveBefore = getLivenessInfoAtBytecodeOffset(bytecodeOffset);
173+
FastBitVector liveBefore = getLivenessInfoAtBytecodeOffset(codeBlock, bytecodeOffset);
182174
dumpBitVector(liveBefore);
183175
dataLogF("\n");
184176
codeBlock->dumpBytecode(WTF::dataFile(), instructionsBegin, currentInstruction);
@@ -195,12 +187,4 @@ void BytecodeLivenessAnalysis::dumpResults()
195187
}
196188
}
197189

198-
void BytecodeLivenessAnalysis::compute()
199-
{
200-
runLivenessFixpoint(m_graph);
201-
202-
if (Options::dumpBytecodeLivenessResults())
203-
dumpResults();
204-
}
205-
206190
} // namespace JSC

‎Source/JavaScriptCore/bytecode/BytecodeLivenessAnalysis.h‎

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ class FullBytecodeLiveness;
3737

3838
class BytecodeLivenessPropagation {
3939
protected:
40-
template<typename Graph, typename UseFunctor, typename DefFunctor> void stepOverInstruction(Graph&, unsigned bytecodeOffset, const UseFunctor&, const DefFunctor&);
40+
template<typename CodeBlockType, typename Instructions, typename UseFunctor, typename DefFunctor> void stepOverInstruction(CodeBlockType*, const Instructions&, BytecodeGraph&, unsigned bytecodeOffset, const UseFunctor&, const DefFunctor&);
4141

42-
template<typename Graph> void stepOverInstruction(Graph&, unsigned bytecodeOffset, FastBitVector& out);
42+
template<typename CodeBlockType, typename Instructions> void stepOverInstruction(CodeBlockType*, const Instructions&, BytecodeGraph&, unsigned bytecodeOffset, FastBitVector& out);
4343

44-
template<typename Graph> bool computeLocalLivenessForBytecodeOffset(Graph&, BytecodeBasicBlock*, unsigned targetOffset, FastBitVector& result);
44+
template<typename CodeBlockType, typename Instructions> bool computeLocalLivenessForBytecodeOffset(CodeBlockType*, const Instructions&, BytecodeGraph&, BytecodeBasicBlock*, unsigned targetOffset, FastBitVector& result);
4545

46-
template<typename Graph> bool computeLocalLivenessForBlock(Graph&, BytecodeBasicBlock*);
46+
template<typename CodeBlockType, typename Instructions> bool computeLocalLivenessForBlock(CodeBlockType*, const Instructions&, BytecodeGraph&, BytecodeBasicBlock*);
4747

48-
template<typename Graph> FastBitVector getLivenessInfoAtBytecodeOffset(Graph&, unsigned bytecodeOffset);
48+
template<typename CodeBlockType, typename Instructions> FastBitVector getLivenessInfoAtBytecodeOffset(CodeBlockType*, const Instructions&, BytecodeGraph&, unsigned bytecodeOffset);
4949

50-
template<typename Graph> void runLivenessFixpoint(Graph&);
50+
template<typename CodeBlockType, typename Instructions> void runLivenessFixpoint(CodeBlockType*, const Instructions&, BytecodeGraph&);
5151
};
5252

5353
class BytecodeLivenessAnalysis : private BytecodeLivenessPropagation {
@@ -57,19 +57,17 @@ class BytecodeLivenessAnalysis : private BytecodeLivenessPropagation {
5757
friend class BytecodeLivenessPropagation;
5858
BytecodeLivenessAnalysis(CodeBlock*);
5959

60-
bool operandIsLiveAtBytecodeOffset(int operand, unsigned bytecodeOffset);
61-
FastBitVector getLivenessInfoAtBytecodeOffset(unsigned bytecodeOffset);
60+
FastBitVector getLivenessInfoAtBytecodeOffset(CodeBlock*, unsigned bytecodeOffset);
6261

63-
void computeFullLiveness(FullBytecodeLiveness& result);
64-
void computeKills(BytecodeKills& result);
62+
void computeFullLiveness(CodeBlock*, FullBytecodeLiveness& result);
63+
void computeKills(CodeBlock*, BytecodeKills& result);
6564

6665
private:
67-
void compute();
68-
void dumpResults();
66+
void dumpResults(CodeBlock*);
6967

70-
void getLivenessInfoAtBytecodeOffset(unsigned bytecodeOffset, FastBitVector&);
68+
void getLivenessInfoAtBytecodeOffset(CodeBlock*, unsigned bytecodeOffset, FastBitVector&);
7169

72-
BytecodeGraph<CodeBlock> m_graph;
70+
BytecodeGraph m_graph;
7371
};
7472

7573
inline bool operandIsAlwaysLive(int operand);

0 commit comments

Comments
 (0)