From: Jean Privat Date: Thu, 26 Feb 2015 02:23:36 +0000 (+0700) Subject: Merge: Guard call X-Git-Tag: v0.7.2~4 X-Git-Url: http://nitlanguage.org Merge: Guard call Add option `--guard-call` as an alternative implementation of the link-time optimization `--substitute-monomorph` The idea is to have the standard VFT call guarded by a symbol when the call is monomorphic. So the sequence is independent of any client and is roughly ~~~ if SYMBOL != null then SYMBOL(ARGS) else (SELF->VFT[COLOR])(ARGS) end ~~~ where the value of the SYMBOL is set for each specific program at link-time: null when the call is polymorphic and the address of the single target when the call is monomorphic. Benches show that, on my computer, there is from 0% to 10% in loss so this alternative implementation is pure overcost :) Still keep it because, I coded it and works, and it may worth something on other architectures. The benchs shows some quick results: * first (sc, red) is default * second (sl, green) is `--substitute-monomorph`, the previous impl * third (gc, blue) is `--guard-call``, the new one * last (cd, purple) is `--direct-call-monomorph0`, the optimal with direct calls directly inserted in a global way ![bench_linkboost](https://cloud.githubusercontent.com/assets/135828/6342973/794b2a92-bc13-11e4-9b22-cc43e6cda473.png) Even if the result is deceiving, the PR does some cleanup and refactorization, so we got that goin for us, which is nice. Pull-Request: #1173 Reviewed-by: Alexandre Terrasa Reviewed-by: Lucas Bajolet --- 0276de5e08ccd88b30c0dd034c50cf5a0db7d454