Rodrigo Mesquita pushed to branch wip/romes/step-out-11 at Glasgow Haskell Compiler / GHC
Commits:
-
062cc2b1
by Rodrigo Mesquita at 2025-07-29T19:17:43+01:00
1 changed file:
Changes:
| ... | ... | @@ -751,12 +751,21 @@ doTailCall init_d s p fn args = do |
| 751 | 751 | |
| 752 | 752 | where
|
| 753 | 753 | do_pushes !d [] reps = do
|
| 754 | - assert (null reps) return ()
|
|
| 755 | - (push_fn, sz) <- pushAtom d p (StgVarArg fn)
|
|
| 756 | 754 | platform <- profilePlatform <$> getProfile
|
| 757 | - assert (sz == wordSize platform) return ()
|
|
| 758 | - let slide = mkSlideB platform (d - init_d + wordSize platform) (init_d - s)
|
|
| 759 | - return (push_fn `appOL` (slide `appOL` unitOL ENTER))
|
|
| 755 | + assert (null reps) return ()
|
|
| 756 | + case lookupBCEnv_maybe fn p of
|
|
| 757 | + Just d_v
|
|
| 758 | + | d - d_v == 0 -- shortcut; the first thing on the stack is what we want to enter,
|
|
| 759 | + , d_v <= init_d -- and it is between init_d and sequel (which would be dropped)
|
|
| 760 | + -> do
|
|
| 761 | + let slide = mkSlideB platform (d - init_d + wordSize platform)
|
|
| 762 | + (init_d - s - wordSize platform)
|
|
| 763 | + return (slide `appOL` unitOL ENTER)
|
|
| 764 | + _ -> do
|
|
| 765 | + (push_fn, sz) <- pushAtom d p (StgVarArg fn)
|
|
| 766 | + assert (sz == wordSize platform) return ()
|
|
| 767 | + let slide = mkSlideB platform (d - init_d + wordSize platform) (init_d - s)
|
|
| 768 | + return (push_fn `appOL` (slide `appOL` unitOL ENTER))
|
|
| 760 | 769 | do_pushes !d args reps = do
|
| 761 | 770 | let (push_apply, n, rest_of_reps) = findPushSeq reps
|
| 762 | 771 | (these_args, rest_of_args) = splitAt n args
|