Skip to content

RuntimeError: unreachable with virtual functions #1635

Closed
@ColinEberhardt

Description

@ColinEberhardt

I've hit this issue, but am struggling to create a compact reproduction - here's a brief summary.

See this PR ColinEberhardt/assemblyscript-regex#12

I'm hitting the following error at runtime:

    RuntimeError: unreachable
        at assembly/nfa/matcher/Matcher#matches@virtual (wasm-function[240]:1)
        at assembly/nfa/matcher/CharacterSetMatcher#matches~anonymous|0 (wasm-function[241]:19)
        at ~lib/array/Array<assembly/nfa/matcher/Matcher>#some (wasm-function[242]:85)
        at assembly/nfa/matcher/CharacterSetMatcher#matches (wasm-function[244]:21)
        at assembly/nfa/nfa/MatcherState<assembly/nfa/matcher/CharacterSetMatcher>#matches (wasm-function[245]:8)
        at assembly/nfa/nfa/State#matches@virtual (wasm-function[250]:58)
        at assembly/regexp/recursiveBacktrackingSearch (wasm-function[184]:121)
        at assembly/regexp/recursiveBacktrackingSearch@varargs (wasm-function[185]:56)
        at assembly/regexp/RegExp#exec (wasm-function[192]:307)

I've tried to recreate the issue, by creating a similar runtime state (replicating the various classes etc ...), but in doing so have stumbled on something odd. By adding the code outlined here:

https://github.com/ColinEberhardt/assemblyscript-regex/pull/12/files#diff-f350832f4859b9724e3ef59f756d2d201226fd81fd797207367fc269581115adR170-R178

Which basically creates a similar runtime state, the error goes away!

In other words - if I create a CharacterMatcher, CharacterSetMatcher, etc ... - execute their matches function, then throw the result away, everything wrks just fine. If not - I see the above runtime error later on in the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions