Compilation taking lots of memory
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Leaf |
New
|
Undecided
|
Unassigned |
Bug Description
Compilation is taking lots of memory even for simple programs. The below takes up to 12GB on an ARchLinux distro:
@import("putchar") func putchar: (: abi_int) -> (: abi_int) raw
func print_char = (c: char) -> {
ignore putchar(
}
func print_digit = (i: integer) -> {
ignore putchar(
}
func print = (str: array<char>)-> {
var i = 0
loop i < str.size ? {
i = i + 1
}
}
func powi = (a: integer, b: integer) -> {
var i = 0
loop i < b ? {
a = a * a
i = i + 1
}
return a
}
// base 10 for now
func print = (i: integer) -> {
do i < 0 ? {
i = i * -1
}
// 'length' of number
var length = 0
var j = i
loop j > 0 ? {
length = length + 1
j = j / 10
}
//print_
loop length > 0 ? {
length = length - 1
}
}
func fakemod = (a: integer, b: integer) -> (: integer) {
var c: integer = lossy(a / b)
return a - b * c
}
func isPrime = (i: integer) -> (: boolean) {
var j = 2
loop j < i ? {
do fakemod(i, j) == 0 ? {
return false
}
j = j + 1
}
return true
}
var main = () -> () {
print_char('L')
print_digit(8)
print("Test")
print(12345)
/*var i = 0
var max = 100
loop i < max ? {
do isPrime(i) ? {
} | {
}
i = i + 1
}*/
}