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

Side by Side Diff: src/IceGlobalContext.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 | « src/IceGlobalContext.h ('k') | src/IceSwitchLowering.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/IceGlobalContext.cpp - Global context defs -------------===// 1 //===- subzero/src/IceGlobalContext.cpp - Global context defs -------------===//
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 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 // Create a random number generator for jump tables reordering, considering 888 // Create a random number generator for jump tables reordering, considering
889 // jump tables as pooled constants. 889 // jump tables as pooled constants.
890 RandomNumberGenerator RNG(getFlags().getRandomSeed(), 890 RandomNumberGenerator RNG(getFlags().getRandomSeed(),
891 RPE_PooledConstantReordering); 891 RPE_PooledConstantReordering);
892 RandomShuffle(JumpTables.begin(), JumpTables.end(), 892 RandomShuffle(JumpTables.begin(), JumpTables.end(),
893 [&RNG](uint64_t N) { return (uint32_t)RNG.next(N); }); 893 [&RNG](uint64_t N) { return (uint32_t)RNG.next(N); });
894 } 894 }
895 return JumpTables; 895 return JumpTables;
896 } 896 }
897 897
898 JumpTableData &GlobalContext::addJumpTable(IceString FuncName, SizeT Id, 898 JumpTableData &
899 SizeT NumTargets) { 899 GlobalContext::addJumpTable(IceString FuncName, SizeT Id,
900 const JumpTableData::TargetList &TargetList) {
900 auto JumpTableList = getJumpTableList(); 901 auto JumpTableList = getJumpTableList();
901 JumpTableList->emplace_back(FuncName, Id, NumTargets); 902 JumpTableList->emplace_back(FuncName, Id, TargetList);
902 return JumpTableList->back(); 903 return JumpTableList->back();
903 } 904 }
904 905
905 TimerStackIdT GlobalContext::newTimerStackID(const IceString &Name) { 906 TimerStackIdT GlobalContext::newTimerStackID(const IceString &Name) {
906 if (!BuildDefs::dump()) 907 if (!BuildDefs::dump())
907 return 0; 908 return 0;
908 auto Timers = getTimers(); 909 auto Timers = getTimers();
909 TimerStackIdT NewID = Timers->size(); 910 TimerStackIdT NewID = Timers->size();
910 Timers->push_back(TimerStack(Name)); 911 Timers->push_back(TimerStack(Name));
911 return NewID; 912 return NewID;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 Ctx = Func->getContext(); 1009 Ctx = Func->getContext();
1009 Active = 1010 Active =
1010 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled(); 1011 Func->getFocusedTiming() || Ctx->getFlags().getSubzeroTimingEnabled();
1011 if (Active) 1012 if (Active)
1012 Ctx->pushTimer(ID, StackID); 1013 Ctx->pushTimer(ID, StackID);
1013 } 1014 }
1014 1015
1015 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); 1016 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS);
1016 1017
1017 } // end of namespace Ice 1018 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceGlobalContext.h ('k') | src/IceSwitchLowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698