[Mono-devel-list] interpreter patch - 64 bits & others...

Bernie Solomon bernard at ugsolutions.com
Tue Sep 2 18:55:06 EDT 2003


This is a large patch to cover various changes to the interpreter for review
which I have updated since last time. If modifications are needed to them
let me know.

I am submitting these changes under the MIT license.

There are various changes in this code including:

- 64 bit changes
- Fixing some opcodes that didn't work properly before (e.g. CONV_U2, more
overflow changes)
- Exception handling changes - both to handling the managed/unmanaged
boundary but also in terms of getting behaviour of finally and so on better
(e.g. a try/finally nested in a finally). Note that in this I have invented
a ThreadContext structure to track the interpreter state which is passed
about while in managed code and picked up from TLS across boundaries. Also
stacktraces should be better across managed boundaries.
- I have removed the "klass" field in stackval because it was hardly ever
used - VT allocations have a real "size" field in them now (so DUP can
work). This just removes code and reduces memory usage (though Value types
are bigger). This does assume code is basically valid but code needs to be
verification that should be done as a prepass rather than while
interpretering (and the old code never did use this to verify anything
significant).
- I'd discovered the need to use mono_field_from_token as in Zoltan's recent
change already - but this is significantly slower (there's a bsearch down
below this) so I actually copy the bytecode in calc_offsets and replace the
field tokens with indices into a runtime array of fields looked up once for
quite a big performance increase (~50% in mcs building itself using mint).
Now this copy of the byte code is never freed but I can't find where things
like the "offsets" data is freed either (which I have turned into a struct
for convenience) so this is a future enhancement. Actually I think
calc_offsets needs to be split into a per domain function - to intern
strings etc - and a shared function - for this sort of optimization. Of
course a more dramatic transformation of byte code would give even better
performance (e.g. Miguel's suggestion of using the platform independent bits
of the JITter) but that's more work (as is a JITter of course which would be
the best...)
- I installed a simple Ctrl/C handler for Unix and unhandled exceptions in
different threads should get reported (I hope...)

With these changes NUnit tests actually run and many pass - though of course
the cryptography/big int tests can be slow....

I think that's it for these changes - hopefully they make some sense.

Bernie Solomon




-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: interp.diffs.txt
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20030902/7c5bb0b7/attachment.txt 


More information about the Mono-devel-list mailing list