[runtime] Remove code duplication from the wapi_interrupt_.. functions.