Skip to content

Commit

Permalink
Attempt to rewrite unnecessary constructor applications in the plugin (
Browse files Browse the repository at this point in the history
…#5649)

* Attempt to rewrite opaque constructor applications in the plugin

* Update plutus-tx-plugin/src/PlutusTx/Compiler/Expr.hs

Co-authored-by: Michael Peyton Jones <[email protected]>

* Update plutus-tx-plugin/src/PlutusTx/Compiler/Expr.hs

Co-authored-by: Michael Peyton Jones <[email protected]>

* Rewrite all unnecessary constructor applications

* cabal files

---------

Co-authored-by: Michael Peyton Jones <[email protected]>
  • Loading branch information
zliu41 and michaelpj authored Nov 23, 2023
1 parent e974b48 commit 98c5167
Show file tree
Hide file tree
Showing 53 changed files with 225 additions and 120 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1428979902
| mem: 5367574})
({cpu: 1428703902
| mem: 5366374})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1438491380
| mem: 5012365})
({cpu: 1438353380
| mem: 5011765})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1417412598
| mem: 5183617})
({cpu: 1417136598
| mem: 5182417})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1544798878
| mem: 5626951})
({cpu: 1544660878
| mem: 5626351})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1909249237
| mem: 6938218})
({cpu: 1908697237
| mem: 6935818})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1005387218
| mem: 3676461})
({cpu: 1005249218
| mem: 3675861})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1600079695
| mem: 5950644})
({cpu: 1599665695
| mem: 5948844})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1008646729
| mem: 3687894})
({cpu: 1008508729
| mem: 3687294})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1421735134
| mem: 5238131})
({cpu: 1421597134
| mem: 5237531})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1431481884
| mem: 5121021})
({cpu: 1431343884
| mem: 5120421})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1459372109
| mem: 5284223})
({cpu: 1459234109
| mem: 5283623})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 698186900
| mem: 2541975})
({cpu: 698048900
| mem: 2541375})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1019039066
| mem: 3760674})
({cpu: 1018901066
| mem: 3760074})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1439049563
| mem: 5281393})
({cpu: 1438911563
| mem: 5280793})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1448656659
| mem: 5039771})
({cpu: 1448380659
| mem: 5038571})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1885978449
| mem: 6837860})
({cpu: 1885426449
| mem: 6835460})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1423763870
| mem: 5261307})
({cpu: 1423625870
| mem: 5260707})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1269996610
| mem: 4667910})
({cpu: 1269720610
| mem: 4666710})
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11593
11589
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1431072902
| mem: 5376674})
({cpu: 1430796902
| mem: 5375474})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1438514380
| mem: 5012465})
({cpu: 1438376380
| mem: 5011865})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1420011598
| mem: 5194917})
({cpu: 1419735598
| mem: 5193717})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1547742878
| mem: 5639751})
({cpu: 1547604878
| mem: 5639151})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1912515237
| mem: 6952418})
({cpu: 1911963237
| mem: 6950018})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1007365218
| mem: 3685061})
({cpu: 1007227218
| mem: 3684461})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1601482695
| mem: 5956744})
({cpu: 1601068695
| mem: 5954944})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1008094729
| mem: 3685494})
({cpu: 1007956729
| mem: 3684894})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1423483134
| mem: 5245731})
({cpu: 1423345134
| mem: 5245131})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1431826884
| mem: 5122521})
({cpu: 1431688884
| mem: 5121921})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1464202109
| mem: 5305223})
({cpu: 1464064109
| mem: 5304623})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 697243900
| mem: 2537875})
({cpu: 697105900
| mem: 2537275})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1018165066
| mem: 3756874})
({cpu: 1018027066
| mem: 3756274})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1440797563
| mem: 5288993})
({cpu: 1440659563
| mem: 5288393})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1448679659
| mem: 5039871})
({cpu: 1448403659
| mem: 5038671})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1889566449
| mem: 6853460})
({cpu: 1889014449
| mem: 6851060})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1425511870
| mem: 5268907})
({cpu: 1425373870
| mem: 5268307})
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 1272963610
| mem: 4680810})
({cpu: 1272687610
| mem: 4679610})
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11652
11648
4 changes: 1 addition & 3 deletions plutus-benchmark/nofib/test/9.2/queens4-bt.pir.golden
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,7 @@
(/\dead ->
Bool_match
(ds
(`Cons=`
var'
val')
ds
(`Cons=`
var
val))
Expand Down
2 changes: 1 addition & 1 deletion plutus-benchmark/nofib/test/9.2/queens4-bt.size.golden
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1860
1858
4 changes: 2 additions & 2 deletions plutus-benchmark/nofib/test/9.2/queens5-fc.eval.golden
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 282792904581
| mem: 1078786366})
({cpu: 282717464581
| mem: 1078458366})
4 changes: 1 addition & 3 deletions plutus-benchmark/nofib/test/9.2/queens5-fc.pir.golden
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,7 @@
(/\dead ->
Bool_match
(ds
(`Cons=`
var'
val')
ds
(`Cons=`
var
val))
Expand Down
2 changes: 1 addition & 1 deletion plutus-benchmark/nofib/test/9.2/queens5-fc.size.golden
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1860
1858
4 changes: 1 addition & 3 deletions plutus-benchmark/nofib/test/9.6/queens4-bt.pir.golden
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,7 @@
(/\dead ->
Bool_match
(ds
(`Cons=`
var'
val')
ds
(`Cons=`
var
val))
Expand Down
2 changes: 1 addition & 1 deletion plutus-benchmark/nofib/test/9.6/queens4-bt.size.golden
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1931
1929
4 changes: 2 additions & 2 deletions plutus-benchmark/nofib/test/9.6/queens5-fc.eval.golden
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
({cpu: 284790983581
| mem: 1087473666})
({cpu: 284715543581
| mem: 1087145666})
4 changes: 1 addition & 3 deletions plutus-benchmark/nofib/test/9.6/queens5-fc.pir.golden
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,7 @@
(/\dead ->
Bool_match
(ds
(`Cons=`
var'
val')
ds
(`Cons=`
var
val))
Expand Down
2 changes: 1 addition & 1 deletion plutus-benchmark/nofib/test/9.6/queens5-fc.size.golden
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1931
1929
4 changes: 2 additions & 2 deletions plutus-core/plutus-core.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -744,8 +744,8 @@ library plutus-core-testlib

-- This wraps up the use of the certifier library
-- so we can present a consistent inteface whether we
-- are building with it or not. If we aren't building
-- with it, we present a conservative stub implementation
-- are building with it or not. If we aren't building
-- with it, we present a conservative stub implementation
-- that just always says everything is fine.
library plutus-ir-cert
import: lang
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Changed

- Updated the Plutus Tx compiler to make the "Unsupported feature: Cannot case on a value on type"
error happen less often (if not eliminating it entirely).
1 change: 1 addition & 0 deletions plutus-tx-plugin/plutus-tx-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ library
, PyF >=0.11.1.0
, template-haskell
, text
, uniplate

if flag(use-ghc-stub)
build-depends: plutus-ghc-stub
Expand Down
Loading

0 comments on commit 98c5167

Please sign in to comment.