@@ -54,8 +54,9 @@ FakeStack *FakeStack::Create(uptr stack_size_log) {
5454 stack_size_log = kMinStackSizeLog ;
5555 if (stack_size_log > kMaxStackSizeLog )
5656 stack_size_log = kMaxStackSizeLog ;
57+ CHECK_LE (kMaxStackFrameSizeLog , stack_size_log);
5758 uptr size = RequiredSize (stack_size_log);
58- uptr padded_size = size + ( 1 << kMaxStackFrameSizeLog ) ;
59+ uptr padded_size = size + kMaxStackFrameSize ;
5960 void *true_res = reinterpret_cast <void *>(
6061 flags ()->uar_noreserve ? MmapNoReserveOrDie (padded_size, " FakeStack" )
6162 : MmapOrDie (padded_size, " FakeStack" ));
@@ -64,7 +65,7 @@ FakeStack *FakeStack::Create(uptr stack_size_log) {
6465 // (1 << kMaxStackFrameSizeLog).
6566 // We didn't use MmapAlignedOrDieOnFatalError, because it requires that the
6667 // *size* is a power of 2, which is an overly strong condition.
67- static_assert (alignof (FakeStack) <= ( 1 << kMaxStackFrameSizeLog ) );
68+ static_assert (alignof (FakeStack) <= kMaxStackFrameSize );
6869 FakeStack *res = reinterpret_cast <FakeStack *>(
6970 RoundUpTo (
7071 (uptr)true_res + kFlagsOffset + SizeRequiredForFlags (stack_size_log),
@@ -94,8 +95,7 @@ void FakeStack::Destroy(int tid) {
9495 Report (" T%d: FakeStack destroyed: %s\n " , tid, str.data ());
9596 }
9697 uptr size = RequiredSize (stack_size_log_);
97- uptr padded_size = size + (1 << kMaxStackFrameSizeLog );
98- void *true_start = this ->true_start ;
98+ uptr padded_size = size + kMaxStackFrameSize ;
9999 FlushUnneededASanShadowMemory (reinterpret_cast <uptr>(true_start),
100100 padded_size);
101101 UnmapOrDie (true_start, padded_size);
0 commit comments