[Mono-dev] Building Mono on Linux/Alpha

Sergey Tikhonov tsv at solvo.ru
Thu Mar 30 10:41:33 EST 2006


Hello,

I got to the point there running mono with -- regression option on 
basic.exe test started to run set of tests with different optimization 
options.
Suprisely, after last set of options it still crashes. :)
Here is some log I would like to ask to help me out with:
method to IR Tests:test_2_div ()
converting (in B2: stack: 0) IL_0000: ldc.i4.6 
converting (in B2: stack: 1) IL_0001: stloc.0  
converting (in B2: stack: 0) IL_0002: ldc.i4.3 
converting (in B2: stack: 1) IL_0003: stloc.1  
converting (in B2: stack: 0) IL_0004: ldloc.0  
converting (in B2: stack: 1) IL_0005: ldloc.1  
converting (in B2: stack: 2) IL_0006: div      
converting (in B2: stack: 1) IL_0007: ret      
REGION BB0 IL_0000 ID_FFFFFFFF
REGION BB3 IL_0000 ID_FFFFFFFF
REGION BB2 IL_0007 ID_FFFFFFFF
REGION BB1 IL_0000 ID_FFFFFFFF
block merge triggered 3 -> 2
br removal triggered 3 -> 1
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_call_opcode is called.
** (process:23165): DEBUG: ALPHA_DEBUG: 
mono_arch_get_allocatable_int_vars is called.
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_get_global_int_regs is 
called.
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_regalloc_cost is called.
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_regalloc_cost is called.
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_regalloc_cost is called.
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_allocate_vars is called.
ALPHA: Will call method with 2(0) parameters. RetType: 0x8
ALPHA: Param[0] - simple
ALPHA: Param[1] - simple
REGVAR 0 C3 R14
REGVAR 1 C3 R13
REGVAR 2 C2 R14
DUMP BLOCK 0:
DUMP BLOCK 3:
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
 (stind.i4 regvar[alpha_r14] iconst[0])
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
 (stind.i4 regvar[alpha_r13] iconst[0])
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
 (stind.i4 regvar[alpha_r14] iconst[6])
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
 (stind.i4 regvar[alpha_r13] iconst[3])
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
 (outarg_reg (ldind.i4 regvar[alpha_r13]))
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
 (outarg_reg (ldind.i4 regvar[alpha_r14]))
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
 (stind.i4 regvar[alpha_r14] call[__emul_idiv])
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
 (setret (ldind.i4 regvar[alpha_r14]))
 nop
DUMP BLOCK 1:
LABEL BLOCK 3:
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
 (stind.i4 regvar[alpha_r14] iconst[0])
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
 (stind.i4 regvar[alpha_r13] iconst[0])
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
 (stind.i4 regvar[alpha_r14] iconst[6])
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
 (stind.i4 regvar[alpha_r13] iconst[3])
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
 (outarg_reg (ldind.i4 regvar[alpha_r13]))
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
 (outarg_reg (ldind.i4 regvar[alpha_r14]))
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
 (stind.i4 regvar[alpha_r14] call[__emul_idiv])

=======================================================
Do I understand it correctly that after the call of "__emul_idiv" the 
return value should be
put into "alpha_r14" register? Where should I do it?
mini-amd64.c has function "emit_move_return_value" which for "simple" 
calls just
asserts that ins->dreg should be equal to AMD64_RAX.
Now by calling convention return value returned in alpha_r0 register and 
it works if the tests are ran
without optimizations. Should I add instruction to move return value 
from R0 to ins->dreg?
=======================================================


** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_print_tree is called.
 (setret (ldind.i4 regvar[alpha_r14]))
 nop
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_local_regalloc is called.
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_local_regalloc is called.
LOCAL regalloc: basic block: 3
      1  iconst alpha_r14 <-
      2  iconst alpha_r13 <-
      3  iconst alpha_r14 <-
      4  iconst alpha_r13 <-
      5  move R31 <- alpha_r13
      6  move R32 <- alpha_r14
      7  call R33 <- clobbers: c
      8  move alpha_r14 <- R33
      9  move R34 <- alpha_r14
      10 move alpha_r0 <- R34
liveness: alpha_r0 [10 - 10]
liveness: alpha_r13 [2 - 5]
liveness: alpha_r14 [1 - 9]
liveness: R31 [5 - 7]
liveness: R32 [6 - 7]
liveness: R33 [7 - 8]
liveness: R34 [9 - 10]
processing: 10 move alpha_r0 <- R34
      assigned sreg1 alpha_r0 to R34
      10 move alpha_r0 <- alpha_r0
processing: 9  move R34 <- alpha_r14
      assigned dreg alpha_r0 to dest R34
      freeable alpha_r0 (R34) (born in 9)
      9  move alpha_r0 <- alpha_r14
processing: 8  move alpha_r14 <- R33
      assigned sreg1 alpha_r14 to R33
      8  move alpha_r14 <- alpha_r14
processing: 7  call R33 <- clobbers: c
      assigned dreg alpha_r14 to dest R33
      freeable alpha_r14 (R33) (born in 7)
      assigned arg reg alpha_r17 to R31
      assigned arg reg alpha_r16 to R32
      7  call alpha_r14 <- clobbers: c
processing: 6  move R32 <- alpha_r14
      assigned dreg alpha_r16 to dest R32
      freeable alpha_r16 (R32) (born in 6)
      6  move alpha_r16 <- alpha_r14
processing: 5  move R31 <- alpha_r13
      assigned dreg alpha_r17 to dest R31
      freeable alpha_r17 (R31) (born in 5)
      5  move alpha_r17 <- alpha_r13
processing: 4  iconst alpha_r13 <-
      4  iconst alpha_r13 <-
processing: 3  iconst alpha_r14 <-
      3  iconst alpha_r14 <-
processing: 2  iconst alpha_r13 <-
      2  iconst alpha_r13 <-
processing: 1  iconst alpha_r14 <-
      1  iconst alpha_r14 <-
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_local_regalloc is called.
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_emit_prolog is called.
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_output_basic_block is 
called.
Basic block 0(0x12042a8f8) starting at offset 0x18
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_output_basic_block is 
called.
Basic block 3(0x12042abf8) starting at offset 0x18
ALPHA: Emiting [iconst] opcode
ALPHA_CHECK: [iconst] dreg=14, const=0
ALPHA: Emiting [iconst] opcode
ALPHA_CHECK: [iconst] dreg=13, const=0
ALPHA: Emiting [iconst] opcode
ALPHA_CHECK: [iconst] dreg=14, const=6
ALPHA: Emiting [iconst] opcode
ALPHA_CHECK: [iconst] dreg=13, const=3
ALPHA: Emiting [move] opcode
ALPHA_CHECK: [move] sreg=13, dreg=17
ALPHA: Emiting [move] opcode
ALPHA_CHECK: [move] sreg=14, dreg=16
ALPHA: Emiting [call] opcode
ALPHA_CHECK: [fcall/lcall/vcall/voidcall/call] Target: 
[MONO_PATCH_INFO_ABS] 0x120152068
ALPHA: Emiting [move] opcode
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_output_basic_block is 
called.
ALPHA_CHECK: [move] sreg=14, dreg=0
Basic block 1(0x12042a9f8) starting at offset 0x50
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_emit_epilog is called.
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_emit_exceptions is called.
Method Tests:test_2_div () emitted at 0x2000411d2f8 to 0x2000411d35c 
[basic.exe]
** (process:23165): DEBUG: ALPHA_DEBUG: mono_arch_patch_code is called.

/tmp/test.o:     file format elf64-alpha

Disassembly of section .text:

0000000000000000 <Tests_test_2_div>:
   0: 00 00 bb 27       ldah  gp,0(t12)
   4: 00 00 bd 23       lda   gp,0(gp)
   8: f0 ff de 23       lda   sp,-16(sp)
   c: 00 00 5e b7       stq   ra,0(sp)
  10: 08 00 fe b5       stq   fp,8(sp)
  14: 0f 04 fe 47       mov   sp,fp
  18: 0e 04 ff 47       clr   s5
  1c: 0d 04 ff 47       clr   s4
  20: 06 00 df 21       lda   s5,6
  24: 03 00 bf 21       lda   s4,3
  28: 11 04 ed 47       mov   s4,a1
  2c: 10 04 ee 47       mov   s5,a0
  30: 38 00 7d a7       ldq   t12,56(gp)
  34: 02 00 e0 c3       br    40 <Tests_test_2_div+0x40>
  38: 68 20 15 20       lda   v0,8296(a5)
  3c: 01 00 00 00       call_pal    0x1
  40: 00 40 5b 6b       jsr   ra,(t12),44 <Tests_test_2_div+0x44>
  44: 00 00 ba 27       ldah  gp,0(ra)
  48: bc ff bd 23       lda   gp,-68(gp)
  4c: 00 04 ee 47       mov   s5,v0
  50: 1e 04 ef 47       mov   fp,sp
  54: 00 00 5e a7       ldq   ra,0(sp)
  58: 08 00 fe a5       ldq   fp,8(sp)
  5c: 10 00 de 23       lda   sp,16(sp)
  60: 01 80 fa 6b       ret
Running 'test_2_div' ...
Test 'test_2_div' failed result (got 6, expected 2).

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.
Another thing that I haven't looked yet is - then global register was 
used shouldn't register allocation logic mark it as used in 
cfg->used_int_regs?
I have a code in my emit_prolog function that should save used int regs 
on stack, but it saves none (it might be problem in my code, but I
hope my assumption is correct).

So far about 99% of basic tests are successful with different 
optimisation options. :)

Regards,

PS. Is my assumption is correct that by "default" all OP_I.. and CEE_... 
opcodes that work with intergers are 32 bit long?

-- 
Sergey Tikhonov

Solvo Ltd.
Saint-Petersburg, Russia
tsv at solvo.ru




More information about the Mono-devel-list mailing list