陷入 CIL 中的 catch 条款

Falling into a catch clause in CIL

对于 CIL 中的 try 块,我知道您可以通过在受保护的块中抛出异常来进入 catch 处理程序,例如:

try {
     newobj Exception
     throw
     leave EX1
} catch {
     pop
     ldstr "catchblock"
     call WriteLine
} finally {
     ldstr "finallyblock"
     call WriteLine
}

EX1: 

throw 语句会将控制转移到 catch 子句,它 弹出异常。

我担心(/好奇)是这是否可以优化以便执行 不是通过抛出到 catch 块,而是通过增加 PC 将 "falling" 放入其中。像这样:

try {
     newobj Exception
} catch {
     pop
     ldstr "catchblock"
     call WriteLine
} finally {
     ldstr "finallyblock"
     call WriteLine
}

EX1: 

这是有效的 CIL 吗?是否可以在不使用 throw 语句的情况下到达 catch 处理程序块?

不,它显然无效。

在 ECMA-335 分区 I,第 12.4.2.8.1 节中:

Entry to filters or handlers can only be accomplished through the CLI exception system; that is, it is not valid for control to fall through into such blocks. This means filters and handlers cannot appear at the beginning of a method, or immediately following any instruction that can cause control flow to fall through.