[Mono-list] Verification runtime support

Paolo Molaro lupus@ximian.com
Wed, 3 Jul 2002 17:41:53 +0200


On 07/03/02 Hinne Hettema (DSL AK) wrote:
> If this is what needs to happen, some observations on the current code would
> be
> 
> -- We only call code verification from the interpreter but not yet from the
> JIT compiler?

The interp doesn't verify the code either.

> -- The current verification code looks at (some) metadata and pointers on
> the stack, but doesn't     do any type checking or dataflow analysis

Yes, that is the current state (local initialization is checked, but in
the wrong way...).

I suggest following these steps:

*) Add the code to verify some of the tables that still are not verified
*) Work on type checking in the IL code

I'll commit shortly a few changes to verify.c and pedump so that
at least they can be used a bit to verify also IL code.
This is very important now that we got mcs to compile corlib: we need to
make sure the code in corlib is compiled correctly and PEVerify can't
handle a corlib, so we need our own tool.

The code in verify.c will still flag a few methods as having invalid
code, but it should be easy to spot the issues, now (I get about a 100
error in the mcs-compiled corlib: some of these are wrong checks in
verify but many checks are still not done as you point out).

It will get, for example, the mcs bug with loops that was discussed
today on the list:

$ ./metadata/pedump --verify all,code branch.exe 
In method: .T::ConsumeWhitespace(bool)
Error: Branch target out of code at 0x000c
Error count: 1

lupus

-- 
-----------------------------------------------------------------
lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better