[Mono-dev] Abort with Non-Typical Exception Handler Layout on Mono 1.1.13.6

Almann T. Goo almann.goo at gmail.com
Sun Jun 11 09:48:32 EDT 2006


I am working on exception handler translation for JaCIL (CLI to JVM
byte-code compiler) so I've been writing some sample cases in CIL to better
understand the handler semantics in the CLI.  When running up this CIL code
in Mono 1.1.13.6, the run time aborted on an assertion error.

    T_START:
        ldstr   "Start"
        call    void [mscorlib]System.Console::WriteLine(string)
        leave.s COMPLETE
    T1_END:
        nop
    T2_END:

    COMPLETE:
        ret

    F1_START:
        ldstr   "Finally1"
        call    void [mscorlib]System.Console::WriteLine(string)
        endfinally
    F1_END:

    F2_START:
        ldstr   "Finally2"
        call    void [mscorlib]System.Console::WriteLine(string)
        endfinally
    F2_END:

    .try T_START to T1_END finally handler F1_START to F1_END
    .try T_START to T2_END finally handler F2_START to F2_END

The error returned when trying to execute this code in Mono is:

$ mono sample.exe

** ERROR **: file mini.c: line 9517 (mini_method_compile): assertion failed:
(tblock->native_offset)
aborting...
Aborted

If I move the method return and its label past the last finally handler the
above code works (probably how most compilers would probably generate this
type of code).  From what I understand of ECMA-335, it is legitimate to have
this case, and it indeed works in .NET Framework and Portable .NET as shown
below:

D:\tmp> sample.exe
Start
Finally1
Finally2

I could be missing something in ECMA-335 (which has parts of the handler
spec in Partitions I, II, and III making more room for confusion) and PNet
and .NET Framework are just simply lax in this regard.  This is certainly
not a show stopper for my work, but I was wondering if anyone else has run
into anything similar on Mono with regard to exception handlers.

Best regards,
Almann

-- 
Almann T. Goo
almann.goo at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060611/c82e9e83/attachment.html 


More information about the Mono-devel-list mailing list