File tree Expand file tree Collapse file tree 17 files changed +937
-2399
lines changed
plutus-core/src/PlutusCore
plutus-use-cases/test/Spec Expand file tree Collapse file tree 17 files changed +937
-2399
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ import Data.Set.Lens (setOf)
3434purely :: ((a -> Identity b ) -> c -> Identity d ) -> (a -> b ) -> c -> d
3535purely = coerce
3636
37+ {-# INLINE substTyVarA #-}
3738-- | Applicatively replace a type variable using the given function.
3839substTyVarA
3940 :: Applicative f
@@ -66,7 +67,9 @@ substVar
6667 -> Term tyname name uni fun ann
6768substVar = purely substVarA
6869
70+ {-# INLINE typeSubstTyNamesM #-}
6971-- | Naively monadically substitute type names (i.e. do not substitute binders).
72+ -- INLINE is important here because the function is too polymorphic (determined from profiling)
7073typeSubstTyNamesM
7174 :: Monad m
7275 => (tyname -> m (Maybe (Type tyname uni ann )))
Original file line number Diff line number Diff line change @@ -27,12 +27,14 @@ betaStep = \case
2727 bindings = binding :| []
2828 in
2929 Let a NonRec bindings body
30- TyInst a (TyAbs _ tyname kind body) typ ->
31- let tyVarDecl = TyVarDecl a tyname kind
32- tyBinding = TypeBind a tyVarDecl typ
33- bindings = tyBinding :| []
34- in
35- Let a NonRec bindings body
30+ -- This case is disabled as it introduces a lot of type inlining (determined from profiling)
31+ -- and is currently unsound https://input-output.atlassian.net/browse/SCP-2570.
32+ -- TyInst a (TyAbs _ tyname kind body) typ ->
33+ -- let tyVarDecl = TyVarDecl a tyname kind
34+ -- tyBinding = TypeBind a tyVarDecl typ
35+ -- bindings = tyBinding :| []
36+ -- in
37+ -- Let a NonRec bindings body
3638 t -> t
3739
3840{-|
Original file line number Diff line number Diff line change 33 [
44 [
55 [
6- (lam
7- Nil_i0
8- (all
9- a_i0
10- (type)
11- [
6+ {
7+ (abs
8+ List_i0
9+ (fun (type) (type))
10+ (lam
11+ Nil_i0
12+ (all a_i0 (type) [ List_i3 a_i1 ])
1213 (lam
13- a_i0
14- (type)
15- (ifix
16- (lam
17- List_i0
18- (fun (type) (type))
19- (lam
20- a_i0
21- (type)
14+ Cons_i0
15+ (all
16+ a_i0 (type) (fun a_i1 (fun [ List_i4 a_i1 ] [ List_i4 a_i1 ]))
17+ )
18+ (lam
19+ match_List_i0
20+ (all
21+ a_i0
22+ (type)
23+ (fun
24+ [ List_i5 a_i1 ]
2225 (all
2326 out_List_i0
2427 (type)
2528 (fun
2629 out_List_i1
2730 (fun
28- (fun a_i2 (fun [ List_i3 a_i2 ] out_List_i1))
31+ (fun a_i2 (fun [ List_i6 a_i2 ] out_List_i1))
2932 out_List_i1
3033 )
3134 )
3235 )
3336 )
3437 )
35- a_i1
36- )
37- )
38- a_i1
39- ]
40- )
41- (lam
42- Cons_i0
43- (all
44- a_i0
45- (type)
46- (fun
47- a_i1
48- (fun
49- [
50- (lam
51- a_i0
52- (type)
53- (ifix
54- (lam
55- List_i0
56- (fun (type) (type))
57- (lam
58- a_i0
59- (type)
60- (all
61- out_List_i0
62- (type)
63- (fun
64- out_List_i1
65- (fun
66- (fun a_i2 (fun [ List_i3 a_i2 ] out_List_i1))
67- out_List_i1
68- )
69- )
70- )
71- )
72- )
73- a_i1
74- )
75- )
76- a_i1
77- ]
7838 [
39+ [
40+ {
41+ [
42+ { match_List_i1 (all a_i0 (type) (fun a_i1 a_i1)) }
43+ { Nil_i3 (all a_i0 (type) (fun a_i1 a_i1)) }
44+ ]
45+ (all a_i0 (type) (fun a_i1 a_i1))
46+ }
47+ (abs a_i0 (type) (lam x_i0 a_i2 x_i1))
48+ ]
7949 (lam
80- a_i0
81- (type)
82- (ifix
83- (lam
84- List_i0
85- (fun (type) (type))
86- (lam
87- a_i0
88- (type)
89- (all
90- out_List_i0
91- (type)
92- (fun
93- out_List_i1
94- (fun
95- (fun a_i2 (fun [ List_i3 a_i2 ] out_List_i1))
96- out_List_i1
97- )
98- )
99- )
100- )
101- )
102- a_i1
50+ head_i0
51+ (all a_i0 (type) (fun a_i1 a_i1))
52+ (lam
53+ tail_i0
54+ [ List_i6 (all a_i0 (type) (fun a_i1 a_i1)) ]
55+ head_i2
10356 )
10457 )
105- a_i1
10658 ]
10759 )
10860 )
10961 )
110- (lam
111- match_List_i0
112- (all
113- a_i0
114- (type)
115- (fun
116- [
117- (lam
118- a_i0
119- (type)
120- (ifix
121- (lam
122- List_i0
123- (fun (type) (type))
124- (lam
125- a_i0
126- (type)
127- (all
128- out_List_i0
129- (type)
130- (fun
131- out_List_i1
132- (fun
133- (fun a_i2 (fun [ List_i3 a_i2 ] out_List_i1))
134- out_List_i1
135- )
136- )
137- )
138- )
139- )
140- a_i1
141- )
142- )
143- a_i1
144- ]
62+ )
63+ (lam
64+ a_i0
65+ (type)
66+ (ifix
67+ (lam
68+ List_i0
69+ (fun (type) (type))
70+ (lam
71+ a_i0
72+ (type)
14573 (all
14674 out_List_i0
14775 (type)
14876 (fun
14977 out_List_i1
15078 (fun
151- (fun
152- a_i2
153- (fun
154- [
155- (lam
156- a_i0
157- (type)
158- (ifix
159- (lam
160- List_i0
161- (fun (type) (type))
162- (lam
163- a_i0
164- (type)
165- (all
166- out_List_i0
167- (type)
168- (fun
169- out_List_i1
170- (fun
171- (fun
172- a_i2
173- (fun [ List_i3 a_i2 ] out_List_i1)
174- )
175- out_List_i1
176- )
177- )
178- )
179- )
180- )
181- a_i1
182- )
183- )
184- a_i2
185- ]
186- out_List_i1
187- )
188- )
79+ (fun a_i2 (fun [ List_i3 a_i2 ] out_List_i1))
18980 out_List_i1
19081 )
19182 )
19283 )
19384 )
19485 )
195- [
196- [
197- {
198- [
199- { match_List_i1 (all a_i0 (type) (fun a_i1 a_i1)) }
200- { Nil_i3 (all a_i0 (type) (fun a_i1 a_i1)) }
201- ]
202- (all a_i0 (type) (fun a_i1 a_i1))
203- }
204- (abs a_i0 (type) (lam x_i0 a_i2 x_i1))
205- ]
206- (lam
207- head_i0
208- (all a_i0 (type) (fun a_i1 a_i1))
209- (lam
210- tail_i0
211- [
212- (lam
213- a_i0
214- (type)
215- (ifix
216- (lam
217- List_i0
218- (fun (type) (type))
219- (lam
220- a_i0
221- (type)
222- (all
223- out_List_i0
224- (type)
225- (fun
226- out_List_i1
227- (fun
228- (fun
229- a_i2 (fun [ List_i3 a_i2 ] out_List_i1)
230- )
231- out_List_i1
232- )
233- )
234- )
235- )
236- )
237- a_i1
238- )
239- )
240- (all a_i0 (type) (fun a_i1 a_i1))
241- ]
242- head_i2
243- )
244- )
245- ]
86+ a_i1
24687 )
24788 )
248- )
89+ }
24990 (abs
25091 a_i0
25192 (type)
You can’t perform that action at this time.
0 commit comments