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)
commit7491f5b1d5910bc3030b42234885615acef8e98f
tree54b815d86690789cf6c54e73bee8e43d63e6395b
parent57b7df3bb50111403e3b0b9112cc4c7ed4b3aec4
parentd1e585c643e146078e5885dd474354ec2eb6a8d7
Merge: compiler: Refactored `AbstractRuntimeFunction`

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