         Edinburgh IMP77 Compiler - Version 8.4-2024.12.18

     1  ! check that sizeof/typeof was giving the expected value
     2  %begin
 0000 C8 00 00 01                           ENTER 0000,1
     3    %routine test(%name param)         ;! ia1          ia2
 0004 EB 00                                 JMP L1001
 0006                      L1002  EQU $
 0006 C8 00 00 02                           ENTER 0000,2
     4      write(addr(param),0)  ; newline  ;! 2145833816   2145833816
 000A FF 75 08                              PUSH DWORD PTR [%EBP+8]
 000D 6A 00                                 PUSH #0
 000F E8 40 00                              CALL 'WRITE' (EXTERN 64)
 0012 83 C4 08                              ADD %ESP,#8
 0015 E8 43 00                              CALL 'NEWLINE' (EXTERN 67)
     5      write(sizeof(param),0); newline  ;! 1            8             1 is sizeof %byte, 8 is sizeof %longreal
 0018 FF 75 0C                              PUSH DWORD PTR [%EBP+12]
 001B FF 75 08                              PUSH DWORD PTR [%EBP+8]
 001E E8 11 00                              CALL 'SIZEOF' (EXTERN 17)
 0021 83 C4 08                              ADD %ESP,#8
 0024 50                                    PUSH %EAX
 0025 6A 00                                 PUSH #0
 0027 E8 40 00                              CALL 'WRITE' (EXTERN 64)
 002A 83 C4 08                              ADD %ESP,#8
 002D E8 43 00                              CALL 'NEWLINE' (EXTERN 67)
     6      write(typeof(param),0); newline  ;! 5            8             5 is typeof %byte, 8 is typeof %longreal
 0030 FF 75 0C                              PUSH DWORD PTR [%EBP+12]
 0033 FF 75 08                              PUSH DWORD PTR [%EBP+8]
 0036 E8 10 00                              CALL 'TYPEOF' (EXTERN 16)
 0039 83 C4 08                              ADD %ESP,#8
 003C 50                                    PUSH %EAX
 003D 6A 00                                 PUSH #0
 003F E8 40 00                              CALL 'WRITE' (EXTERN 64)
 0042 83 C4 08                              ADD %ESP,#8
 0045 E8 43 00                              CALL 'NEWLINE' (EXTERN 67)
     7    %end
 0048 C9                                    LEAVE
 0049 C3                                    RET
 004A                      L1001  EQU $
     8  
     9    %bytearray ia1(3:5)
 004A C7 45 EC 01 00 00 00                  MOV DWORD PTR [%EBP-20],#1
 0051 C7 45 F0 03 00 00 00                  MOV DWORD PTR [%EBP-16],#3
 0058 C7 45 F4 05 00 00 00                  MOV DWORD PTR [%EBP-12],#5
 005F C7 45 F8 2B 00 00 00                  MOV DWORD PTR [%EBP-8],#43
 0066 8D 45 EC                              LEA %EAX,[%EBP-20]
 0069 50                                    PUSH %EAX
 006A E8 0A 00                              CALL '_IMPADEF' (EXTERN 10)
 006D 83 C4 04                              ADD %ESP,#4
 0070 8D 4D EC                              LEA %ECX,[%EBP-20]
 0073 89 E3                                 MOV %EBX,%ESP
 0075 29 D3                                 SUB %EBX,%EDX
 0077 89 5D E4                              MOV [%EBP-28],%EBX
 007A 89 4D E8                              MOV [%EBP-24],%ECX
 007D 01 C3                                 ADD %EBX,%EAX
 007F 81 E3 FC FF FF FF                     AND %EBX,#-4
 0085 89 DC                                 MOV %ESP,%EBX
    10    %longrealarray ia2(2:4,3:6)
 0087 C7 45 CC 02 00 00 00                  MOV DWORD PTR [%EBP-52],#2
 008E C7 45 D0 02 00 00 00                  MOV DWORD PTR [%EBP-48],#2
 0095 C7 45 D4 04 00 00 00                  MOV DWORD PTR [%EBP-44],#4
 009C C7 45 D8 03 00 00 00                  MOV DWORD PTR [%EBP-40],#3
 00A3 C7 45 DC 06 00 00 00                  MOV DWORD PTR [%EBP-36],#6
 00AA C7 45 E0 11 01 00 00                  MOV DWORD PTR [%EBP-32],#273
 00B1 8D 45 CC                              LEA %EAX,[%EBP-52]
 00B4 50                                    PUSH %EAX
 00B5 E8 0A 00                              CALL '_IMPADEF' (EXTERN 10)
 00B8 83 C4 04                              ADD %ESP,#4
 00BB 8D 4D CC                              LEA %ECX,[%EBP-52]
 00BE 89 E3                                 MOV %EBX,%ESP
 00C0 29 D3                                 SUB %EBX,%EDX
 00C2 89 5D C4                              MOV [%EBP-60],%EBX
 00C5 89 4D C8                              MOV [%EBP-56],%ECX
 00C8 01 C3                                 ADD %EBX,%EAX
 00CA 89 DC                                 MOV %ESP,%EBX
    11  
    12    printstring( "Testing ia1"); newline
 00CC 81 EC 00 01 00 00                     SUB %ESP,#256
 00D2 89 E0                                 MOV %EAX,%ESP
 00D4 50                                    PUSH %EAX
 00D5 B8 00 00 00 00                        MOV %EAX,COT+#0
 00DA 50                                    PUSH %EAX
 00DB 68 FF 00 00 00                        PUSH #255
 00E0 E8 03 00                              CALL '_IMPSTRCPY' (EXTERN 3)
 00E3 83 C4 0C                              ADD %ESP,#12
 00E6 E8 3B 00                              CALL 'PRINTSTRING' (EXTERN 59)
 00E9 81 C4 00 01 00 00                     ADD %ESP,#256
 00EF E8 43 00                              CALL 'NEWLINE' (EXTERN 67)
    13    write(addr(ia1),0); newline     ;! 2145833816
 00F2 8D 44 04 24                           LEA %EAX,[%ESP+4]
 00F6 8D 4D E4                              LEA %ECX,[%EBP-28]
 00F9 89 CA                                 MOV %EDX,%ECX
 00FB 89 50 04                              MOV [%EAX+4],%EDX
 00FE 89 08                                 MOV [%EAX],%ECX
 0100 6A 00                                 PUSH #0
 0102 E8 40 00                              CALL 'WRITE' (EXTERN 64)
 0105 83 C4 08                              ADD %ESP,#8
 0108 E8 43 00                              CALL 'NEWLINE' (EXTERN 67)
    14    write(addr(ia1(3)),0); newline  ;! 2145833704
 010B 6A 03                                 PUSH #3
 010D FF 75 E8                              PUSH DWORD PTR [%EBP-24]
 0110 E8 09 00                              CALL '_IMPAREF' (EXTERN 9)
 0113 83 C4 08                              ADD %ESP,#8
 0116 89 C6                                 MOV %ESI,%EAX
 0118 03 75 E4                              ADD %ESI,[%EBP-28]
 011B 31 C0                                 XOR %EAX,%EAX
 011D 8A 06                                 MOV %AL,[%ESI]
 011F 25 FF 00 00 00                        AND %EAX,#255
    15    write(sizeof(ia1),0); newline   ;! 1                sizeof %btre
    16    write(typeof(ia1),0); newline   ;! 5                typeof %byte
    17    test(ia1)
    18  
    19    printstring( "Testing ia2"); newline
    20    write(addr(ia2),0); newline      ;! 2145833816
    21    write(addr(ia2(2,3)),0); newline ;! 2145833708      4 bytes after address of first element of ia1, i.e. ia1(3)
    22                                      !                 which is 3 %byteinteger elements of 1 byte each, aligned to next 4 bytes.
    23    write(sizeof(ia2),0); newline    ;! 8               sizeof %longreal
    24    write(typeof(ia2),0); newline    ;! 8               typeof %longreal
    25    test(ia2)
    26  
    27  %endofprogram

    34 Statements compiled



 ELF object file generated from IMP source file: '/home/gtoal/src/compilers101/new-parser/imps/tests/gtoal003.imp'
 +----------+---------------------+---------+---------+---------+------------+
 | Sections |       Symbols       | Code    | Data    | Diag    | Total size |
 +----------+----------+----------+---------+---------+---------+------------+
 |  (count) | Internal | External | (bytes) | (bytes) | (bytes) | (bytes)    |
 +----------+----------+----------+---------+---------+---------+------------+
 |       11 |        5 |       14 |     324 |       0 |      64 |        388 |
 +----------+----------+----------+---------+---------+---------+------------+


