7267 - mu.subx: type-check 'convert' statements

This commit is contained in:
Kartik Agaram 2020-11-20 00:20:58 -08:00
parent 729800593a
commit fd4d7b38da
4 changed files with 22924 additions and 21700 deletions

BIN
apps/mu

Binary file not shown.

View File

@ -14165,6 +14165,439 @@ test-populate-stream-deref-address:
5d/pop-to-ebp
c3/return
test-convert-with-no-inout:
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
# setup
(clear-stream _test-input-stream)
(clear-stream $_test-input-buffered-file->buffer)
(clear-stream _test-output-stream)
(clear-stream $_test-output-buffered-file->buffer)
(clear-stream _test-error-stream)
(clear-stream $_test-error-buffered-file->buffer)
# var ed/edx: exit-descriptor = tailor-exit-descriptor(16)
68/push 0/imm32
68/push 0/imm32
89/<- %edx 4/r32/esp
(tailor-exit-descriptor %edx 0x10)
#
(write _test-input-stream "fn foo {\n")
(write _test-input-stream " var x/eax: int <- convert\n")
(write _test-input-stream "}\n")
# convert
(convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx)
# registers except esp clobbered at this point
# restore ed
89/<- %edx 4/r32/esp
(flush _test-output-buffered-file)
(flush _test-error-buffered-file)
#? # dump _test-error-stream {{{
#? (write 2 "^")
#? (write-stream 2 _test-error-stream)
#? (write 2 "$\n")
#? (rewind-stream _test-error-stream)
#? # }}}
# check output
(check-stream-equal _test-output-stream "" "F - test-convert-with-no-inout: output should be empty")
(check-next-stream-line-equal _test-error-stream "fn foo: stmt 'convert' expects an inout" "F - test-convert-with-no-inout: error message")
# check that stop(1) was called
(check-ints-equal *(edx+4) 2 "F - test-convert-with-no-inout: exit status")
# don't restore from ebp
81 0/subop/add %esp 8/imm32
# . epilogue
5d/pop-to-ebp
c3/return
test-convert-with-multiple-inouts:
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
# setup
(clear-stream _test-input-stream)
(clear-stream $_test-input-buffered-file->buffer)
(clear-stream _test-output-stream)
(clear-stream $_test-output-buffered-file->buffer)
(clear-stream _test-error-stream)
(clear-stream $_test-error-buffered-file->buffer)
# var ed/edx: exit-descriptor = tailor-exit-descriptor(16)
68/push 0/imm32
68/push 0/imm32
89/<- %edx 4/r32/esp
(tailor-exit-descriptor %edx 0x10)
#
(write _test-input-stream "fn foo {\n")
(write _test-input-stream " var x/eax: int <- convert 0, 0\n")
(write _test-input-stream "}\n")
# convert
(convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx)
# registers except esp clobbered at this point
# restore ed
89/<- %edx 4/r32/esp
(flush _test-output-buffered-file)
(flush _test-error-buffered-file)
#? # dump _test-error-stream {{{
#? (write 2 "^")
#? (write-stream 2 _test-error-stream)
#? (write 2 "$\n")
#? (rewind-stream _test-error-stream)
#? # }}}
# check output
(check-stream-equal _test-output-stream "" "F - test-convert-with-multiple-inouts: output should be empty")
(check-next-stream-line-equal _test-error-stream "fn foo: stmt 'convert' must have just one inout" "F - test-convert-with-multiple-inouts: error message")
# check that stop(1) was called
(check-ints-equal *(edx+4) 2 "F - test-convert-with-multiple-inouts: exit status")
# don't restore from ebp
81 0/subop/add %esp 8/imm32
# . epilogue
5d/pop-to-ebp
c3/return
test-convert-with-no-output:
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
# setup
(clear-stream _test-input-stream)
(clear-stream $_test-input-buffered-file->buffer)
(clear-stream _test-output-stream)
(clear-stream $_test-output-buffered-file->buffer)
(clear-stream _test-error-stream)
(clear-stream $_test-error-buffered-file->buffer)
# var ed/edx: exit-descriptor = tailor-exit-descriptor(16)
68/push 0/imm32
68/push 0/imm32
89/<- %edx 4/r32/esp
(tailor-exit-descriptor %edx 0x10)
#
(write _test-input-stream "fn foo {\n")
(write _test-input-stream " convert 0\n")
(write _test-input-stream "}\n")
# convert
(convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx)
# registers except esp clobbered at this point
# restore ed
89/<- %edx 4/r32/esp
(flush _test-output-buffered-file)
(flush _test-error-buffered-file)
#? # dump _test-error-stream {{{
#? (write 2 "^")
#? (write-stream 2 _test-error-stream)
#? (write 2 "$\n")
#? (rewind-stream _test-error-stream)
#? # }}}
# check output
(check-stream-equal _test-output-stream "" "F - test-convert-with-no-output: output should be empty")
(check-next-stream-line-equal _test-error-stream "fn foo: stmt 'convert' expects an output" "F - test-convert-with-no-output: error message")
# check that stop(1) was called
(check-ints-equal *(edx+4) 2 "F - test-convert-with-no-output: exit status")
# don't restore from ebp
81 0/subop/add %esp 8/imm32
# . epilogue
5d/pop-to-ebp
c3/return
test-convert-with-multiple-outputs:
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
# setup
(clear-stream _test-input-stream)
(clear-stream $_test-input-buffered-file->buffer)
(clear-stream _test-output-stream)
(clear-stream $_test-output-buffered-file->buffer)
(clear-stream _test-error-stream)
(clear-stream $_test-error-buffered-file->buffer)
# var ed/edx: exit-descriptor = tailor-exit-descriptor(16)
68/push 0/imm32
68/push 0/imm32
89/<- %edx 4/r32/esp
(tailor-exit-descriptor %edx 0x10)
#
(write _test-input-stream "fn foo {\n")
(write _test-input-stream " var x/eax: int <- copy 0\n")
(write _test-input-stream " var y/ecx: int <- copy 0\n")
(write _test-input-stream " x, y <- convert 0\n")
(write _test-input-stream "}\n")
# convert
(convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx)
# registers except esp clobbered at this point
# restore ed
89/<- %edx 4/r32/esp
(flush _test-output-buffered-file)
(flush _test-error-buffered-file)
#? # dump _test-error-stream {{{
#? (write 2 "^")
#? (write-stream 2 _test-error-stream)
#? (write 2 "$\n")
#? (rewind-stream _test-error-stream)
#? # }}}
# check output
(check-stream-equal _test-output-stream "" "F - test-convert-with-multiple-outputs: output should be empty")
(check-next-stream-line-equal _test-error-stream "fn foo: stmt 'convert' must have just one output" "F - test-convert-with-multiple-outputs: error message")
# check that stop(1) was called
(check-ints-equal *(edx+4) 2 "F - test-convert-with-multiple-outputs: exit status")
# don't restore from ebp
81 0/subop/add %esp 8/imm32
# . epilogue
5d/pop-to-ebp
c3/return
test-convert-deref-address:
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
# setup
(clear-stream _test-input-stream)
(clear-stream $_test-input-buffered-file->buffer)
(clear-stream _test-output-stream)
(clear-stream $_test-output-buffered-file->buffer)
#
(write _test-input-stream "fn foo {\n")
(write _test-input-stream " var x/eax: (addr int) <- copy 0\n")
(write _test-input-stream " var y/xmm4: float <- convert *x\n")
(write _test-input-stream "}\n")
# convert
(convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0)
(flush _test-output-buffered-file)
#? # dump _test-error-stream {{{
#? (write 2 "^")
#? (write-stream 2 _test-error-stream)
#? (write 2 "$\n")
#? (rewind-stream _test-error-stream)
#? # }}}
# not bothering checking output
(check-next-stream-line-equal _test-error-stream "" "F - test-convert-deref-address: error message")
# . epilogue
5d/pop-to-ebp
c3/return
test-convert-to-non-register:
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
# setup
(clear-stream _test-input-stream)
(clear-stream $_test-input-buffered-file->buffer)
(clear-stream _test-output-stream)
(clear-stream $_test-output-buffered-file->buffer)
(clear-stream _test-error-stream)
(clear-stream $_test-error-buffered-file->buffer)
# var ed/edx: exit-descriptor = tailor-exit-descriptor(16)
68/push 0/imm32
68/push 0/imm32
89/<- %edx 4/r32/esp
(tailor-exit-descriptor %edx 0x10)
#
(write _test-input-stream "fn foo {\n")
(write _test-input-stream " var x: float\n")
(write _test-input-stream " var y: int\n")
(write _test-input-stream " x <- convert y\n")
(write _test-input-stream "}\n")
# convert
(convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx)
# registers except esp clobbered at this point
# restore ed
89/<- %edx 4/r32/esp
(flush _test-output-buffered-file)
(flush _test-error-buffered-file)
#? # dump _test-error-stream {{{
#? (write 2 "^")
#? (write-stream 2 _test-error-stream)
#? (write 2 "$\n")
#? (rewind-stream _test-error-stream)
#? # }}}
# check output
(check-stream-equal _test-output-stream "" "F - test-convert-to-non-register: output should be empty")
(check-next-stream-line-equal _test-error-stream "fn foo: stmt convert: output 'x' not in a register" "F - test-convert-to-non-register: error message")
# check that stop(1) was called
(check-ints-equal *(edx+4) 2 "F - test-convert-to-non-register: exit status")
# don't restore from ebp
81 0/subop/add %esp 8/imm32
# . epilogue
5d/pop-to-ebp
c3/return
test-convert-invalid-inout-type:
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
# setup
(clear-stream _test-input-stream)
(clear-stream $_test-input-buffered-file->buffer)
(clear-stream _test-output-stream)
(clear-stream $_test-output-buffered-file->buffer)
(clear-stream _test-error-stream)
(clear-stream $_test-error-buffered-file->buffer)
# var ed/edx: exit-descriptor = tailor-exit-descriptor(16)
68/push 0/imm32
68/push 0/imm32
89/<- %edx 4/r32/esp
(tailor-exit-descriptor %edx 0x10)
#
(write _test-input-stream "fn foo {\n")
(write _test-input-stream " var x: boolean\n")
(write _test-input-stream " var y/xmm1: float <- convert x\n")
(write _test-input-stream "}\n")
# convert
(convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx)
# registers except esp clobbered at this point
# restore ed
89/<- %edx 4/r32/esp
(flush _test-output-buffered-file)
(flush _test-error-buffered-file)
#? # dump _test-error-stream {{{
#? (write 2 "^")
#? (write-stream 2 _test-error-stream)
#? (write 2 "$\n")
#? (rewind-stream _test-error-stream)
#? # }}}
# check output
(check-stream-equal _test-output-stream "" "F - test-convert-invalid-inout-type: output should be empty")
(check-next-stream-line-equal _test-error-stream "fn foo: stmt convert: inout 'x' must be an int or float" "F - test-convert-invalid-inout-type: error message")
# check that stop(1) was called
(check-ints-equal *(edx+4) 2 "F - test-convert-invalid-inout-type: exit status")
# don't restore from ebp
81 0/subop/add %esp 8/imm32
# . epilogue
5d/pop-to-ebp
c3/return
test-convert-invalid-output-type:
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
# setup
(clear-stream _test-input-stream)
(clear-stream $_test-input-buffered-file->buffer)
(clear-stream _test-output-stream)
(clear-stream $_test-output-buffered-file->buffer)
(clear-stream _test-error-stream)
(clear-stream $_test-error-buffered-file->buffer)
# var ed/edx: exit-descriptor = tailor-exit-descriptor(16)
68/push 0/imm32
68/push 0/imm32
89/<- %edx 4/r32/esp
(tailor-exit-descriptor %edx 0x10)
#
(write _test-input-stream "fn foo {\n")
(write _test-input-stream " var x: float\n")
(write _test-input-stream " var y/eax: boolean <- convert x\n")
(write _test-input-stream "}\n")
# convert
(convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx)
# registers except esp clobbered at this point
# restore ed
89/<- %edx 4/r32/esp
(flush _test-output-buffered-file)
(flush _test-error-buffered-file)
#? # dump _test-error-stream {{{
#? (write 2 "^")
#? (write-stream 2 _test-error-stream)
#? (write 2 "$\n")
#? (rewind-stream _test-error-stream)
#? # }}}
# check output
(check-stream-equal _test-output-stream "" "F - test-convert-invalid-output-type: output should be empty")
(check-next-stream-line-equal _test-error-stream "fn foo: stmt convert: output 'y' must be an int or float" "F - test-convert-invalid-output-type: error message")
# check that stop(1) was called
(check-ints-equal *(edx+4) 2 "F - test-convert-invalid-output-type: exit status")
# don't restore from ebp
81 0/subop/add %esp 8/imm32
# . epilogue
5d/pop-to-ebp
c3/return
test-convert-int-to-int:
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
# setup
(clear-stream _test-input-stream)
(clear-stream $_test-input-buffered-file->buffer)
(clear-stream _test-output-stream)
(clear-stream $_test-output-buffered-file->buffer)
(clear-stream _test-error-stream)
(clear-stream $_test-error-buffered-file->buffer)
# var ed/edx: exit-descriptor = tailor-exit-descriptor(16)
68/push 0/imm32
68/push 0/imm32
89/<- %edx 4/r32/esp
(tailor-exit-descriptor %edx 0x10)
#
(write _test-input-stream "fn foo {\n")
(write _test-input-stream " var x: int\n")
(write _test-input-stream " var y/eax: int <- convert x\n")
(write _test-input-stream "}\n")
# convert
(convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx)
# registers except esp clobbered at this point
# restore ed
89/<- %edx 4/r32/esp
(flush _test-output-buffered-file)
(flush _test-error-buffered-file)
#? # dump _test-error-stream {{{
#? (write 2 "^")
#? (write-stream 2 _test-error-stream)
#? (write 2 "$\n")
#? (rewind-stream _test-error-stream)
#? # }}}
# check output
(check-stream-equal _test-output-stream "" "F - test-convert-int-to-int: output should be empty")
(check-next-stream-line-equal _test-error-stream "fn foo: stmt convert: no need to convert int to int" "F - test-convert-int-to-int: error message")
# check that stop(1) was called
(check-ints-equal *(edx+4) 2 "F - test-convert-int-to-int: exit status")
# don't restore from ebp
81 0/subop/add %esp 8/imm32
# . epilogue
5d/pop-to-ebp
c3/return
test-convert-float-to-float:
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
# setup
(clear-stream _test-input-stream)
(clear-stream $_test-input-buffered-file->buffer)
(clear-stream _test-output-stream)
(clear-stream $_test-output-buffered-file->buffer)
(clear-stream _test-error-stream)
(clear-stream $_test-error-buffered-file->buffer)
# var ed/edx: exit-descriptor = tailor-exit-descriptor(16)
68/push 0/imm32
68/push 0/imm32
89/<- %edx 4/r32/esp
(tailor-exit-descriptor %edx 0x10)
#
(write _test-input-stream "fn foo {\n")
(write _test-input-stream " var x: float\n")
(write _test-input-stream " var y/xmm6: float <- convert x\n")
(write _test-input-stream "}\n")
# convert
(convert-mu _test-input-buffered-file _test-output-buffered-file _test-error-buffered-file %edx)
# registers except esp clobbered at this point
# restore ed
89/<- %edx 4/r32/esp
(flush _test-output-buffered-file)
(flush _test-error-buffered-file)
#? # dump _test-error-stream {{{
#? (write 2 "^")
#? (write-stream 2 _test-error-stream)
#? (write 2 "$\n")
#? (rewind-stream _test-error-stream)
#? # }}}
# check output
(check-stream-equal _test-output-stream "" "F - test-convert-float-to-float: output should be empty")
(check-next-stream-line-equal _test-error-stream "fn foo: stmt convert: no need to convert float to float" "F - test-convert-float-to-float: error message")
# check that stop(1) was called
(check-ints-equal *(edx+4) 2 "F - test-convert-float-to-float: exit status")
# don't restore from ebp
81 0/subop/add %esp 8/imm32
# . epilogue
5d/pop-to-ebp
c3/return
#######################################################
# Parsing
#######################################################
@ -23914,13 +24347,217 @@ check-mu-convert-stmt: # stmt: (addr stmt), fn: (addr function), err: (addr buf
55/push-ebp
89/<- %ebp 4/r32/esp
# . save registers
50/push-eax
51/push-ecx
52/push-edx
56/push-esi
57/push-edi
$check-mu-convert-stmt:get-output:
# esi = stmt
8b/-> *(ebp+8) 6/r32/esi
# var output/edi: (addr stmt-var) = stmt->outputs
(lookup *(esi+0x14) *(esi+0x18)) # Stmt1-outputs Stmt1-outputs => eax
89/<- %edi 0/r32/eax
# zero outputs
3d/compare-eax-and 0/imm32
0f 84/jump-if-= $check-mu-convert-stmt:error-no-output/disp32
# > 1 output
(lookup *(edi+8) *(edi+0xc)) # Stmt-var-next Stmt-var-next => eax
3d/compare-eax-and 0/imm32
0f 85/jump-if-!= $check-mu-convert-stmt:error-too-many-outputs/disp32
$check-mu-convert-stmt:get-inout:
# var inout/esi: (addr stmt-var) = stmt->inouts
(lookup *(esi+0xc) *(esi+0x10)) # Stmt1-inouts Stmt1-inouts => eax
89/<- %esi 0/r32/eax
# zero inouts
3d/compare-eax-and 0/imm32
0f 84/jump-if-= $check-mu-convert-stmt:error-no-inout/disp32
# > 1 inout
(lookup *(esi+8) *(esi+0xc)) # Stmt-var-next Stmt-var-next => eax
3d/compare-eax-and 0/imm32
0f 85/jump-if-!= $check-mu-convert-stmt:error-too-many-inouts/disp32
$check-mu-convert-stmt:types:
# var inout-type/ecx: (addr type-tree) = inout->value->type
(lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax
(lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax
89/<- %ecx 0/r32/eax
# if (inout->is-deref?) inout-type = inout-type->payload
8b/-> *(esi+0x10) 0/r32/eax # Stmt-var-is-deref
3d/compare-eax-and 0/imm32/false
{
74/jump-if-= break/disp8
(lookup *(ecx+0xc) *(ecx+0x10)) # Type-tree-right Type-tree-right => eax
# if inout-type->right is null, t = inout-type->left
81 7/subop/compare *(eax+0xc) 0/imm32 # Type-tree-right
{
75/jump-if-!= break/disp8
(lookup *(eax+4) *(eax+8)) # Type-tree-left Type-tree-left => eax
}
89/<- %ecx 0/r32/eax
}
# if input is not int or float, abort
{
(is-simple-mu-type? %ecx 1) # int => eax
3d/compare-eax-and 0/imm32/false
75/jump-if-!= break/disp8
(is-simple-mu-type? %ecx 0xf) # float => eax
3d/compare-eax-and 0/imm32/false
75/jump-if-!= break/disp8
e9/jump $check-mu-convert-stmt:error-invalid-inout-type/disp32
}
# if output not in register, abort
(lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax
(lookup *(eax+0x18) *(eax+0x1c)) # Var-register Var-register => eax
3d/compare-eax-and 0/imm32
0f 84/jump-if-= $check-mu-convert-stmt:error-output-not-in-register/disp32
# var output-type/edx: (addr type-tree) = output->value->type
(lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax
(lookup *(eax+8) *(eax+0xc)) # Var-type Var-type => eax
89/<- %edx 0/r32/eax
# if output is not int or float, abort
{
(is-simple-mu-type? %edx 1) # int => eax
3d/compare-eax-and 0/imm32/false
75/jump-if-!= break/disp8
(is-simple-mu-type? %edx 0xf) # float => eax
3d/compare-eax-and 0/imm32/false
75/jump-if-!= break/disp8
e9/jump $check-mu-convert-stmt:error-invalid-output-type/disp32
}
# if both are ints, abort
{
(is-simple-mu-type? %edx 1) # int => eax
3d/compare-eax-and 0/imm32/false
74/jump-if-= break/disp8
(is-simple-mu-type? %ecx 1) # int => eax
3d/compare-eax-and 0/imm32/false
74/jump-if-= break/disp8
e9/jump $check-mu-convert-stmt:error-int-to-int/disp32
}
# if both are floats, abort
{
(is-simple-mu-type? %edx 0xf) # float => eax
3d/compare-eax-and 0/imm32/false
74/jump-if-= break/disp8
(is-simple-mu-type? %ecx 0xf) # float => eax
3d/compare-eax-and 0/imm32/false
74/jump-if-= break/disp8
e9/jump $check-mu-convert-stmt:error-float-to-float/disp32
}
$check-mu-convert-stmt:end:
# . restore registers
5f/pop-to-edi
5e/pop-to-esi
5a/pop-to-edx
59/pop-to-ecx
58/pop-to-eax
# . epilogue
89/<- %esp 5/r32/ebp
5d/pop-to-ebp
c3/return
$check-mu-convert-stmt:error-no-inout:
(write-buffered *(ebp+0x10) "fn ")
8b/-> *(ebp+0xc) 0/r32/eax
(lookup *eax *(eax+4)) # Function-name Function-name => eax
(write-buffered *(ebp+0x10) %eax)
(write-buffered *(ebp+0x10) ": stmt 'convert' expects an inout\n")
(flush *(ebp+0x10))
(stop *(ebp+0x14) 1)
# never gets here
$check-mu-convert-stmt:error-too-many-inouts:
(write-buffered *(ebp+0x10) "fn ")
8b/-> *(ebp+0xc) 0/r32/eax
(lookup *eax *(eax+4)) # Function-name Function-name => eax
(write-buffered *(ebp+0x10) %eax)
(write-buffered *(ebp+0x10) ": stmt 'convert' must have just one inout\n")
(flush *(ebp+0x10))
(stop *(ebp+0x14) 1)
# never gets here
$check-mu-convert-stmt:error-no-output:
(write-buffered *(ebp+0x10) "fn ")
8b/-> *(ebp+0xc) 0/r32/eax
(lookup *eax *(eax+4)) # Function-name Function-name => eax
(write-buffered *(ebp+0x10) %eax)
(write-buffered *(ebp+0x10) ": stmt 'convert' expects an output\n")
(flush *(ebp+0x10))
(stop *(ebp+0x14) 1)
# never gets here
$check-mu-convert-stmt:error-output-not-in-register:
(write-buffered *(ebp+0x10) "fn ")
8b/-> *(ebp+0xc) 0/r32/eax
(lookup *eax *(eax+4)) # Function-name Function-name => eax
(write-buffered *(ebp+0x10) %eax)
(write-buffered *(ebp+0x10) ": stmt convert: output '")
(lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax
(lookup *eax *(eax+4)) # Var-name Var-name => eax
(write-buffered *(ebp+0x10) %eax)
(write-buffered *(ebp+0x10) "' not in a register\n")
(flush *(ebp+0x10))
(stop *(ebp+0x14) 1)
# never gets here
$check-mu-convert-stmt:error-too-many-outputs:
(write-buffered *(ebp+0x10) "fn ")
8b/-> *(ebp+0xc) 0/r32/eax
(lookup *eax *(eax+4)) # Function-name Function-name => eax
(write-buffered *(ebp+0x10) %eax)
(write-buffered *(ebp+0x10) ": stmt 'convert' must have just one output\n")
(flush *(ebp+0x10))
(stop *(ebp+0x14) 1)
# never gets here
$check-mu-convert-stmt:error-invalid-inout-type:
(write-buffered *(ebp+0x10) "fn ")
8b/-> *(ebp+0xc) 0/r32/eax
(lookup *eax *(eax+4)) # Function-name Function-name => eax
(write-buffered *(ebp+0x10) %eax)
(write-buffered *(ebp+0x10) ": stmt convert: inout '")
(lookup *esi *(esi+4)) # Stmt-var-value Stmt-var-value => eax
(lookup *eax *(eax+4)) # Var-name Var-name => eax
(write-buffered *(ebp+0x10) %eax)
(write-buffered *(ebp+0x10) "' must be an int or float\n")
(flush *(ebp+0x10))
(stop *(ebp+0x14) 1)
# never gets here
$check-mu-convert-stmt:error-invalid-output-type:
(write-buffered *(ebp+0x10) "fn ")
8b/-> *(ebp+0xc) 0/r32/eax
(lookup *eax *(eax+4)) # Function-name Function-name => eax
(write-buffered *(ebp+0x10) %eax)
(write-buffered *(ebp+0x10) ": stmt convert: output '")
(lookup *edi *(edi+4)) # Stmt-var-value Stmt-var-value => eax
(lookup *eax *(eax+4)) # Var-name Var-name => eax
(write-buffered *(ebp+0x10) %eax)
(write-buffered *(ebp+0x10) "' must be an int or float\n")
(flush *(ebp+0x10))
(stop *(ebp+0x14) 1)
# never gets here
$check-mu-convert-stmt:error-int-to-int:
(write-buffered *(ebp+0x10) "fn ")
8b/-> *(ebp+0xc) 0/r32/eax
(lookup *eax *(eax+4)) # Function-name Function-name => eax
(write-buffered *(ebp+0x10) %eax)
(write-buffered *(ebp+0x10) ": stmt convert: no need to convert int to int\n")
(flush *(ebp+0x10))
(stop *(ebp+0x14) 1)
# never gets here
$check-mu-convert-stmt:error-float-to-float:
(write-buffered *(ebp+0x10) "fn ")
8b/-> *(ebp+0xc) 0/r32/eax
(lookup *eax *(eax+4)) # Function-name Function-name => eax
(write-buffered *(ebp+0x10) %eax)
(write-buffered *(ebp+0x10) ": stmt convert: no need to convert float to float\n")
(flush *(ebp+0x10))
(stop *(ebp+0x14) 1)
# never gets here
check-mu-call: # stmt: (addr stmt), callee: (addr function), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor)
# . prologue
55/push-ebp

43979
html/apps/mu.subx.html generated

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@ apps/tests.subx 284 137
apps/sigils.subx 4641 896
apps/calls.subx 1785 448
apps/braces.subx 360 121
apps/mu.subx 36055 12688
apps/mu.subx 36692 12858
## Total source lines needed including libraries
Initial -whitespace/comments/tests/dead code
@ -28,7 +28,7 @@ apps/tests.subx 8519 2214
apps/sigils.subx 10578 3043
apps/calls.subx 9242 2388
apps/braces.subx 8545 2111
apps/mu.subx 35010 15650
apps/mu.subx 35438 15820
## executable size in KB
Initial -tests/dead code
@ -44,7 +44,7 @@ apps/tests 41 5.8
apps/sigils 54 9.1
apps/calls 47 7.1
apps/braces 42 5.9
apps/mu 554 129.0
apps/mu 563 131.0
## history of apps/mu.subx
date commit mu.subx -tests/cmts binary (KB excl. dead code)
@ -68,6 +68,6 @@ more checks Jul 25 6674 22067
more checks Aug 22 6723 23934 7851 69
floating point Sep 30 6917 26067 8595 74
more checks Nov 5 7187 34150 11953 119
== mostly done Nov 17 7263 36055 12688 129
== mostly done Nov 20 7267 36692 12858 131
vim:nowrap:tw&