Wolfgang Jeltsch pushed to branch wip/jeltsch/textual-bytecode-output at Glasgow Haskell Compiler / GHC

Commits:

5 changed files:

Changes:

  • compiler/GHC/ByteCode/Show.hs
    ... ... @@ -198,7 +198,7 @@ pprLiteral current_module literal = case literal of
    198 198
         -> text "top-level string" <+>
    
    199 199
            text (show (unpackFS string))
    
    200 200
       BCONPtrFFIInfo ffiInfo
    
    201
    -    -> text "foreign function" <+>
    
    201
    +    -> text "foreign function of type" <+>
    
    202 202
            quotes (pprFFIInfo ffiInfo)
    
    203 203
       BCONPtrCostCentre breakpointID
    
    204 204
         -> text "cost center of breakpoint" <+>
    

  • testsuite/tests/show-bytecode/Example.hs
    ... ... @@ -4,6 +4,8 @@ module Example where
    4 4
     
    
    5 5
     import Numeric.Natural (Natural)
    
    6 6
     import GHC.StaticPtr (StaticPtr)
    
    7
    +import Foreign.C.Types (CChar, CSize (CSize))
    
    8
    +import Foreign.Ptr (Ptr)
    
    7 9
     
    
    8 10
     fibonaccis :: [Natural]
    
    9 11
     fibonaccis = 0 : positiveFibonaccis where
    
    ... ... @@ -29,3 +31,6 @@ primesPtr = static primes
    29 31
     data BinTree a b = Leaf a | Node (BinTree a b) b (BinTree a b)
    
    30 32
     
    
    31 33
     data PerfectTree a = PerfectTree a | Nested (PerfectTree (a, a))
    
    34
    +
    
    35
    +foreign import ccall "string.h strlen"
    
    36
    +    cstrlen :: Ptr CChar -> IO CSize

  • testsuite/tests/show-bytecode/show-bytecode-breakpoints.stdout
    ... ... @@ -56,7 +56,7 @@ objects:
    56 56
       static-construction object ‘static_ptr1_sat_@name_suffix@’:
    
    57 57
         data constructor: I#
    
    58 58
         lifted: yes
    
    59
    -    literals: word 27
    
    59
    +    literals: word 29
    
    60 60
         used items: <none>
    
    61 61
       static-construction object ‘static_ptr1_sat_@name_suffix@’:
    
    62 62
         data constructor: I#
    
    ... ... @@ -249,7 +249,7 @@ objects:
    249 249
       static-construction object ‘static_ptr_sat_@name_suffix@’:
    
    250 250
         data constructor: I#
    
    251 251
         lifted: yes
    
    252
    -    literals: word 15
    
    252
    +    literals: word 17
    
    253 253
         used items: <none>
    
    254 254
       static-construction object ‘static_ptr_sat_@name_suffix@’:
    
    255 255
         data constructor: I#
    
    ... ... @@ -327,6 +327,21 @@ objects:
    327 327
         used items:
    
    328 328
           named item ‘$tcNatural’
    
    329 329
           named item ‘mkTrCon’
    
    330
    +  object ‘cstrlen’:
    
    331
    +    arity: 2
    
    332
    +    literals: <none>
    
    333
    +    used items:
    
    334
    +      object ‘ds1_@name_suffix@’:
    
    335
    +        arity: 0
    
    336
    +        literals:
    
    337
    +          label ‘strlen’
    
    338
    +          word 0
    
    339
    +          foreign function of type ‘Pointer -> UInt64’
    
    340
    +        used items:
    
    341
    +          object ‘wild_@name_suffix@’:
    
    342
    +            arity: 0
    
    343
    +            literals: info table of ‘W64#’
    
    344
    +            used items: <none>
    
    330 345
       static-construction object ‘$tc'Nested’:
    
    331 346
         data constructor: TyCon
    
    332 347
         lifted: yes
    
    ... ... @@ -651,89 +666,89 @@ top-level strings:
    651 666
     breakpoints:
    
    652 667
       source breakpoints:
    
    653 668
         source breakpoint 0:
    
    654
    -      source span: Example.hs:18:17-25
    
    669
    +      source span: Example.hs:20:17-25
    
    655 670
           declaration path: divides
    
    656 671
           free variables:
    
    657 672
             k
    
    658 673
             n
    
    659 674
         source breakpoint 1:
    
    660
    -      source span: Example.hs:18:17-30
    
    675
    +      source span: Example.hs:20:17-30
    
    661 676
           declaration path: divides
    
    662 677
           free variables:
    
    663 678
             k
    
    664 679
             n
    
    665 680
         source breakpoint 2:
    
    666
    -      source span: Example.hs:24:27-37
    
    681
    +      source span: Example.hs:26:27-37
    
    667 682
           declaration path:
    
    668 683
             primes
    
    669 684
             isPrime
    
    670 685
           free variables: n
    
    671 686
         source breakpoint 3:
    
    672
    -      source span: Example.hs:24:53-56
    
    687
    +      source span: Example.hs:26:53-56
    
    673 688
           declaration path:
    
    674 689
             primes
    
    675 690
             isPrime
    
    676 691
           free variables: n
    
    677 692
         source breakpoint 4:
    
    678
    -      source span: Example.hs:24:62-64
    
    693
    +      source span: Example.hs:26:62-64
    
    679 694
           declaration path:
    
    680 695
             primes
    
    681 696
             isPrime
    
    682 697
           free variables: <none>
    
    683 698
         source breakpoint 5:
    
    684
    -      source span: Example.hs:24:52-65
    
    699
    +      source span: Example.hs:26:52-65
    
    685 700
           declaration path:
    
    686 701
             primes
    
    687 702
             isPrime
    
    688 703
           free variables: n
    
    689 704
         source breakpoint 6:
    
    690
    -      source span: Example.hs:24:41-73
    
    705
    +      source span: Example.hs:26:41-73
    
    691 706
           declaration path:
    
    692 707
             primes
    
    693 708
             isPrime
    
    694 709
           free variables: n
    
    695 710
         source breakpoint 7:
    
    696
    -      source span: Example.hs:24:22-74
    
    711
    +      source span: Example.hs:26:22-74
    
    697 712
           declaration path:
    
    698 713
             primes
    
    699 714
             isPrime
    
    700 715
           free variables: n
    
    701 716
         source breakpoint 8:
    
    702
    -      source span: Example.hs:24:17-75
    
    717
    +      source span: Example.hs:26:17-75
    
    703 718
           declaration path:
    
    704 719
             primes
    
    705 720
             isPrime
    
    706 721
           free variables: n
    
    707 722
         source breakpoint 9:
    
    708
    -      source span: Example.hs:21:14-34
    
    723
    +      source span: Example.hs:23:14-34
    
    709 724
           declaration path: primes
    
    710 725
           free variables: isPrime
    
    711 726
         source breakpoint 10:
    
    712
    -      source span: Example.hs:21:10-34
    
    727
    +      source span: Example.hs:23:10-34
    
    713 728
           declaration path: primes
    
    714 729
           free variables: isPrime
    
    715 730
         source breakpoint 11:
    
    716
    -      source span: Example.hs:27:13-25
    
    731
    +      source span: Example.hs:29:13-25
    
    717 732
           declaration path: primesPtr
    
    718 733
           free variables: <none>
    
    719 734
         source breakpoint 12:
    
    720
    -      source span: Example.hs:12:30-70
    
    735
    +      source span: Example.hs:14:30-70
    
    721 736
           declaration path:
    
    722 737
             fibonaccis
    
    723 738
             positiveFibonaccis
    
    724 739
           free variables: positiveFibonaccis
    
    725 740
         source breakpoint 13:
    
    726
    -      source span: Example.hs:12:26-70
    
    741
    +      source span: Example.hs:14:26-70
    
    727 742
           declaration path:
    
    728 743
             fibonaccis
    
    729 744
             positiveFibonaccis
    
    730 745
           free variables: positiveFibonaccis
    
    731 746
         source breakpoint 14:
    
    732
    -      source span: Example.hs:9:14-35
    
    747
    +      source span: Example.hs:11:14-35
    
    733 748
           declaration path: fibonaccis
    
    734 749
           free variables: positiveFibonaccis
    
    735 750
         source breakpoint 15:
    
    736
    -      source span: Example.hs:15:17-33
    
    751
    +      source span: Example.hs:17:17-33
    
    737 752
           declaration path: fibonaccisPtr
    
    738 753
           free variables: <none>
    
    739 754
       bytecode breakpoints:
    

  • testsuite/tests/show-bytecode/show-bytecode-hpc.stdout
    ... ... @@ -54,7 +54,7 @@ objects:
    54 54
       static-construction object ‘static_ptr1_sat_@name_suffix@’:
    
    55 55
         data constructor: I#
    
    56 56
         lifted: yes
    
    57
    -    literals: word 27
    
    57
    +    literals: word 29
    
    58 58
         used items: <none>
    
    59 59
       static-construction object ‘static_ptr1_sat_@name_suffix@’:
    
    60 60
         data constructor: I#
    
    ... ... @@ -248,7 +248,7 @@ objects:
    248 248
       static-construction object ‘static_ptr_sat_@name_suffix@’:
    
    249 249
         data constructor: I#
    
    250 250
         lifted: yes
    
    251
    -    literals: word 15
    
    251
    +    literals: word 17
    
    252 252
         used items: <none>
    
    253 253
       static-construction object ‘static_ptr_sat_@name_suffix@’:
    
    254 254
         data constructor: I#
    
    ... ... @@ -337,6 +337,21 @@ objects:
    337 337
         used items:
    
    338 338
           named item ‘$tcNatural’
    
    339 339
           named item ‘mkTrCon’
    
    340
    +  object ‘cstrlen’:
    
    341
    +    arity: 2
    
    342
    +    literals: <none>
    
    343
    +    used items:
    
    344
    +      object ‘ds1_@name_suffix@’:
    
    345
    +        arity: 0
    
    346
    +        literals:
    
    347
    +          label ‘strlen’
    
    348
    +          word 0
    
    349
    +          foreign function of type ‘Pointer -> UInt64’
    
    350
    +        used items:
    
    351
    +          object ‘wild_@name_suffix@’:
    
    352
    +            arity: 0
    
    353
    +            literals: info table of ‘W64#’
    
    354
    +            used items: <none>
    
    340 355
       static-construction object ‘$tc'Nested’:
    
    341 356
         data constructor: TyCon
    
    342 357
         lifted: yes
    

  • testsuite/tests/show-bytecode/show-bytecode-vanilla.stdout
    ... ... @@ -52,7 +52,7 @@ objects:
    52 52
       static-construction object ‘static_ptr1_sat_@name_suffix@’:
    
    53 53
         data constructor: I#
    
    54 54
         lifted: yes
    
    55
    -    literals: word 27
    
    55
    +    literals: word 29
    
    56 56
         used items: <none>
    
    57 57
       static-construction object ‘static_ptr1_sat_@name_suffix@’:
    
    58 58
         data constructor: I#
    
    ... ... @@ -200,7 +200,7 @@ objects:
    200 200
       static-construction object ‘static_ptr_sat_@name_suffix@’:
    
    201 201
         data constructor: I#
    
    202 202
         lifted: yes
    
    203
    -    literals: word 15
    
    203
    +    literals: word 17
    
    204 204
         used items: <none>
    
    205 205
       static-construction object ‘static_ptr_sat_@name_suffix@’:
    
    206 206
         data constructor: I#
    
    ... ... @@ -278,6 +278,21 @@ objects:
    278 278
         used items:
    
    279 279
           named item ‘$tcNatural’
    
    280 280
           named item ‘mkTrCon’
    
    281
    +  object ‘cstrlen’:
    
    282
    +    arity: 2
    
    283
    +    literals: <none>
    
    284
    +    used items:
    
    285
    +      object ‘ds1_@name_suffix@’:
    
    286
    +        arity: 0
    
    287
    +        literals:
    
    288
    +          label ‘strlen’
    
    289
    +          word 0
    
    290
    +          foreign function of type ‘Pointer -> UInt64’
    
    291
    +        used items:
    
    292
    +          object ‘wild_@name_suffix@’:
    
    293
    +            arity: 0
    
    294
    +            literals: info table of ‘W64#’
    
    295
    +            used items: <none>
    
    281 296
       static-construction object ‘$tc'Nested’:
    
    282 297
         data constructor: TyCon
    
    283 298
         lifted: yes