Optimizations

From RevaWiki

Jump to: navigation, search

Current

Reva does call tail-optimization. So a terminal "call xxx" is resolved to "jmp xxx". This eliminates the need to push a return address as well as the necessity for a final "ret".

Conditionals and loops attempt to use a short jmp if possible; but will use a large jmp if needed.

Future

I want to do recursive tail optimization, so that if the 'jmp'ed to instruction is itself a 'jmp', Reva will resolve it to the ultimate destination. So e.g.:

: a ." hi" cr ;
: b a ;
: c b ;
: d c ;

'd' would be a 'jmp' to 'a', instead of at present, a 'jmp' to 'c' ( rather than a 'call' to 'c')

Personal tools