Skip to content

Commit b09c05e

Browse files
b-studiosphischu
andauthored
Move direct style transformation from machine to core (#830)
Do not use old transformation --------- Co-authored-by: Philipp Schuster <[email protected]>
1 parent 18dae1a commit b09c05e

File tree

14 files changed

+607
-251
lines changed

14 files changed

+607
-251
lines changed

effekt/jvm/src/test/scala/effekt/core/VMTests.scala

Lines changed: 75 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,12 @@ class VMTests extends munit.FunSuite {
237237

238238
val are_we_fast_yet: Seq[(File, Option[Summary])] = Seq(
239239
examplesDir / "benchmarks" / "are_we_fast_yet" / "bounce.effekt" -> Some(Summary(
240-
staticDispatches = 5202,
240+
staticDispatches = 20202,
241241
dynamicDispatches = 5000,
242242
patternMatches = 0,
243243
branches = 31628,
244-
pushedFrames = 31479,
245-
poppedFrames = 31479,
244+
pushedFrames = 5052,
245+
poppedFrames = 5052,
246246
allocations = 0,
247247
closures = 100,
248248
variableReads = 7132,
@@ -269,12 +269,12 @@ class VMTests extends munit.FunSuite {
269269
)),
270270

271271
examplesDir / "benchmarks" / "are_we_fast_yet" / "mandelbrot.effekt" -> Some(Summary(
272-
staticDispatches = 11,
272+
staticDispatches = 18,
273273
dynamicDispatches = 0,
274274
patternMatches = 0,
275275
branches = 26,
276-
pushedFrames = 18,
277-
poppedFrames = 18,
276+
pushedFrames = 3,
277+
poppedFrames = 3,
278278
allocations = 0,
279279
closures = 0,
280280
variableReads = 70,
@@ -289,8 +289,8 @@ class VMTests extends munit.FunSuite {
289289
dynamicDispatches = 0,
290290
patternMatches = 455,
291291
branches = 56,
292-
pushedFrames = 17,
293-
poppedFrames = 17,
292+
pushedFrames = 15,
293+
poppedFrames = 15,
294294
allocations = 31,
295295
closures = 0,
296296
variableReads = 34,
@@ -301,12 +301,12 @@ class VMTests extends munit.FunSuite {
301301
)),
302302

303303
examplesDir / "benchmarks" / "are_we_fast_yet" / "queens.effekt" -> Some(Summary(
304-
staticDispatches = 1146,
304+
staticDispatches = 2898,
305305
dynamicDispatches = 0,
306306
patternMatches = 0,
307307
branches = 3887,
308-
pushedFrames = 3084,
309-
poppedFrames = 3060,
308+
pushedFrames = 455,
309+
poppedFrames = 439,
310310
allocations = 0,
311311
closures = 0,
312312
variableReads = 0,
@@ -321,8 +321,8 @@ class VMTests extends munit.FunSuite {
321321
dynamicDispatches = 0,
322322
patternMatches = 0,
323323
branches = 26736,
324-
pushedFrames = 5001,
325-
poppedFrames = 5001,
324+
pushedFrames = 5000,
325+
poppedFrames = 5000,
326326
allocations = 0,
327327
closures = 0,
328328
variableReads = 34546,
@@ -333,12 +333,12 @@ class VMTests extends munit.FunSuite {
333333
)),
334334

335335
examplesDir / "benchmarks" / "are_we_fast_yet" / "towers.effekt" -> Some(Summary(
336-
staticDispatches = 16401,
336+
staticDispatches = 24606,
337337
dynamicDispatches = 0,
338338
patternMatches = 16396,
339339
branches = 16287,
340-
pushedFrames = 24590,
341-
poppedFrames = 24590,
340+
pushedFrames = 8193,
341+
poppedFrames = 8193,
342342
allocations = 8206,
343343
closures = 0,
344344
variableReads = 41027,
@@ -369,8 +369,8 @@ class VMTests extends munit.FunSuite {
369369
dynamicDispatches = 0,
370370
patternMatches = 0,
371371
branches = 5463,
372-
pushedFrames = 5463,
373-
poppedFrames = 5463,
372+
pushedFrames = 5462,
373+
poppedFrames = 5462,
374374
allocations = 5461,
375375
closures = 0,
376376
variableReads = 13654,
@@ -467,8 +467,8 @@ class VMTests extends munit.FunSuite {
467467
dynamicDispatches = 0,
468468
patternMatches = 6,
469469
branches = 6,
470-
pushedFrames = 7,
471-
poppedFrames = 7,
470+
pushedFrames = 6,
471+
poppedFrames = 6,
472472
allocations = 6,
473473
closures = 0,
474474
variableReads = 0,
@@ -517,8 +517,8 @@ class VMTests extends munit.FunSuite {
517517
dynamicDispatches = 0,
518518
patternMatches = 0,
519519
branches = 7,
520-
pushedFrames = 2,
521-
poppedFrames = 2,
520+
pushedFrames = 1,
521+
poppedFrames = 1,
522522
allocations = 0,
523523
closures = 0,
524524
variableReads = 7,
@@ -532,9 +532,9 @@ class VMTests extends munit.FunSuite {
532532
staticDispatches = 626,
533533
dynamicDispatches = 0,
534534
patternMatches = 400,
535-
branches = 1487,
536-
pushedFrames = 1185,
537-
poppedFrames = 1409,
535+
branches = 1282,
536+
pushedFrames = 491,
537+
poppedFrames = 715,
538538
allocations = 54,
539539
closures = 0,
540540
variableReads = 0,
@@ -549,8 +549,8 @@ class VMTests extends munit.FunSuite {
549549
dynamicDispatches = 0,
550550
patternMatches = 0,
551551
branches = 210,
552-
pushedFrames = 69,
553-
poppedFrames = 68,
552+
pushedFrames = 68,
553+
poppedFrames = 67,
554554
allocations = 0,
555555
closures = 0,
556556
variableReads = 222,
@@ -581,8 +581,8 @@ class VMTests extends munit.FunSuite {
581581
dynamicDispatches = 0,
582582
patternMatches = 0,
583583
branches = 12001,
584-
pushedFrames = 16001,
585-
poppedFrames = 16001,
584+
pushedFrames = 11001,
585+
poppedFrames = 11001,
586586
allocations = 0,
587587
closures = 0,
588588
variableReads = 0,
@@ -593,16 +593,16 @@ class VMTests extends munit.FunSuite {
593593
)),
594594

595595
examplesDir / "benchmarks" / "effect_handlers_bench" / "tree_explore.effekt" -> Some(Summary(
596-
staticDispatches = 3187,
596+
staticDispatches = 3317,
597597
dynamicDispatches = 0,
598-
patternMatches = 3490,
598+
patternMatches = 2380,
599599
branches = 3167,
600-
pushedFrames = 5357,
601-
poppedFrames = 6957,
602-
allocations = 2556,
600+
pushedFrames = 2697,
601+
poppedFrames = 4297,
602+
allocations = 1446,
603603
closures = 0,
604-
variableReads = 2051,
605-
variableWrites = 1430,
604+
variableReads = 941,
605+
variableWrites = 630,
606606
resets = 10,
607607
shifts = 310,
608608
resumes = 620
@@ -630,9 +630,9 @@ class VMTests extends munit.FunSuite {
630630
staticDispatches = 19,
631631
dynamicDispatches = 335,
632632
patternMatches = 706,
633-
branches = 285,
634-
pushedFrames = 453,
635-
poppedFrames = 453,
633+
branches = 247,
634+
pushedFrames = 372,
635+
poppedFrames = 372,
636636
allocations = 174,
637637
closures = 39,
638638
variableReads = 0,
@@ -661,11 +661,11 @@ class VMTests extends munit.FunSuite {
661661
examplesDir / "casestudies" / "scheduler.effekt.md" -> Some(Summary(
662662
staticDispatches = 60,
663663
dynamicDispatches = 7,
664-
patternMatches = 95,
664+
patternMatches = 80,
665665
branches = 41,
666-
pushedFrames = 74,
667-
poppedFrames = 75,
668-
allocations = 73,
666+
pushedFrames = 56,
667+
poppedFrames = 57,
668+
allocations = 58,
669669
closures = 7,
670670
variableReads = 29,
671671
variableWrites = 18,
@@ -675,13 +675,13 @@ class VMTests extends munit.FunSuite {
675675
)),
676676

677677
examplesDir / "casestudies" / "lexer.effekt.md" -> Some(Summary(
678-
staticDispatches = 245,
678+
staticDispatches = 343,
679679
dynamicDispatches = 18,
680-
patternMatches = 298,
680+
patternMatches = 205,
681681
branches = 405,
682-
pushedFrames = 520,
683-
poppedFrames = 520,
684-
allocations = 202,
682+
pushedFrames = 194,
683+
poppedFrames = 194,
684+
allocations = 109,
685685
closures = 27,
686686
variableReads = 164,
687687
variableWrites = 51,
@@ -691,13 +691,13 @@ class VMTests extends munit.FunSuite {
691691
)),
692692

693693
examplesDir / "casestudies" / "parser.effekt.md" -> Some(Summary(
694-
staticDispatches = 8845,
694+
staticDispatches = 12887,
695695
dynamicDispatches = 783,
696-
patternMatches = 13502,
697-
branches = 14892,
698-
pushedFrames = 20836,
699-
poppedFrames = 20812,
700-
allocations = 7923,
696+
patternMatches = 9464,
697+
branches = 14696,
698+
pushedFrames = 7598,
699+
poppedFrames = 7574,
700+
allocations = 3885,
701701
closures = 521,
702702
variableReads = 6742,
703703
variableWrites = 1901,
@@ -707,13 +707,13 @@ class VMTests extends munit.FunSuite {
707707
)),
708708

709709
examplesDir / "casestudies" / "anf.effekt.md" -> Some(Summary(
710-
staticDispatches = 4775,
710+
staticDispatches = 6925,
711711
dynamicDispatches = 443,
712-
patternMatches = 7272,
713-
branches = 8110,
714-
pushedFrames = 11348,
715-
poppedFrames = 11335,
716-
allocations = 4317,
712+
patternMatches = 5128,
713+
branches = 8018,
714+
pushedFrames = 4310,
715+
poppedFrames = 4297,
716+
allocations = 2173,
717717
closures = 358,
718718
variableReads = 4080,
719719
variableWrites = 1343,
@@ -723,13 +723,13 @@ class VMTests extends munit.FunSuite {
723723
)),
724724

725725
examplesDir / "casestudies" / "inference.effekt.md" -> Some(Summary(
726-
staticDispatches = 1457444,
726+
staticDispatches = 1457454,
727727
dynamicDispatches = 3201452,
728-
patternMatches = 1474290,
728+
patternMatches = 1474254,
729729
branches = 303298,
730-
pushedFrames = 3212277,
731-
poppedFrames = 2346982,
732-
allocations = 4626007,
730+
pushedFrames = 2914407,
731+
poppedFrames = 2049112,
732+
allocations = 4625971,
733733
closures = 865541,
734734
variableReads = 2908620,
735735
variableWrites = 1453663,
@@ -739,13 +739,13 @@ class VMTests extends munit.FunSuite {
739739
)),
740740

741741
examplesDir / "pos" / "raytracer.effekt" -> Some(Summary(
742-
staticDispatches = 79696,
742+
staticDispatches = 91784,
743743
dynamicDispatches = 0,
744-
patternMatches = 795964,
745-
branches = 71995,
746-
pushedFrames = 127131,
747-
poppedFrames = 127131,
748-
allocations = 103221,
744+
patternMatches = 771652,
745+
branches = 65951,
746+
pushedFrames = 51235,
747+
poppedFrames = 51235,
748+
allocations = 78909,
749749
closures = 0,
750750
variableReads = 77886,
751751
variableWrites = 26904,
@@ -761,8 +761,8 @@ class VMTests extends munit.FunSuite {
761761
dynamicDispatches = 0,
762762
patternMatches = 0,
763763
branches = 11,
764-
pushedFrames = 2,
765-
poppedFrames = 2,
764+
pushedFrames = 1,
765+
poppedFrames = 1,
766766
allocations = 0,
767767
closures = 0,
768768
variableReads = 61,
@@ -793,8 +793,8 @@ class VMTests extends munit.FunSuite {
793793
dynamicDispatches = 9009,
794794
patternMatches = 30052,
795795
branches = 3003,
796-
pushedFrames = 15027,
797-
poppedFrames = 15027,
796+
pushedFrames = 12024,
797+
poppedFrames = 12024,
798798
allocations = 24060,
799799
closures = 12030,
800800
variableReads = 24048,

effekt/shared/src/main/scala/effekt/Compiler.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,7 @@ trait Compiler[Executable] {
305305
case CoreTransformed(source, tree, mod, core) =>
306306
val main = Context.checkMain(mod)
307307
val program = machine.Transformer.transform(main, core)
308-
val direct = machine.DirectStyle.rewrite(program)
309-
(mod, main, direct)
308+
(mod, main, program)
310309
}
311310

312311
// Helpers

0 commit comments

Comments
 (0)