You can easily check this by adding a dummy constant and watch how your app will increase:
const abcdefghijklmnopqrstuvwxyz="ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
It would be fine if the compiler/linker would be able to strip unneeded data...
const abcdefghijklmnopqrstuvwxyz="ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
const c1=1000;
const c2=100;
const c3=10;
const c4=1;
const csum=c1+c2+c3+c4;
z=c1+c2+c3+c4; // ... needs more bytes than...
z=csum; // ... but this needs still more than...
z=1111;
globals:
CLASSDEF
APPTYPE 15
MODULEID globals
ZZZView 1 CLASS @globals_ZZZView;
c1 1 INT 1000;
c2 1 INT 100;
c3 1 INT 10;
c4 1 INT 1;
csum 1 NULL;
ZZZApp 1 CLASS @globals_ZZZApp;
<init> 2 METHOD @globals_<init>;
Rez 1 MODULE globals_Rez;
<init> 2 METHOD @globals_<init>;
Toybox 0 NULL;
END
# z=c1+c2+c3+c4;
source_ZZZApp_mc_188_8:
lgetv 0
spush z
lgetv 0
spush c1
getv
lgetv 0
spush c2
getv
addv
lgetv 0
spush c3
getv
addv
lgetv 0
spush c4
getv
addv
putv
# z=csum;
source_ZZZApp_mc_189_8:
lgetv 0
spush z
lgetv 0
spush csum
getv
putv
# z=1111;
source_ZZZApp_mc_190_8:
lgetv 0
spush z
ipush 1111
putv
# z=1000+100+10+1;
source_ZZZApp_mc_193_8:
lgetv 0
spush z
ipush 1111
putv
# z=c1+c2+c3+c4;
source_ZZZApp_mc_188_8:
lgetv 0
spush z
lgetv 0
spush c1
getv # lookup c1 in local scope, class scope, and then global scope
lgetv 0
spush c2
getv # lookup c2 in local scope, class scope, and then global scope
addv
lgetv 0
spush c3
getv # lookup c3 in local scope, class scope, and then global scope
addv
lgetv 0
spush c4
getv # lookup c4 in local scope, class scope, and then global scope
addv
putv
# z=$.c1+$.c2+$.c3+$.c4;
source_ZZZApp_mc_197_8:
lgetv 0
spush z
spush globals
getm # search for the module
spush c1
getv # look for c1 in the $ module
spush globals
getm # search for the module
spush c2
getv # look for c2 in the $ module
addv
spush globals
getm # search for the module
spush c3
getv # look for c3 in the $ module
addv
spush globals
getm # search for the module
spush c4
getv # look for c4 in the $ module
addv
putv
# var gg=$;
source_ZZZApp_mc_199_8:
source_ZZZApp_mc_199_12:
spush globals
getm # search for the module
lputv 1 # cache the result
# z=gg.c1+gg.c2+gg.c3+gg.c4;
source_ZZZApp_mc_200_8:
lgetv 0
spush z
lgetv 1 # access the $ module by accessing the stored value (no lookup required)
spush c1
getv # look for c1 in the $ module
lgetv 1 # access the $ module by accessing the stored value (no lookup required)
spush c2
getv # look for c2 in the $ module
addv
lgetv 1 # access the $ module by accessing the stored value (no lookup required)
spush c3
getv # look for c3 in the $ module
addv
lgetv 1 # access the $ module by accessing the stored value (no lookup required)
spush c4
getv # look for c4 in the $ module
addv
putv
Hey, is there a simple way to redirect the printed debug information to a file?
monkeyc ... -g ... 2> program.asm
if /%check%==/: (
set flags=%flags% --debug
set erout=2^> "%~dp0monkey.out"
)
java -cp "%~dp0bin\monkeybrains.jar"; com.garmin.monkeybrains.Monkeybrains -a "%~dp0bin\api.db" -u "%~dp0bin\devices.xml" -o %sample%.prg -m %loc%manifest.xml%flags% -z %all% %src% -y %mykey% %erout%