2002-05-24 Dietmar Maurer <dietmar@ximian.com>
authorDietmar Maurer <dietmar@mono-cvs.ximian.com>
Fri, 24 May 2002 07:05:59 +0000 (07:05 -0000)
committerDietmar Maurer <dietmar@mono-cvs.ximian.com>
Fri, 24 May 2002 07:05:59 +0000 (07:05 -0000)
* x86.brg: CPBLK impl.

* emit-x86.c (tree_emit): modified to support 3 nonterminals per
rule (used for CPBLK).

svn path=/trunk/mono/; revision=4896

mono/jit/ChangeLog
mono/jit/emit-x86.c
mono/jit/exception.c
mono/jit/jit.c
mono/jit/x86.brg

index f817bcd8a124366cc8ac8427a0b0ffbaa4db5614..ae7784fcddecda8f5802bce29bf144ab35b58649 100644 (file)
@@ -1,3 +1,9 @@
+2002-05-24  Dietmar Maurer  <dietmar@ximian.com>
+
+       * x86.brg: CPBLK impl.
+
+       * emit-x86.c (tree_emit): modified to support 3 nonterminals per
+       rule (used for CPBLK).
 
 Thu May 23 18:43:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
 
index edf89f7c5466a5df9bcd45a2aad4c806704e5ce2..6f78e11851780399e6e6ec8424482c77392025dc 100644 (file)
@@ -645,8 +645,6 @@ tree_allocate_regs (MonoFlowGraph *cfg, MBTree *tree, int goal, MonoRegSet *rs,
        if (nts [0]) {
                if (nts [1]) { /* two kids */
                        MonoRegSet saved_rs;
-                       if (nts [2]) /* we cant handle three kids */
-                               g_assert_not_reached ();
 
                        if (!tree_allocate_regs (cfg, kids [0], nts [0], rs, left_exclude_mask, spillcount))
                                return FALSE;
@@ -692,6 +690,15 @@ tree_allocate_regs (MonoFlowGraph *cfg, MBTree *tree, int goal, MonoRegSet *rs,
 #endif
                        }
 
+                       if (nts [2]) {
+                               if (nts [3]) /* we cant handle four kids */
+                                       g_assert_not_reached ();
+
+                               if (!tree_allocate_regs (cfg, kids [2], nts [2], rs, right_exclude_mask, spillcount))
+                                       return FALSE;
+                               
+                       }
+
                } else { /* one kid */
                        if (!tree_allocate_regs (cfg, kids [0], nts [0], rs, left_exclude_mask, spillcount))
                                return FALSE;                   
@@ -863,9 +870,6 @@ tree_emit (int goal, MonoFlowGraph *cfg, MBTree *tree, int *spillcount)
                if (nts [1]) {
                        int spilloffset1, spilloffset2, spilloffset3;
                        
-                       if (nts [2])
-                               g_assert_not_reached ();
-
                        tree_emit (nts [0], cfg, kids [0], spillcount);
 
                        if (kids [0]->spilled) {
@@ -919,6 +923,11 @@ tree_emit (int goal, MonoFlowGraph *cfg, MBTree *tree, int *spillcount)
                                        x86_mov_reg_membase (cfg->code, kids [0]->reg1, X86_EBP, 
                                                             spilloffset1, 4);
                        }
+
+                       if (nts [2]) {
+                               g_assert (!nts [3]);
+                               tree_emit (nts [2], cfg, kids [2], spillcount);
+                       }
                } else {
                        tree_emit (nts [0], cfg, kids [0], spillcount);
                }
index ccde42afc54016542e7ad8963486d4202b404678..1a9ece6534dc77bb6a81f09028196f813cd75f26 100644 (file)
@@ -138,8 +138,8 @@ arch_get_call_finally (void)
  * stack_trace String. 
  */
 static gboolean
-arch_exc_is_catched (MonoDomain *domain, MonoJitTlsData *jit_tls, gpointer ip, 
-                    gpointer *bp, gpointer obj)
+arch_exc_is_caught (MonoDomain *domain, MonoJitTlsData *jit_tls, gpointer ip, 
+                   gpointer *bp, gpointer obj)
 {
        MonoJitInfo *ji;
        gpointer *end_of_stack;
@@ -294,7 +294,7 @@ arch_handle_exception (struct sigcontext *ctx, gpointer obj)
 
        cleanup = jit_tls->abort_func;
 
-       if (!arch_exc_is_catched (domain, jit_tls, ip, (gpointer *)ctx->SC_EBP, obj)) {
+       if (!arch_exc_is_caught (domain, jit_tls, ip, (gpointer *)ctx->SC_EBP, obj)) {
                if (mono_debug_format != MONO_DEBUG_FORMAT_NONE) {
                        mono_debug_make_symbols ();
                }
index 174350296a48874925bd56405bc4dc316dfbdc7a..e57835278fe0e74a6c6f23bc4215b8bcf57c65ca 100644 (file)
@@ -285,6 +285,7 @@ map_stind_type (MonoType *type)
        case MONO_TYPE_I1:
        case MONO_TYPE_U1:
        case MONO_TYPE_BOOLEAN:
+
                return MB_TERM_STIND_I1;        
        case MONO_TYPE_I2:
        case MONO_TYPE_U2:
@@ -2348,7 +2349,10 @@ mono_analyze_stack (MonoFlowGraph *cfg)
                        ip += 4;
                        sp -= 2;
 
-                       t1 = mono_ctree_new (mp, MB_TERM_CPOBJ, sp [0], sp [1]);
+                       t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+                       t1->data.i = mono_class_value_size (class, NULL);                       
+                       t1 = mono_ctree_new (mp, MB_TERM_CPSRC, sp [1], t1);
+                       t1 = mono_ctree_new (mp, MB_TERM_CPBLK, sp [0], t1);
                        ADD_TREE (t1, cli_addr);
                        
                        break;
@@ -3472,6 +3476,15 @@ mono_analyze_stack (MonoFlowGraph *cfg)
                                PUSH_TREE (t1, VAL_I32);
                                break;
                        }
+                       case CEE_CPBLK: {
+                               ++ip;
+                               sp -= 3;
+
+                               t1 = mono_ctree_new (mp, MB_TERM_CPSRC, sp [1], sp [2]);
+                               t1 = mono_ctree_new (mp, MB_TERM_CPBLK, sp [0], t1);
+                               ADD_TREE (t1, cli_addr);
+                               break;
+                       }
                        case CEE_UNALIGNED_: {
                                ++ip;
                                // fixme: implement me
index 25e565684f6ef6c35f32b9fb092b974292dfb678..2abdfefdad957991eaf15e196a8ed85f29a6b766 100644 (file)
@@ -222,7 +222,7 @@ void *MEMCOPY (void *dest, const void *src, size_t n);
 %term DIV DIV_UN REM REM_UN AND OR XOR SHL SHR SHR_UN NEG NOT
 %term COMPARE CBRANCH BRTRUE BRFALSE CSET
 %term CONV_I4 CONV_I1 CONV_I2 CONV_I8 CONV_U1 CONV_U2 CONV_U4 CONV_U8 CONV_R4 CONV_R8 CONV_R_UN
-%term INTF_ADDR VFUNC_ADDR NOP NEWARR NEWARR_SPEC NEWOBJ NEWOBJ_SPEC NEWSTRUCT CPOBJ POP INITOBJ
+%term INTF_ADDR VFUNC_ADDR NOP NEWARR NEWARR_SPEC NEWOBJ NEWOBJ_SPEC NEWSTRUCT CPBLK CPSRC POP INITOBJ
 %term ISINST CASTCLASS UNBOX
 %term CONV_OVF_I1 CONV_OVF_U1 CONV_OVF_I2 CONV_OVF_U2 CONV_OVF_U4 CONV_OVF_U8 CONV_OVF_I4
 %term CONV_OVF_I4_UN CONV_OVF_U1_UN CONV_OVF_U2_UN
@@ -1966,6 +1966,19 @@ stmt: INITOBJ (reg) {
        x86_pop_reg (s->code, X86_EAX);
 }
 
+stmt: CPBLK (reg, CPSRC (reg, reg)) {
+       int dest_reg = tree->left->reg1;
+       int source_reg = tree->right->left->reg1;
+       int size_reg = tree->right->right->reg1;
+
+       x86_push_reg (s->code, size_reg);
+       x86_push_reg (s->code, source_reg);
+       x86_push_reg (s->code, dest_reg);
+       mono_add_jump_info (s, s->code, MONO_JUMP_INFO_ABS, memcpy);
+       x86_call_code (s->code, 0);
+       x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 12);
+}
+
 stmt: NOP
 
 stmt: POP (reg)