Replace inko_check_refs with generated code
yorickpeterse opened this issue · comments
The runtime function inko_check_refs
is used to check the reference count, and to produce a panic if the ref count is positive. Given most of the time this panic doesn't occur, the cost of the function call is excessive.
Instead, the reference count should be performed in generated code, with the runtime library providing a function to panic with an error message. This way we only pay the function call cost when there's actually a need for it. inko_check_refs
in this case should be renamed to inko_reference_count_error
.