Closed TheMhv closed 2 months ago
Currently bend-lang 0.2.37-alpha.1 already produces an error "Definition is too large for HVM" instead of panicking at runtime
Due to some constraints on the execution model of Bend, functions have a limited maximum size.
Normally the compiler is able to break down the functions into pieces for you, but due to other constraints, the main
function is special and doesn't do that.
As mentioned above, the latest version should already give you an actual error with a brief explanation.
In your case, you can simply declare your large table as a different function and everything should work fine.
def bits():
x = [
"1000010100010100010111110011000", "1110001001101110100010010010001", "10110101110000001111101111001111", "11101001101101011101101110100101", "111001010101101100001001011011", "1011001111100010001000111110001", "10010010001111111000001010100100", "10101011000111000101111011010101",
"11011000000001111010101010011000", "10010100000110101101100000001", "100100001100011000010110111110", "1010101000011000111110111000011", "1110010101111100101110101110100", "10000000110111101011000111111110", "10011011110111000000011010100111", "11000001100110111111000101110100",
"11100100100110110110100111000001", "11101111101111100100011110000110", "1111110000011001110111000110", "100100000011001010000111001100", "101101111010010010110001101111", "1001010011101001000010010101010", "1011100101100001010100111011100", "1110110111110011000100011011010",
"10011000001111100101000101010010", "10101000001100011100011001101101", "10110000000000110010011111001000", "10111111010110010111111111000111", "11000110111000000000101111110011", "11010101101001111001000101000111", "110110010100110001101010001", "10100001010010010100101100111",
"100111101101110000101010000101", "101110000110110010000100111000", "1001101001011000110110111111100", "1010011001110000000110100010011", "1100101000010100111001101010100", "1110110011010100000101010111011", "10000001110000101100100100101110", "10010010011100100010110010000101",
"10100010101111111110100010100001", "10101000000110100110011001001011", "11000010010010111000101101110000", "11000111011011000101000110100011", "11010001100100101110100000011001", "11010110100110010000011000100100", "11110100000011100011010110000101", "10000011010101010000001110000",
"11001101001001100000100010110", "11110001101110110110000001000", "100111010010000111011101001100", "110100101100001011110010110101", "111001000111000000110010110011", "1001110110110001010101001001010", "1011011100111001100101001001111", "1101000001011100110111111110011",
"1110100100011111000001011101110", "1111000101001010110001101101111", "10000100110010000111100000010100", "10001100110001110000001000001000", "10010000101111101111111111111010", "10100100010100000110110011101011", "10111110111110011010001111110111", "11000110011100010111100011110010"
]
return x
def main():
return bits()
Due to some constraints on the execution model of Bend, functions have a limited maximum size.
Normally the compiler is able to break down the functions into pieces for you, but due to other constraints, the
main
function is special and doesn't do that.As mentioned above, the latest version should already give you an actual error with a brief explanation.
In your case, you can simply declare your large table as a different function and everything should work fine.
def bits(): x = [ "1000010100010100010111110011000", "1110001001101110100010010010001", "10110101110000001111101111001111", "11101001101101011101101110100101", "111001010101101100001001011011", "1011001111100010001000111110001", "10010010001111111000001010100100", "10101011000111000101111011010101", "11011000000001111010101010011000", "10010100000110101101100000001", "100100001100011000010110111110", "1010101000011000111110111000011", "1110010101111100101110101110100", "10000000110111101011000111111110", "10011011110111000000011010100111", "11000001100110111111000101110100", "11100100100110110110100111000001", "11101111101111100100011110000110", "1111110000011001110111000110", "100100000011001010000111001100", "101101111010010010110001101111", "1001010011101001000010010101010", "1011100101100001010100111011100", "1110110111110011000100011011010", "10011000001111100101000101010010", "10101000001100011100011001101101", "10110000000000110010011111001000", "10111111010110010111111111000111", "11000110111000000000101111110011", "11010101101001111001000101000111", "110110010100110001101010001", "10100001010010010100101100111", "100111101101110000101010000101", "101110000110110010000100111000", "1001101001011000110110111111100", "1010011001110000000110100010011", "1100101000010100111001101010100", "1110110011010100000101010111011", "10000001110000101100100100101110", "10010010011100100010110010000101", "10100010101111111110100010100001", "10101000000110100110011001001011", "11000010010010111000101101110000", "11000111011011000101000110100011", "11010001100100101110100000011001", "11010110100110010000011000100100", "11110100000011100011010110000101", "10000011010101010000001110000", "11001101001001100000100010110", "11110001101110110110000001000", "100111010010000111011101001100", "110100101100001011110010110101", "111001000111000000110010110011", "1001110110110001010101001001010", "1011011100111001100101001001111", "1101000001011100110111111110011", "1110100100011111000001011101110", "1111000101001010110001101101111", "10000100110010000111100000010100", "10001100110001110000001000001000", "10010000101111101111111111111010", "10100100010100000110110011101011", "10111110111110011010001111110111", "11000110011100010111100011110010" ] return x def main(): return bits()
This worked, thanks!
Reproducing the behavior
This code
returns this error message
System Settings
Example:
Additional context
No response