Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: src/IceCfg.cpp

Issue 1460003003: Fix race condition in jump table list creation (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add some missing consts Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/IceGlobalContext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===// 1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 959
960 void Cfg::emitJumpTables() { 960 void Cfg::emitJumpTables() {
961 switch (Ctx->getFlags().getOutFileType()) { 961 switch (Ctx->getFlags().getOutFileType()) {
962 case FT_Elf: 962 case FT_Elf:
963 case FT_Iasm: { 963 case FT_Iasm: {
964 // The emission needs to be delayed until the after the text section so 964 // The emission needs to be delayed until the after the text section so
965 // save the offsets in the global context. 965 // save the offsets in the global context.
966 IceString MangledName = Ctx->mangleName(getFunctionName()); 966 IceString MangledName = Ctx->mangleName(getFunctionName());
967 for (const InstJumpTable *JumpTable : JumpTables) { 967 for (const InstJumpTable *JumpTable : JumpTables) {
968 SizeT NumTargets = JumpTable->getNumTargets(); 968 SizeT NumTargets = JumpTable->getNumTargets();
969 JumpTableData &JT = 969 JumpTableData::TargetList TargetList;
970 Ctx->addJumpTable(MangledName, JumpTable->getId(), NumTargets);
971 for (SizeT I = 0; I < NumTargets; ++I) { 970 for (SizeT I = 0; I < NumTargets; ++I) {
972 SizeT Index = JumpTable->getTarget(I)->getIndex(); 971 SizeT Index = JumpTable->getTarget(I)->getIndex();
973 JT.pushTarget(getAssembler()->getCfgNodeLabel(Index)->getPosition()); 972 TargetList.emplace_back(
973 getAssembler()->getCfgNodeLabel(Index)->getPosition());
974 } 974 }
975 Ctx->addJumpTable(MangledName, JumpTable->getId(), TargetList);
975 } 976 }
976 } break; 977 } break;
977 case FT_Asm: { 978 case FT_Asm: {
978 // Emit the assembly directly so we don't need to hang on to all the names 979 // Emit the assembly directly so we don't need to hang on to all the names
979 for (const InstJumpTable *JumpTable : JumpTables) 980 for (const InstJumpTable *JumpTable : JumpTables)
980 getTarget()->emitJumpTable(this, JumpTable); 981 getTarget()->emitJumpTable(this, JumpTable);
981 } break; 982 } break;
982 } 983 }
983 } 984 }
984 985
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 } 1090 }
1090 } 1091 }
1091 // Print each basic block 1092 // Print each basic block
1092 for (CfgNode *Node : Nodes) 1093 for (CfgNode *Node : Nodes)
1093 Node->dump(this); 1094 Node->dump(this);
1094 if (isVerbose(IceV_Instructions)) 1095 if (isVerbose(IceV_Instructions))
1095 Str << "}\n"; 1096 Str << "}\n";
1096 } 1097 }
1097 1098
1098 } // end of namespace Ice 1099 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | src/IceGlobalContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698