Skip to content

Instantly share code, notes, and snippets.

Created September 6, 2013 11:54
Show Gist options
  • Save anonymous/6462797 to your computer and use it in GitHub Desktop.
Save anonymous/6462797 to your computer and use it in GitHub Desktop.
Opcode dumps for stackoverflow question
[1 of 1] Compiling Main ( constant-timings-5.hs, constant-timings-5.o )
==================== Tidy Core ====================
Result size = 240
Main.$WPoint [InlPrag=INLINE]
:: GHC.Types.Double -> GHC.Types.Double -> Main.Point
[GblId[DataConWrapper],
Arity=2,
Caf=NoCafRefs,
Str=DmdType SSm,
Unf=Unf{Src=InlineStable, TopLvl=True, Arity=2, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=False,boring_ok=False)
Tmpl= \ (tpl_B1 [Occ=Once] :: GHC.Types.Double)
(tpl_B2 [Occ=Once] :: GHC.Types.Double) ->
case tpl_B1 of tpl_X4 { __DEFAULT ->
case tpl_B2 of tpl_X6 { __DEFAULT -> Main.Point tpl_X4 tpl_X6 }
}}]
Main.$WPoint =
\ (tpl_B1 [Occ=Once] :: GHC.Types.Double)
(tpl_B2 [Occ=Once] :: GHC.Types.Double) ->
case tpl_B1 of tpl_X4 { __DEFAULT ->
case tpl_B2 of tpl_X6 { __DEFAULT -> Main.Point tpl_X4 tpl_X6 }
}
Rec {
Main.$wfmod [Occ=LoopBreaker]
:: GHC.Prim.Double# -> GHC.Prim.Double# -> GHC.Prim.Double#
[GblId, Arity=2, Caf=NoCafRefs, Str=DmdType LL]
Main.$wfmod =
\ (ww_s1Ug :: GHC.Prim.Double#) (ww1_s1Uk :: GHC.Prim.Double#) ->
case GHC.Prim.<## ww_s1Ug 0.0 of _ {
GHC.Types.False ->
case GHC.Prim.<## ww_s1Ug ww1_s1Uk of _ {
GHC.Types.False ->
case GHC.Prim./## ww_s1Ug ww1_s1Uk of wild2_aDm { __DEFAULT ->
let {
n_aAR [Dmd=Just L] :: GHC.Prim.Int#
[LclId, Str=DmdType]
n_aAR = GHC.Prim.double2Int# wild2_aDm } in
case GHC.Prim.<## wild2_aDm (GHC.Prim.int2Double# n_aAR) of _ {
GHC.Types.False ->
GHC.Prim.*##
ww1_s1Uk (GHC.Prim.-## wild2_aDm (GHC.Prim.int2Double# n_aAR));
GHC.Types.True ->
GHC.Prim.*##
ww1_s1Uk
(GHC.Prim.-##
wild2_aDm (GHC.Prim.int2Double# (GHC.Prim.-# n_aAR 1)))
}
};
GHC.Types.True -> ww_s1Ug
};
GHC.Types.True ->
case GHC.Prim.>=## ww_s1Ug 0.0 of _ {
GHC.Types.False ->
case Main.$wfmod (GHC.Prim.negateDouble# ww_s1Ug) ww1_s1Uk
of ww2_s1Uo { __DEFAULT ->
GHC.Prim.-## ww1_s1Uk ww2_s1Uo
};
GHC.Types.True ->
case Main.$wfmod ww_s1Ug ww1_s1Uk of ww2_s1Uo { __DEFAULT ->
GHC.Prim.-## ww1_s1Uk ww2_s1Uo
}
}
}
end Rec }
Rec {
Main.main_iterate' [Occ=LoopBreaker]
:: (Main.Point -> Main.Point) -> Main.Point -> [Main.Point]
[GblId, Arity=2, Caf=NoCafRefs, Str=DmdType LS(UU)]
Main.main_iterate' =
\ (gen_akN :: Main.Point -> Main.Point) (p_akO :: Main.Point) ->
case p_akO of p1_XkT { Main.Point ipv_sC6 ipv1_sC7 ->
GHC.Types.:
@ Main.Point p1_XkT (Main.main_iterate' gen_akN (gen_akN p1_XkT))
}
end Rec }
Main.main7 :: Main.Point -> Main.Point
[GblId,
Arity=1,
Caf=NoCafRefs,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=1, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=IF_ARGS [20] 147 120}]
Main.main7 =
\ (ds_dzT :: Main.Point) ->
case ds_dzT of _ { Main.Point q_akL p_akM ->
case q_akL of _ { GHC.Types.D# x_s1Uy ->
case p_akM of _ { GHC.Types.D# y_s1UC ->
case Main.$wfmod (GHC.Prim.+## x_s1Uy y_s1UC) 6.283185307179586
of ww_s1Uo { __DEFAULT ->
case Main.$wfmod
(GHC.Prim.+##
y_s1UC
(GHC.Prim.*## -0.3660254037844385 (GHC.Prim.sinDouble# x_s1Uy)))
6.283185307179586
of ww1_X1V5 { __DEFAULT ->
Main.Point (GHC.Types.D# ww_s1Uo) (GHC.Types.D# ww1_X1V5)
}
}
}
}
}
Main.main6 :: GHC.Types.Double
[GblId,
Caf=NoCafRefs,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=IF_ARGS [] 10 110}]
Main.main6 = GHC.Types.D# 0.15
Main.main5 :: GHC.Types.Double
[GblId,
Caf=NoCafRefs,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=IF_ARGS [] 10 110}]
Main.main5 = GHC.Types.D# 0.25
Main.main4 :: Main.Point
[GblId,
Caf=NoCafRefs,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=IF_ARGS [] 10 120}]
Main.main4 = Main.Point Main.main6 Main.main5
Main.main3 :: [Main.Point]
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=False,
ConLike=False, Cheap=False, Expandable=False,
Guidance=IF_ARGS [] 30 0}]
Main.main3 = Main.main_iterate' Main.main7 Main.main4
Main.main2 :: GHC.Base.String
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=False,
ConLike=False, Cheap=False, Expandable=False,
Guidance=IF_ARGS [] 384 240}]
Main.main2 =
case GHC.List.drop_drop# @ Main.Point 100000000 Main.main3 of _ {
[] ->
GHC.List.badHead
`cast` (UnsafeCo (forall a_aBw. a_aBw) GHC.Base.String
:: (forall a_aBw. a_aBw) ~# GHC.Base.String);
: x_aBy _ ->
case x_aBy of _ { Main.Point a_akR b_akS ->
case a_akR of _ { GHC.Types.D# x1_s1UL ->
case b_akS of _ { GHC.Types.D# y_s1UP ->
let {
ww_a1TE [Dmd=Just L] :: GHC.Prim.Double#
[LclId, Str=DmdType]
ww_a1TE = GHC.Prim.+## x1_s1UL y_s1UP } in
case GHC.Prim.<## ww_a1TE 0.0 of _ {
GHC.Types.False ->
case {__pkg_ccall base isDoubleNegativeZero GHC.Prim.Double#
-> GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, GHC.Prim.Int# #)}_a1TU
ww_a1TE GHC.Prim.realWorld#
of _ { (# _, ds2_a1TZ #) ->
case ds2_a1TZ of _ {
__DEFAULT ->
GHC.Types.:
@ GHC.Types.Char
GHC.Float.$fShowDouble2
(GHC.Base.++
@ GHC.Types.Char
(GHC.Float.$w$sformatRealFloat
GHC.Float.FFGeneric
(Data.Maybe.Nothing @ GHC.Types.Int)
(GHC.Prim.negateDouble# ww_a1TE))
(GHC.Types.[] @ GHC.Types.Char));
0 ->
GHC.Base.++
@ GHC.Types.Char
(GHC.Float.$w$sformatRealFloat
GHC.Float.FFGeneric (Data.Maybe.Nothing @ GHC.Types.Int) ww_a1TE)
(GHC.Types.[] @ GHC.Types.Char)
}
};
GHC.Types.True ->
GHC.Types.:
@ GHC.Types.Char
GHC.Float.$fShowDouble2
(GHC.Base.++
@ GHC.Types.Char
(GHC.Float.$w$sformatRealFloat
GHC.Float.FFGeneric
(Data.Maybe.Nothing @ GHC.Types.Int)
(GHC.Prim.negateDouble# ww_a1TE))
(GHC.Types.[] @ GHC.Types.Char))
}
}
}
}
}
Main.main1
:: GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
[GblId,
Arity=1,
Str=DmdType L,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=1, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=IF_ARGS [0] 50 0}]
Main.main1 =
\ (eta_aDJ :: GHC.Prim.State# GHC.Prim.RealWorld) ->
GHC.IO.Handle.Text.hPutStr2
GHC.IO.Handle.FD.stdout Main.main2 GHC.Types.True eta_aDJ
Main.main :: GHC.Types.IO ()
[GblId,
Arity=1,
Str=DmdType L,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=True)}]
Main.main =
Main.main1
`cast` (Sym (GHC.Types.NTCo:IO <()>)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~#
GHC.Types.IO ())
Main.main8
:: GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
[GblId,
Arity=1,
Str=DmdType L,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=1, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=IF_ARGS [0] 30 0}]
Main.main8 =
\ (eta_B1 :: GHC.Prim.State# GHC.Prim.RealWorld) ->
GHC.TopHandler.runMainIO1
@ ()
(Main.main1
`cast` (Sym (GHC.Types.NTCo:IO <()>)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~#
GHC.Types.IO ()))
eta_B1
:Main.main :: GHC.Types.IO ()
[GblId,
Arity=1,
Str=DmdType L,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=True)}]
:Main.main =
Main.main8
`cast` (Sym (GHC.Types.NTCo:IO <()>)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~#
GHC.Types.IO ())
Linking constant-timings-5 ...
[1 of 1] Compiling Main ( constant-timings-6.hs, constant-timings-6.o )
==================== Tidy Core ====================
Result size = 240
Main.$WPoint [InlPrag=INLINE]
:: GHC.Types.Double -> GHC.Types.Double -> Main.Point
[GblId[DataConWrapper],
Arity=2,
Caf=NoCafRefs,
Str=DmdType SSm,
Unf=Unf{Src=InlineStable, TopLvl=True, Arity=2, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=False,boring_ok=False)
Tmpl= \ (tpl_B1 [Occ=Once] :: GHC.Types.Double)
(tpl_B2 [Occ=Once] :: GHC.Types.Double) ->
case tpl_B1 of tpl_X4 { __DEFAULT ->
case tpl_B2 of tpl_X6 { __DEFAULT -> Main.Point tpl_X4 tpl_X6 }
}}]
Main.$WPoint =
\ (tpl_B1 [Occ=Once] :: GHC.Types.Double)
(tpl_B2 [Occ=Once] :: GHC.Types.Double) ->
case tpl_B1 of tpl_X4 { __DEFAULT ->
case tpl_B2 of tpl_X6 { __DEFAULT -> Main.Point tpl_X4 tpl_X6 }
}
Rec {
Main.$wfmod [Occ=LoopBreaker]
:: GHC.Prim.Double# -> GHC.Prim.Double# -> GHC.Prim.Double#
[GblId, Arity=2, Caf=NoCafRefs, Str=DmdType LL]
Main.$wfmod =
\ (ww_s1U7 :: GHC.Prim.Double#) (ww1_s1Ub :: GHC.Prim.Double#) ->
case GHC.Prim.<## ww_s1U7 0.0 of _ {
GHC.Types.False ->
case GHC.Prim.<## ww_s1U7 ww1_s1Ub of _ {
GHC.Types.False ->
case GHC.Prim./## ww_s1U7 ww1_s1Ub of wild2_aDd { __DEFAULT ->
let {
n_aAI [Dmd=Just L] :: GHC.Prim.Int#
[LclId, Str=DmdType]
n_aAI = GHC.Prim.double2Int# wild2_aDd } in
case GHC.Prim.<## wild2_aDd (GHC.Prim.int2Double# n_aAI) of _ {
GHC.Types.False ->
GHC.Prim.*##
ww1_s1Ub (GHC.Prim.-## wild2_aDd (GHC.Prim.int2Double# n_aAI));
GHC.Types.True ->
GHC.Prim.*##
ww1_s1Ub
(GHC.Prim.-##
wild2_aDd (GHC.Prim.int2Double# (GHC.Prim.-# n_aAI 1)))
}
};
GHC.Types.True -> ww_s1U7
};
GHC.Types.True ->
case GHC.Prim.>=## ww_s1U7 0.0 of _ {
GHC.Types.False ->
case Main.$wfmod (GHC.Prim.negateDouble# ww_s1U7) ww1_s1Ub
of ww2_s1Uf { __DEFAULT ->
GHC.Prim.-## ww1_s1Ub ww2_s1Uf
};
GHC.Types.True ->
case Main.$wfmod ww_s1U7 ww1_s1Ub of ww2_s1Uf { __DEFAULT ->
GHC.Prim.-## ww1_s1Ub ww2_s1Uf
}
}
}
end Rec }
Rec {
Main.main_iterate' [Occ=LoopBreaker]
:: (Main.Point -> Main.Point) -> Main.Point -> [Main.Point]
[GblId, Arity=2, Caf=NoCafRefs, Str=DmdType LS(UU)]
Main.main_iterate' =
\ (gen_aky :: Main.Point -> Main.Point) (p_akz :: Main.Point) ->
case p_akz of p1_XkE { Main.Point ipv_sBX ipv1_sBY ->
GHC.Types.:
@ Main.Point p1_XkE (Main.main_iterate' gen_aky (gen_aky p1_XkE))
}
end Rec }
Main.main7 :: Main.Point -> Main.Point
[GblId,
Arity=1,
Caf=NoCafRefs,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=1, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=IF_ARGS [20] 147 120}]
Main.main7 =
\ (ds_dzK :: Main.Point) ->
case ds_dzK of _ { Main.Point q_akw p_akx ->
case q_akw of _ { GHC.Types.D# x_s1Up ->
case p_akx of _ { GHC.Types.D# y_s1Ut ->
case Main.$wfmod (GHC.Prim.+## x_s1Up y_s1Ut) 6.283185307179586
of ww_s1Uf { __DEFAULT ->
case Main.$wfmod
(GHC.Prim.+##
y_s1Ut
(GHC.Prim.*## -0.3660254037844386 (GHC.Prim.sinDouble# x_s1Up)))
6.283185307179586
of ww1_X1UW { __DEFAULT ->
Main.Point (GHC.Types.D# ww_s1Uf) (GHC.Types.D# ww1_X1UW)
}
}
}
}
}
Main.main6 :: GHC.Types.Double
[GblId,
Caf=NoCafRefs,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=IF_ARGS [] 10 110}]
Main.main6 = GHC.Types.D# 0.15
Main.main5 :: GHC.Types.Double
[GblId,
Caf=NoCafRefs,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=IF_ARGS [] 10 110}]
Main.main5 = GHC.Types.D# 0.25
Main.main4 :: Main.Point
[GblId,
Caf=NoCafRefs,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=IF_ARGS [] 10 120}]
Main.main4 = Main.Point Main.main6 Main.main5
Main.main3 :: [Main.Point]
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=False,
ConLike=False, Cheap=False, Expandable=False,
Guidance=IF_ARGS [] 30 0}]
Main.main3 = Main.main_iterate' Main.main7 Main.main4
Main.main2 :: GHC.Base.String
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=False,
ConLike=False, Cheap=False, Expandable=False,
Guidance=IF_ARGS [] 384 240}]
Main.main2 =
case GHC.List.drop_drop# @ Main.Point 100000000 Main.main3 of _ {
[] ->
GHC.List.badHead
`cast` (UnsafeCo (forall a_aBn. a_aBn) GHC.Base.String
:: (forall a_aBn. a_aBn) ~# GHC.Base.String);
: x_aBp _ ->
case x_aBp of _ { Main.Point a_akC b_akD ->
case a_akC of _ { GHC.Types.D# x1_s1UC ->
case b_akD of _ { GHC.Types.D# y_s1UG ->
let {
ww_a1Tv [Dmd=Just L] :: GHC.Prim.Double#
[LclId, Str=DmdType]
ww_a1Tv = GHC.Prim.+## x1_s1UC y_s1UG } in
case GHC.Prim.<## ww_a1Tv 0.0 of _ {
GHC.Types.False ->
case {__pkg_ccall base isDoubleNegativeZero GHC.Prim.Double#
-> GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, GHC.Prim.Int# #)}_a1TL
ww_a1Tv GHC.Prim.realWorld#
of _ { (# _, ds2_a1TQ #) ->
case ds2_a1TQ of _ {
__DEFAULT ->
GHC.Types.:
@ GHC.Types.Char
GHC.Float.$fShowDouble2
(GHC.Base.++
@ GHC.Types.Char
(GHC.Float.$w$sformatRealFloat
GHC.Float.FFGeneric
(Data.Maybe.Nothing @ GHC.Types.Int)
(GHC.Prim.negateDouble# ww_a1Tv))
(GHC.Types.[] @ GHC.Types.Char));
0 ->
GHC.Base.++
@ GHC.Types.Char
(GHC.Float.$w$sformatRealFloat
GHC.Float.FFGeneric (Data.Maybe.Nothing @ GHC.Types.Int) ww_a1Tv)
(GHC.Types.[] @ GHC.Types.Char)
}
};
GHC.Types.True ->
GHC.Types.:
@ GHC.Types.Char
GHC.Float.$fShowDouble2
(GHC.Base.++
@ GHC.Types.Char
(GHC.Float.$w$sformatRealFloat
GHC.Float.FFGeneric
(Data.Maybe.Nothing @ GHC.Types.Int)
(GHC.Prim.negateDouble# ww_a1Tv))
(GHC.Types.[] @ GHC.Types.Char))
}
}
}
}
}
Main.main1
:: GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
[GblId,
Arity=1,
Str=DmdType L,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=1, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=IF_ARGS [0] 50 0}]
Main.main1 =
\ (eta_aDA :: GHC.Prim.State# GHC.Prim.RealWorld) ->
GHC.IO.Handle.Text.hPutStr2
GHC.IO.Handle.FD.stdout Main.main2 GHC.Types.True eta_aDA
Main.main :: GHC.Types.IO ()
[GblId,
Arity=1,
Str=DmdType L,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=True)}]
Main.main =
Main.main1
`cast` (Sym (GHC.Types.NTCo:IO <()>)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~#
GHC.Types.IO ())
Main.main8
:: GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
[GblId,
Arity=1,
Str=DmdType L,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=1, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=IF_ARGS [0] 30 0}]
Main.main8 =
\ (eta_B1 :: GHC.Prim.State# GHC.Prim.RealWorld) ->
GHC.TopHandler.runMainIO1
@ ()
(Main.main1
`cast` (Sym (GHC.Types.NTCo:IO <()>)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~#
GHC.Types.IO ()))
eta_B1
:Main.main :: GHC.Types.IO ()
[GblId,
Arity=1,
Str=DmdType L,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=0, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=True)}]
:Main.main =
Main.main8
`cast` (Sym (GHC.Types.NTCo:IO <()>)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~#
GHC.Types.IO ())
Linking constant-timings-6 ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment