[Mono-dev] Building Mono on Linux/Alpha
vargaz at gmail.com
Sat May 6 08:59:47 EDT 2006
Exception support requires implementing:
- the opcodes like throw, start_handler, endfinally
- the functions in exceptions-<ARCH>.c
- mono_arch_emit_exceptions ().
As usual, the best documentation is the code of the other backends, but there
is some documentation in mono/docs/exception-handling.txt. I suggest
going throu the tests in exceptions.cs in the order they are in the file, and
trying to implement the support needed by them. LMF handling can be done
at a later stage since it is only needed by some later tests.
On 5/4/06, Sergey Tikhonov <tsv at solvo.ru> wrote:
> Hello Zoltan,
> >Either you should emit code to move from R0 to ins->dreg, or (better), modify
> >your cpu-alpha.md file and the register allocator macros in
> >mini-alpha.h to force
> >the local register allocator to allways allocate the dreg of the call
> >instruction to
> >R0. This way the reg allocator will emit the move instruction if it is
> >Here is what a call instruction looks like in cpu-pentium.md:
> >call: dest:a clob:c len:17
> >And the corresponding macro (only an example):
> >#define MONO_ARCH_INST_FIXED_REG(desc) ((desc == 'a') ? X86_EAX : -1)
> >>Using different options triggered some interesting code I had to
> >>implement. My question is what is the difference between local and global
> >>registers? As I undertood the local registers could be used temporary in
> >>basic blocks, the global registers are used during optimizations.
> >>Can I define all my local registers as global ones? It seems that they
> >>couldn't mixed.
> >Global registers are used during global register allocation. They should be
> >distinct from the set of local registers. mono_arch_get_global_int_regs ()
> >returns the list of registers that should be used for global allocation. These
> >registers are usually the 'callee-saved' registers defined by the platform ABI.
> >The global register allocator will set cfg->used_int_regs if needed. I suggest
> >returning an empty list from get_global_int_regs () until all tests are running,
> >so you have a large set of regression tests which you can use to debug the
> >inevitable problems which will arose when some variables are allocated to
> >global registers.
> After some hacking I was able to run "Hello world" program. :) It still
> crashes somewhere at final stage of program rundown, but surely it did a
> lot before that. :)
> Now I have to implement "hardest" part - handling of exceptions. I need
> some hints here. :)
> - Of couse I am getting segfaults. For now I return -1 in
> mono_arch_find_jit_info. It seems to work in most cases - I am getting
> stack trace. But I guess there is not enough information to do correct
> unwinding and the VM segfaults again and goes to the loop of segfaults.
> If you could shed light here - it would be great.
> - Do I have to implement LMF handling to do correct unwinding? I don't
> have any LMF frames right now (it seems that I would have to save a lot
> of information in stack).
> - I don't have implemented any of throw, finally, call_handler - program
> exceptions. What are the requirements to implement it in general?
> Thank you,
> Sergey Tikhonov
> Solvo Ltd.
> Saint-Petersburg, Russia
> tsv at solvo.ru
More information about the Mono-devel-list