Merge: compiler: Refactored `AbstractRuntimeFunction`
authorJean Privat <jean@pryen.org>
Mon, 19 Aug 2019 18:43:04 +0000 (14:43 -0400)
committerJean Privat <jean@pryen.org>
Mon, 19 Aug 2019 18:43:04 +0000 (14:43 -0400)
Removed duplicate code across all the compiler and made
`AbstractRuntimeFunction` implement Template Design pattern.
This allows for better code reuse and easier customization.

Removed the notion of "virtual function" and unified it with the concept
of thunk function. A thunk is an intermediary function between a caller
and a callee whose purpose is to compute thing before or after the
callee gets invoke. Currently, the only usages of thunks are to do conversions (casting)
before calling the actual callee. Thunks can be created by inheriting
`abstract_compiler::ThunkFunction` which provides a default
implementation. Furthermore, this class simplify the old code of
`SeparateRuntimeFunction` by replacing `if` with actual polymorphism.

Finally, thunks will be used to implement callref mechanics.

Signed-off-by: Louis-Vincent Boudreault <lv.boudreault95@gmail.com>

Pull-Request: #2782


Trivial merge