Merge "Revert logic to calculate StackEndHeight" into tm-dev