Skip to content

Commit 81fc1fc

Browse files
brianosmanSkia Commit-Bot
authored andcommitted
Remove fRootSymbolTable from IR Generator
Two Compiler methods that use the root symbol table are still dangerous, they're polluting the global namespace. For long-lived compilers, we don't want to do that. takeOwnership is only used in tests, but registerExternalValue is used by particles. Thinking I'll move that to an optional argument to convertProgram, or a field on Settings. Change-Id: Ic88d29d053510001931dcc2388aba2dc83a953ea Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319030 Commit-Queue: Brian Osman <[email protected]> Commit-Queue: John Stiles <[email protected]> Reviewed-by: John Stiles <[email protected]>
1 parent 647a9bd commit 81fc1fc

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

src/sksl/SkSLCompiler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,11 +1565,11 @@ bool Compiler::scanCFG(FunctionDefinition& f) {
15651565
}
15661566

15671567
void Compiler::registerExternalValue(ExternalValue* value) {
1568-
fIRGenerator->fRootSymbolTable->addWithoutOwnership(value->fName, value);
1568+
fRootSymbolTable->addWithoutOwnership(value->fName, value);
15691569
}
15701570

15711571
const Symbol* Compiler::takeOwnership(std::unique_ptr<const Symbol> symbol) {
1572-
return fIRGenerator->fRootSymbolTable->takeOwnershipOfSymbol(std::move(symbol));
1572+
return fRootSymbolTable->takeOwnershipOfSymbol(std::move(symbol));
15731573
}
15741574

15751575
std::unique_ptr<Program> Compiler::convertProgram(Program::Kind kind, String text,

src/sksl/SkSLIRGenerator.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ IRGenerator::IRGenerator(const Context* context, Inliner* inliner,
125125
: fContext(*context)
126126
, fInliner(inliner)
127127
, fCurrentFunction(nullptr)
128-
, fRootSymbolTable(symbolTable)
129128
, fSymbolTable(symbolTable)
130129
, fLoopLevel(0)
131130
, fSwitchLevel(0)

src/sksl/SkSLIRGenerator.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ class IRGenerator {
204204
std::unique_ptr<ASTFile> fFile;
205205
const FunctionDeclaration* fCurrentFunction;
206206
std::unordered_map<String, Program::Settings::Value> fCapsMap;
207-
std::shared_ptr<SymbolTable> fRootSymbolTable;
208207
std::shared_ptr<SymbolTable> fSymbolTable;
209208
// additional statements that need to be inserted before the one that convertStatement is
210209
// currently working on

0 commit comments

Comments
 (0)