Closed 0x7CFE closed 8 years ago
WTF, Дима. Я как бэ комменты оставил
Изменения по твоим комментариям надо оформить отдельным PR поверх develop
. Текущая ситуация тормозила дальнейшее развитие. К сожалению, у меня сейчас нет времени на полноценное оформление исходников. В конце концов, develop
— это нестабильная ветка.
Original implementation uses exception API to perform far jump to dispatch
BlockReturn
instruction. This work OK but is terribly slow. I mean REALLY slow, 10 times slower than the software implementation and 40 times slower than implementation proposed here.Current pull request implements
BlockReturn
using MRV technique to return several values in registers instead of stack. In our case result object is returned ineax
whereas target context inedx
(on x86 of course). Cascade block return is handled by simply propagating these two registers unchanged from inner stack frame to outer and so on. Typical overhead is onecmp
ortest
instruction per message send and oneret
instruction per frame.We use use
-freg-struct-return
technique which is uncommon in UNIX world and it's calling conventions, but is fully supported in GCC and clang depending on a compiler version.More portable implementation should pass return value using the stack (
sret
in terms of LLVM) but this will be slower and will not handle cascade return in a straightforward way.