Author: zoltan Date: 2008-02-18 11:19:48 -0500 (Mon, 18 Feb 2008) New Revision: 96068
Modified: branches/vargaz/mini-linear-il/mono/eglib/src/sort.frag.h branches/vargaz/mini-linear-il/mono/mono/arch/ChangeLog branches/vargaz/mini-linear-il/mono/mono/metadata/ChangeLog branches/vargaz/mini-linear-il/mono/mono/metadata/loader.c branches/vargaz/mini-linear-il/mono/mono/mini/ChangeLog branches/vargaz/mini-linear-il/mono/mono/mini/cpu-amd64.md branches/vargaz/mini-linear-il/mono/mono/mini/cpu-sparc.md branches/vargaz/mini-linear-il/mono/mono/mini/inssel-amd64.brg branches/vargaz/mini-linear-il/mono/mono/mini/inssel-sparc.brg branches/vargaz/mini-linear-il/mono/mono/mini/inssel-x86.brg branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c branches/vargaz/mini-linear-il/mono/mono/mini/mini-alpha.c branches/vargaz/mini-linear-il/mono/mono/mini/mini-alpha.h branches/vargaz/mini-linear-il/mono/mono/mini/mini-amd64.c branches/vargaz/mini-linear-il/mono/mono/mini/mini-arm.c branches/vargaz/mini-linear-il/mono/mono/mini/mini-arm.h branches/vargaz/mini-linear-il/mono/mono/mini/mini-codegen.c branches/vargaz/mini-linear-il/mono/mono/mini/mini-ia64.c branches/vargaz/mini-linear-il/mono/mono/mini/mini-ops.h branches/vargaz/mini-linear-il/mono/mono/mini/mini-sparc.c branches/vargaz/mini-linear-il/mono/mono/mini/mini-sparc.h branches/vargaz/mini-linear-il/mono/mono/mini/mini-x86.c branches/vargaz/mini-linear-il/mono/mono/mini/mini.c branches/vargaz/mini-linear-il/mono/mono/mini/mini.h branches/vargaz/mini-linear-il/mono/mono/mini/tramp-alpha.c branches/vargaz/mini-linear-il/mono/mono/tests/ChangeLog branches/vargaz/mini-linear-il/mono/mono/tests/Makefile.am branches/vargaz/mini-linear-il/mono/mono/utils/ChangeLog branches/vargaz/mini-linear-il/mono/mono/utils/mono-membar.h Log: Merge from HEAD. Modified: branches/vargaz/mini-linear-il/mono/eglib/src/sort.frag.h =================================================================== --- branches/vargaz/mini-linear-il/mono/eglib/src/sort.frag.h 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/eglib/src/sort.frag.h 2008-02-18 16:19:48 UTC (rev 96068) @@ -34,10 +34,6 @@ * 'prev' pointer of a doubly-linked list node is _not_ updated). Any * invariant would require a post-processing pass to fix matters if * necessary. - * - * Note: We refer to a list fragment as a "digit" because the code for - * maintaining the invariants of the core data structure parallels the - * code for incrementing the binary representation of a number. */ typedef list_node *digit; @@ -46,18 +42,34 @@ * = ceiling (log2 (maximum number of list nodes)) * = ceiling (log2 (maximum possible memory size/size of each list node)) * = number of bits in 'size_t' - floor (log2 (sizeof digit)) - * Also, each "digit" is at least 2 nodes long: we can reduce the depth by 1 + * Also, each list in sort_info is at least 2 nodes long: we can reduce the depth by 1 */ - #define FLOOR_LOG2(x) (((x)>=2) + ((x)>=4) + ((x)>=8) + ((x)>=16) + ((x)>=32) + ((x)>=64) + ((x)>=128)) -#define MAX_DIGITS ((sizeof (size_t) * 8) - FLOOR_LOG2(sizeof (list_node)) - 1) +#define MAX_RANKS ((sizeof (size_t) * 8) - FLOOR_LOG2(sizeof (list_node)) - 1) -static inline digit -add_digits (digit first, digit second, GCompareFunc func) +struct sort_info { + int min_rank, n_ranks; + GCompareFunc func; + + /* Invariant: ranks[i] == NULL || length(ranks[i]) >= 2**(i+1) */ + list_node *ranks [MAX_RANKS]; /* ~ 128 bytes on 32bit, ~ 512 bytes on 64bit */ +}; + +static inline void +init_sort_info (struct sort_info *si, GCompareFunc func) +{ + si->min_rank = si->n_ranks = 0; + si->func = func; + /* we don't need to initialize si->ranks, since we never lookup past si->n_ranks. */ +} + +static inline list_node * +merge_lists (list_node *first, list_node *second, GCompareFunc func) +{ /* merge the two lists */ - digit list = NULL; - digit *pos = &list; + list_node *list = NULL; + list_node **pos = &list; while (first && second) { if (func (first->data, second->data) > 0) { *pos = second; @@ -72,51 +84,89 @@ return list; } -static inline digit -combine_digits (digit *digits, digit list, int n_digits, GCompareFunc func) +/* Pre-condition: upto <= si->n_ranks, list == NULL || length(list) == 1 */ +static inline list_node * +sweep_up (struct sort_info *si, list_node *list, int upto) { int i; - for (i = 0; i < n_digits; ++i) - list = add_digits (digits [i], list, func); + for (i = si->min_rank; i < upto; ++i) { + list = merge_lists (si->ranks [i], list, si->func); + si->ranks [i] = NULL; + } return list; } /* - * Given: length(list) == k - * Invariant: digit[i] == NULL || length(digit[i]) == k * 2**i + * The 'ranks' array essentially captures the recursion stack of a mergesort. + * The merge tree is built in a bottom-up manner. The control loop for + * updating the 'ranks' array is analogous to incrementing a binary integer, + * and the O(n) time for counting upto n translates to O(n) merges when + * inserting rank-0 lists. When we plug in the sizes of the lists involved in + * those merges, we get the O(n log n) time for the sort. + * + * Inserting higher-ranked lists reduce the height of the merge tree, and also + * eliminate a lot of redundant comparisons when merging two lists that would've + * been part of the same run. Adding a rank-i list is analogous to incrementing + * a binary integer by 2**i in one operation, thus sharing a similar speedup. + * + * When inserting higher-ranked lists, we choose to clear out the lower ranks + * in the interests of keeping the sort stable, but this makes analysis harder. + * Note that clearing the lower-ranked lists is O(length(list))-- thus it + * shouldn't affect the O(n log n) behaviour. IOW, inserting one rank-i list + * is equivalent to inserting 2**i rank-0 lists, thus even if we do i additional + * merges in the clearing-out (taking at most 2**i time) we are still fine. */ -static inline int -increment (digit *digits, digit list, int n_digits, GCompareFunc func) + +#define stringify2(x) #x +#define stringify(x) stringify2(x) + +/* Pre-condition: 2**(rank+1) <= length(list) < 2**(rank+2) (therefore: length(list) >= 2) */ +static inline void +insert_list (struct sort_info *si, list_node* list, int rank) { int i; - for (i = 0; i < n_digits && digits [i]; i++) { - list = add_digits (digits [i], list, func); - digits [i] = NULL; + + if (rank > si->n_ranks) { + if (rank > MAX_RANKS) { + g_warning ("Rank '%d' should not exceed " stringify (MAX_RANKS), rank); + rank = MAX_RANKS; + } + list = merge_lists (sweep_up (si, NULL, si->n_ranks), list, si->func); + for (i = si->n_ranks; i < rank; ++i) + si->ranks [i] = NULL; + } else { + if (rank) + list = merge_lists (sweep_up (si, NULL, rank), list, si->func); + for (i = rank; i < si->n_ranks && si->ranks [i]; ++i) { + list = merge_lists (si->ranks [i], list, si->func); + si->ranks [i] = NULL; + } } - if (i == MAX_DIGITS) /* Will _never_ happen: so we can just devolve into quadratic ;-) */ + + if (i == MAX_RANKS) /* Will _never_ happen: so we can just devolve into quadratic ;-) */ --i; - - if (i == n_digits) - ++n_digits; - digits [i] = list; - return n_digits; + if (i >= si->n_ranks) + si->n_ranks = i + 1; + si->min_rank = i; + si->ranks [i] = list; } -/* - * A mergesort that avoids recursion. The 'digits' array essentially - * captures the recursion stack. The actual merge tree is built in a - * bottom-up manner. It's "counting", since we "increment" a set of - * "digit"s. - */ +#undef stringify2 +#undef stringify +#undef MAX_RANKS +#undef FLOOR_LOG2 + +/* A non-recursive mergesort */ static inline digit -do_sort (digit list, GCompareFunc func) +do_sort (list_node* list, GCompareFunc func) { - int n_digits = 0; - digit digits [MAX_DIGITS]; /* ~ 128 bytes on 32bit, ~ 512 bytes on 64bit */ + struct sort_info si; + init_sort_info (&si, func); + while (list && list->next) { - digit next = list->next; - digit tail = next->next; + list_node* next = list->next; + list_node* tail = next->next; if (func (list->data, next->data) > 0) { next->next = list; @@ -125,13 +175,10 @@ } next->next = NULL; - n_digits = increment (digits, list, n_digits, func); + insert_list (&si, list, 0); list = tail; } - return combine_digits (digits, list, n_digits, func); + return sweep_up (&si, list, si.n_ranks); } - -#undef MAX_DIGITS -#undef FLOOR_LOG2 Modified: branches/vargaz/mini-linear-il/mono/mono/arch/ChangeLog =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/arch/ChangeLog 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/arch/ChangeLog 2008-02-18 16:19:48 UTC (rev 96068) @@ -1,3 +1,7 @@ +2008-02-14 Zoltan Varga <[EMAIL PROTECTED]> + + * amd64/amd64-codegen.h (amd64_alu_membase8_imm_size): New codegen macro. + 2008-02-08 Zoltan Varga <[EMAIL PROTECTED]> * arm/arm-codegen.h: Fix the ordering of arguments for some load/store opcodes Modified: branches/vargaz/mini-linear-il/mono/mono/metadata/ChangeLog =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/metadata/ChangeLog 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/metadata/ChangeLog 2008-02-18 16:19:48 UTC (rev 96068) @@ -1,3 +1,8 @@ +2008-02-17 Raja R Harinath <[EMAIL PROTECTED]> + + * loader.c (mono_method_get_param_names): Initialize 'klass' after + 'method' is updated. + 2008-02-11 Zoltan Varga <[EMAIL PROTECTED]> * class.c (mono_class_layout_fields): Set class->min_align for classes using Modified: branches/vargaz/mini-linear-il/mono/mono/metadata/loader.c =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/metadata/loader.c 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/metadata/loader.c 2008-02-18 16:19:48 UTC (rev 96068) @@ -1556,19 +1556,20 @@ mono_method_get_param_names (MonoMethod *method, const char **names) { int i, lastp; - MonoClass *klass = method->klass; + MonoClass *klass; MonoTableInfo *methodt; MonoTableInfo *paramt; guint32 idx; + if (method->is_inflated) + method = ((MonoMethodInflated *) method)->declaring; + if (!mono_method_signature (method)->param_count) return; for (i = 0; i < mono_method_signature (method)->param_count; ++i) names [i] = ""; - if (method->is_inflated) - method = ((MonoMethodInflated *) method)->declaring; - + klass = method->klass; if (klass->rank) return; Modified: branches/vargaz/mini-linear-il/mono/mono/mini/ChangeLog =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/ChangeLog 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/ChangeLog 2008-02-18 16:19:48 UTC (rev 96068) @@ -28,6 +28,64 @@ * mini-amd64.c (mono_arch_emit_outarg_vt): Pass a reasonable alignment to mini_emit_memcpy2 (). +2008-02-17 Zoltan Varga <[EMAIL PROTECTED]> + + * mini-ia64.c: Use cfg->vret_addr instead of cfg->ret. + + * mini-arm.h mini-arm.c: Use cfg->vret_addr instead of cfg->ret. + + * mini-sparc.c: Use cfg->vret_addr instead of cfg->ret. Name the MonoCompile + variables 'cfg' instead of 'm' for consistency. + + * mini-x86.c: Use cfg->vret_addr instead of cfg->ret. + + * mini.h (MonoCompile): Add new 'vret_addr' field which represents the hidden + argument holding the vtype return address, to avoid the ambigious use of + cfg->ret for this purpose. + + * mini.c (NEW_RETLOADA): Use vret_addr if set. + + * mini-amd64.c: Use cfg->vret_addr instead of cfg->ret. + + * mini-codegen.c (mono_print_ins): Rename to mono_print_ins_index (), Add a + new mono_print_ins () function which only takes one argument. + +2008-02-15 Zoltan Varga <[EMAIL PROTECTED]> + + * mini-s390.h (MONO_OUTPUT_VTR): Use cfg instead of s, avoid assignments to + macro arguments. + +2008-02-14 Zoltan Varga <[EMAIL PROTECTED]> + + * mini-ops.h: Get rid of OP_SPARC_LOCALLOC_IMM. + + * mini-sparc.c inssel-sparc.brg: Use OP_LOCALLOC_IMM instead of OP_SPARC_LOCALLOC_IMM. + + * mini-x86.c: Sync with the version on the linear IR branch by adding new + opcodes and other small changes. + + * mini-ops.h: Add some new opcodes from the linear IR branch. + + * mini-ops.h: Get rid of the OP_X86_..._MEMBASE opcodes. + + * mini-x86.c inssel-x86.brg cpu-x86.md: Get rid of the confusing _MEMBASE + opcodes, use the REG_MEMBASE opcodes instead. + + * mini-amd64.c inssel-amd64.brg cpu-amd64.md: Get rid of the confusing _MEMBASE + opcodes, use the REG_MEMBASE opcodes instead. + + * mini-amd64.c (mono_arch_output_basic_block): Sync with the version on the + linear IR branch. + + * mini.c (mono_op_imm_to_op): New helper function. + + * mini-ops.h: Add some opcodes from linear IR branch. + +2008-02-13 Zoltan Varga <[EMAIL PROTECTED]> + + * mini-alpha.h mini-alpha.c tramp-alpha.c: Alpha port updates from Sergey Tikhonov + <[EMAIL PROTECTED]>. + 2008-02-12 Zoltan Varga <[EMAIL PROTECTED]> * mini.c (mono_normalize_opcodes): Always convert CEE_CONV_R4/R8 to Modified: branches/vargaz/mini-linear-il/mono/mono/mini/cpu-amd64.md =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/cpu-amd64.md 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/cpu-amd64.md 2008-02-18 16:19:48 UTC (rev 96068) @@ -281,9 +281,14 @@ x86_fp_load_i8: dest:f src1:b len:8 x86_fp_load_i4: dest:f src1:b len:8 x86_seteq_membase: src1:b len:9 -x86_add_membase: dest:i src1:i src2:b clob:1 len:13 -x86_sub_membase: dest:i src1:i src2:b clob:1 len:13 -x86_mul_membase: dest:i src1:i src2:b clob:1 len:14 + +x86_add_reg_membase: dest:i src1:i src2:b clob:1 len:13 +x86_sub_reg_membase: dest:i src1:i src2:b clob:1 len:13 +x86_mul_reg_membase: dest:i src1:i src2:b clob:1 len:13 +x86_and_reg_membase: dest:i src1:i src2:b clob:1 len:13 +x86_or_reg_membase: dest:i src1:i src2:b clob:1 len:13 +x86_xor_reg_membase: dest:i src1:i src2:b clob:1 len:13 + amd64_test_null: src1:i len:5 amd64_icompare_membase_reg: src1:b src2:i len:8 amd64_icompare_membase_imm: src1:b len:13 @@ -389,12 +394,6 @@ long_clt: dest:c len:64 long_clt_un: dest:c len:64 -x86_add_reg_membase: dest:i src1:i src2:b clob:1 len:13 -x86_sub_reg_membase: dest:i src1:i src2:b clob:1 len:13 -x86_and_reg_membase: dest:i src1:i src2:b clob:1 len:13 -x86_or_reg_membase: dest:i src1:i src2:b clob:1 len:13 -x86_xor_reg_membase: dest:i src1:i src2:b clob:1 len:13 - int_conv_to_i1: dest:i src1:i len:4 int_conv_to_i2: dest:i src1:i len:4 int_conv_to_i4: dest:i src1:i len:3 @@ -464,8 +463,6 @@ amd64_or_reg_membase: dest:i src1:i src2:b clob:1 len:14 amd64_xor_reg_membase: dest:i src1:i src2:b clob:1 len:14 -amd64_add_membase_imm: src1:b len:13 -amd64_sub_membase_imm: src1:b len:13 amd64_and_membase_imm: src1:b len:13 amd64_or_membase_imm: src1:b len:13 amd64_xor_membase_imm: src1:b len:13 @@ -488,6 +485,8 @@ amd64_xor_membase_reg: src1:b src2:i len:13 amd64_mul_membase_reg: src1:b src2:i len:15 +amd64_add_membase_imm: src1:b len:16 + float_conv_to_r4: dest:f src1:f vcall2: len:64 clob:c Modified: branches/vargaz/mini-linear-il/mono/mono/mini/cpu-sparc.md =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/cpu-sparc.md 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/cpu-sparc.md 2008-02-18 16:19:48 UTC (rev 96068) @@ -68,7 +68,7 @@ clt: dest:i len:64 clt.un: dest:i len:64 localloc: dest:i src1:i len:64 -sparc_localloc_imm: dest:i len:64 +localloc_imm: dest:i len:64 compare: src1:i src2:i len:4 icompare: src1:i src2:i len:4 compare_imm: src1:i len:64 Modified: branches/vargaz/mini-linear-il/mono/mono/mini/inssel-amd64.brg =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/inssel-amd64.brg 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/inssel-amd64.brg 2008-02-18 16:19:48 UTC (rev 96068) @@ -606,19 +606,19 @@ reg: CEE_ADD(reg, CEE_LDIND_I4 (base)) { MonoInst *base = state->right->left->tree; - MONO_EMIT_BIALU_MEMBASE (cfg, tree, OP_X86_ADD_MEMBASE, state->reg1, state->left->reg1, base->inst_basereg, base->inst_offset); + MONO_EMIT_BIALU_MEMBASE (cfg, tree, OP_X86_ADD_REG_MEMBASE, state->reg1, state->left->reg1, base->inst_basereg, base->inst_offset); } reg: CEE_SUB(reg, CEE_LDIND_I4 (base)) { MonoInst *base = state->right->left->tree; - MONO_EMIT_BIALU_MEMBASE (cfg, tree, OP_X86_SUB_MEMBASE, state->reg1, state->left->reg1, base->inst_basereg, base->inst_offset); + MONO_EMIT_BIALU_MEMBASE (cfg, tree, OP_X86_SUB_REG_MEMBASE, state->reg1, state->left->reg1, base->inst_basereg, base->inst_offset); } reg: CEE_MUL(reg, CEE_LDIND_I4 (base)) { MonoInst *base = state->right->left->tree; - MONO_EMIT_BIALU_MEMBASE (cfg, tree, OP_X86_MUL_MEMBASE, state->reg1, state->left->reg1, base->inst_basereg, base->inst_offset); + MONO_EMIT_BIALU_MEMBASE (cfg, tree, OP_X86_MUL_REG_MEMBASE, state->reg1, state->left->reg1, base->inst_basereg, base->inst_offset); } reg: OP_LSHL (reg, reg), Modified: branches/vargaz/mini-linear-il/mono/mono/mini/inssel-sparc.brg =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/inssel-sparc.brg 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/inssel-sparc.brg 2008-02-18 16:19:48 UTC (rev 96068) @@ -663,8 +663,8 @@ } reg: OP_LOCALLOC (OP_ICONST) { - tree->opcode = OP_SPARC_LOCALLOC_IMM; - tree->inst_c0 = state->left->tree->inst_c0; + tree->opcode = OP_LOCALLOC_IMM; + tree->inst_imm = state->left->tree->inst_c0; tree->dreg = state->reg1; mono_bblock_add_inst (s->cbb, tree); } Modified: branches/vargaz/mini-linear-il/mono/mono/mini/inssel-x86.brg =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/inssel-x86.brg 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/inssel-x86.brg 2008-02-18 16:19:48 UTC (rev 96068) @@ -659,7 +659,7 @@ tree->sreg1 = state->left->reg1; tree->sreg2 = base->inst_basereg; tree->inst_offset = base->inst_offset; - tree->opcode = OP_X86_ADD_MEMBASE; + tree->opcode = OP_X86_ADD_REG_MEMBASE; mono_bblock_add_inst (s->cbb, tree); } @@ -670,7 +670,7 @@ tree->sreg1 = state->left->reg1; tree->sreg2 = base->inst_basereg; tree->inst_offset = base->inst_offset; - tree->opcode = OP_X86_SUB_MEMBASE; + tree->opcode = OP_X86_SUB_REG_MEMBASE; mono_bblock_add_inst (s->cbb, tree); } @@ -681,7 +681,7 @@ tree->sreg1 = state->left->reg1; tree->sreg2 = base->inst_basereg; tree->inst_offset = base->inst_offset; - tree->opcode = OP_X86_MUL_MEMBASE; + tree->opcode = OP_X86_MUL_REG_MEMBASE; mono_bblock_add_inst (s->cbb, tree); } Modified: branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c 2008-02-18 16:19:48 UTC (rev 96068) @@ -355,7 +355,7 @@ */ #define MONO_INST_NEW(cfg,dest,op) do { \ (dest) = mono_mempool_alloc ((cfg)->mempool, sizeof (MonoInst)); \ - (dest)->inst_p0 = (dest)->inst_p1 = (dest)->next = NULL; \ + (dest)->inst_p0 = (dest)->inst_p1 = (dest)->next = (dest)->prev = NULL; \ (dest)->opcode = (op); \ (dest)->flags = 0; \ (dest)->dreg = (dest)->sreg1 = (dest)->sreg2 = -1; \ @@ -10169,92 +10169,6 @@ return -1; } -int -mono_op_imm_to_op (int opcode) -{ - switch (opcode) { - case OP_ADD_IMM: - return OP_PADD; - case OP_IADD_IMM: - return OP_IADD; - case OP_LADD_IMM: - return OP_LADD; - case OP_ISUB_IMM: - return OP_ISUB; - case OP_LSUB_IMM: - return OP_LSUB; - case OP_AND_IMM: -#if SIZEOF_VOID_P == 4 - return OP_IAND; -#else - return OP_LAND; -#endif - case OP_IAND_IMM: - return OP_IAND; - case OP_LAND_IMM: - return OP_LAND; - case OP_IOR_IMM: - return OP_IOR; - case OP_LOR_IMM: - return OP_LOR; - case OP_IXOR_IMM: - return OP_IXOR; - case OP_LXOR_IMM: - return OP_LXOR; - case OP_ISHL_IMM: - return OP_ISHL; - case OP_LSHL_IMM: - return OP_LSHL; - case OP_ISHR_IMM: - return OP_ISHR; - case OP_LSHR_IMM: - return OP_LSHR; - case OP_ISHR_UN_IMM: - return OP_ISHR_UN; - case OP_LSHR_UN_IMM: - return OP_LSHR_UN; - case OP_IDIV_IMM: - return OP_IDIV; - case OP_IDIV_UN_IMM: - return OP_IDIV_UN; - case OP_IREM_UN_IMM: - return OP_IREM_UN; - case OP_IREM_IMM: - return OP_IREM; - case OP_DIV_IMM: -#if SIZEOF_VOID_P == 4 - return OP_IDIV; -#else - return OP_LDIV; -#endif - case OP_REM_IMM: -#if SIZEOF_VOID_P == 4 - return OP_IREM; -#else - return OP_LREM; -#endif - case OP_ADDCC_IMM: - return OP_ADDCC; - case OP_ADC_IMM: - return OP_ADC; - case OP_SUBCC_IMM: - return OP_SUBCC; - case OP_SBB_IMM: - return OP_SBB; - case OP_IADC_IMM: - return OP_IADC; - case OP_ISBB_IMM: - return OP_ISBB; - case OP_COMPARE_IMM: - return OP_COMPARE; - case OP_ICOMPARE_IMM: - return OP_ICOMPARE; - default: - printf ("%s\n", mono_inst_name (opcode)); - g_assert_not_reached (); - } -} - static int ldind_to_load_membase (int opcode) { @@ -11295,7 +11209,7 @@ * arguments, or stores killing loads etc. Also, should we fold loads into other * instructions if the result of the load is used multiple times ? * - make the REM_IMM optimization in mini-x86.c arch-independent. - * - LAST MERGE: 95539 (except 92841). + * - LAST MERGE: 96067 (except 92841). */ /* Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-alpha.c =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/mini-alpha.c 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-alpha.c 2008-02-18 16:19:48 UTC (rev 96068) @@ -91,6 +91,9 @@ gboolean lmf_addr_key_inited = FALSE; +MonoBreakpointInfo +mono_breakpoint_info [MONO_BREAKPOINT_ARRAY_SIZE]; + /*====================== End of Global Variables ===================*/ gpointer mono_arch_get_lmf_addr (void); @@ -191,7 +194,7 @@ } static void -add_valuetype (MonoGenericSharingContext *ctx, MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type, +add_valuetype (MonoGenericSharingContext *gsctx, MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type, gboolean is_return, guint32 *gr, guint32 *fr, guint32 *stack_size) { @@ -435,18 +438,22 @@ /*========================= End of Function ========================*/ +// This peephole function is called before "local_regalloc" method +// TSV_TODO - Check what we need to move here void mono_arch_peephole_pass_1 (MonoCompile *cfg, MonoBasicBlock *bb) { + CFG_DEBUG(3) g_print ("ALPHA: PEEPHOLE_1 pass\n"); } +// This peephole function is called after "local_regalloc" method void mono_arch_peephole_pass_2 (MonoCompile *cfg, MonoBasicBlock *bb) { MonoInst *ins, *last_ins = NULL; ins = bb->code; - CFG_DEBUG(3) g_print ("ALPHA: PEEPHOLE pass\n"); + CFG_DEBUG(3) g_print ("ALPHA: PEEPHOLE_2 pass\n"); while (ins) { @@ -944,8 +951,8 @@ * Converts complex opcodes into simpler ones so that each IR instruction * corresponds to one machine instruction. */ -static void - mono_arch_lowering_pass (MonoCompile *cfg, MonoBasicBlock *bb) +void +mono_arch_lowering_pass (MonoCompile *cfg, MonoBasicBlock *bb) { MonoInst *ins, *temp, *last_ins = NULL; MonoInst *next; @@ -1020,7 +1027,7 @@ ins->sreg2 = temp->dreg; // We should try to reevaluate new IR opcode - continue; + //continue; } next = ins->next; @@ -1039,7 +1046,7 @@ ins->sreg2 = temp->dreg; // We should try to reevaluate new IR opcode - continue; + //continue; } next = ins->next; @@ -5918,9 +5925,39 @@ return 0; } +gpointer +mono_arch_get_this_arg_from_call (MonoMethodSignature *sig, gssize *regs, guint8 *code) +{ + unsigned int *pc = (unsigned int *)code; + ALPHA_PRINT g_debug("ALPHA_CHECK: [mono_arch_get_this_arg_from_call] code: %p regs: %p", + pc, regs); + + if (MONO_TYPE_ISSTRUCT (sig->ret)) + return (gpointer)regs [alpha_a1]; + else + return (gpointer)regs [alpha_a0]; +} + +gpointer +mono_arch_get_delegate_invoke_impl (MonoMethodSignature *sig, gboolean has_target) +{ + unsigned int *code, *start; + MonoDomain *domain = mono_domain_get (); + int i; + + ALPHA_PRINT g_debug("ALPHA_CHECK: [mono_arch_get_delegate_invoke_impl]"); + + /* FIXME: Support more cases */ + if (MONO_TYPE_ISSTRUCT (sig->ret)) + return NULL; + + return NULL; +} + guint32 mono_arch_get_patch_offset (guint8 *code) { return 3; } + Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-alpha.h =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/mini-alpha.h 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-alpha.h 2008-02-18 16:19:48 UTC (rev 96068) @@ -306,5 +306,10 @@ #define MONO_ARCH_HAVE_CREATE_TRAMPOLINE_FROM_TOKEN 1 #define MONO_ARCH_HAVE_CREATE_DELEGATE_TRAMPOLINE 1 +typedef struct { + guint8 *address; + guint8 *saved_byte; +} MonoBreakpointInfo; +extern MonoBreakpointInfo mono_breakpoint_info[MONO_BREAKPOINT_ARRAY_SIZE]; #endif /* __MONO_MINI_ALPHA_H__ */ Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-amd64.c =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/mini-amd64.c 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-amd64.c 2008-02-18 16:19:48 UTC (rev 96068) @@ -996,10 +996,10 @@ sig = mono_method_signature (cfg->method); - mono_arch_compute_omit_fp (cfg); - cinfo = cfg->arch.cinfo; + mono_arch_compute_omit_fp (cfg); + /* * We use the ABI calling conventions for managed code as well. * Exception: valuetypes are never passed or returned in registers. @@ -1040,42 +1040,25 @@ case ArgInIReg: case ArgInFloatSSEReg: case ArgInDoubleSSEReg: - if (MONO_TYPE_ISSTRUCT (sig->ret)) { - if (cfg->new_ir) { - /* - * In the new IR, the cfg->vret_addr variable represents the - * vtype return value. - */ - cfg->vret_addr->opcode = OP_REGOFFSET; - cfg->vret_addr->inst_basereg = cfg->frame_reg; - if (cfg->arch.omit_fp) { - cfg->vret_addr->inst_offset = offset; - offset += 8; - } else { - offset += 8; - cfg->vret_addr->inst_offset = -offset; - } - if (G_UNLIKELY (cfg->verbose_level > 1)) { - printf ("vret_addr ="); - mono_print_ins (cfg->vret_addr); - } + if ((MONO_TYPE_ISSTRUCT (sig->ret) && !mono_class_from_mono_type (sig->ret)->enumtype) || (sig->ret->type == MONO_TYPE_TYPEDBYREF)) { + /* The register is volatile */ + cfg->vret_addr->opcode = OP_REGOFFSET; + cfg->vret_addr->inst_basereg = cfg->frame_reg; + if (cfg->arch.omit_fp) { + cfg->vret_addr->inst_offset = offset; + offset += 8; } else { - /* The register is volatile */ - cfg->ret->opcode = OP_REGOFFSET; - cfg->ret->inst_basereg = cfg->frame_reg; - if (cfg->arch.omit_fp) { - cfg->ret->inst_offset = offset; - offset += 8; - } else { - offset += 8; - cfg->ret->inst_offset = -offset; - } + offset += 8; + cfg->vret_addr->inst_offset = -offset; } + if (G_UNLIKELY (cfg->verbose_level > 1)) { + printf ("vret_addr ="); + mono_print_ins (cfg->vret_addr); + } } else { cfg->ret->opcode = OP_REGVAR; cfg->ret->inst_c0 = cinfo->ret.reg; - cfg->ret->dreg = cfg->ret->inst_c0; } break; case ArgValuetypeInReg: @@ -1089,6 +1072,7 @@ default: g_assert_not_reached (); } + cfg->ret->dreg = cfg->ret->inst_c0; } /* Allocate locals */ @@ -1198,7 +1182,7 @@ if (cinfo->ret.storage == ArgValuetypeInReg) cfg->ret_var_is_local = TRUE; - if (cfg->new_ir && (cinfo->ret.storage != ArgValuetypeInReg) && MONO_TYPE_ISSTRUCT (sig->ret)) { + if ((cinfo->ret.storage != ArgValuetypeInReg) && MONO_TYPE_ISSTRUCT (sig->ret)) { cfg->vret_addr = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_ARG); if (G_UNLIKELY (cfg->verbose_level > 1)) { printf ("vret_addr = "); @@ -2794,15 +2778,8 @@ /* This is the opposite of the code in emit_prolog */ if (sig->ret->type != MONO_TYPE_VOID) { - /* Save volatile arguments to the stack */ - if (cfg->new_ir) { - if (cfg->vret_addr && (cfg->vret_addr->opcode != OP_REGVAR)) - amd64_mov_reg_membase (code, cinfo->ret.reg, cfg->vret_addr->inst_basereg, cfg->vret_addr->inst_offset, 8); - } else { - if ((cinfo->ret.storage == ArgInIReg) && (cfg->ret->opcode != OP_REGVAR)) { - amd64_mov_reg_membase (code, cinfo->ret.reg, cfg->ret->inst_basereg, cfg->ret->inst_offset, 8); - } - } + if (cfg->vret_addr && (cfg->vret_addr->opcode != OP_REGVAR)) + amd64_mov_reg_membase (code, cinfo->ret.reg, cfg->vret_addr->inst_basereg, cfg->vret_addr->inst_offset, 8); } for (i = 0; i < sig->param_count + sig->hasthis; ++i) { @@ -3080,12 +3057,6 @@ amd64_alu_reg_membase_size (code, X86_XOR, ins->sreg1, ins->sreg2, ins->inst_offset, 4); break; - case OP_X86_ADD_MEMBASE: - amd64_alu_reg_membase_size (code, X86_ADD, ins->sreg1, ins->sreg2, ins->inst_offset, 4); - break; - case OP_X86_SUB_MEMBASE: - amd64_alu_reg_membase_size (code, X86_SUB, ins->sreg1, ins->sreg2, ins->inst_offset, 4); - break; case OP_X86_ADD_MEMBASE_IMM: /* FIXME: Make a 64 version too */ amd64_alu_membase_imm_size (code, X86_ADD, ins->inst_basereg, ins->inst_offset, ins->inst_imm, 4); @@ -3133,7 +3104,7 @@ case OP_X86_DEC_REG: amd64_dec_reg_size (code, ins->dreg, 4); break; - case OP_X86_MUL_MEMBASE: + case OP_X86_MUL_REG_MEMBASE: case OP_X86_MUL_MEMBASE_REG: amd64_imul_reg_membase_size (code, ins->sreg1, ins->sreg2, ins->inst_offset, 4); break; @@ -5077,13 +5048,8 @@ if (sig->ret->type != MONO_TYPE_VOID) { /* Save volatile arguments to the stack */ - if (cfg->new_ir) { - if (cfg->vret_addr && (cfg->vret_addr->opcode != OP_REGVAR)) - amd64_mov_membase_reg (code, cfg->vret_addr->inst_basereg, cfg->vret_addr->inst_offset, cinfo->ret.reg, 8); - } else { - if ((cinfo->ret.storage == ArgInIReg) && (cfg->ret->opcode != OP_REGVAR)) - amd64_mov_membase_reg (code, cfg->ret->inst_basereg, cfg->ret->inst_offset, cinfo->ret.reg, 8); - } + if (cfg->vret_addr && (cfg->vret_addr->opcode != OP_REGVAR)) + amd64_mov_membase_reg (code, cfg->vret_addr->inst_basereg, cfg->vret_addr->inst_offset, cinfo->ret.reg, 8); } /* Keep this in sync with emit_load_volatile_arguments */ Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-arm.c =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/mini-arm.c 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-arm.c 2008-02-18 16:19:48 UTC (rev 96068) @@ -900,12 +900,7 @@ offset = 0; curinst = 0; - if (MONO_TYPE_ISSTRUCT (sig->ret)) { - if (!m->new_ir) { - m->ret->opcode = OP_REGVAR; - m->ret->inst_c0 = ARMREG_R0; - } - } else { + if (!MONO_TYPE_ISSTRUCT (sig->ret)) { /* FIXME: handle long and FP values */ switch (mono_type_get_underlying_type (sig->ret)->type) { case MONO_TYPE_VOID: @@ -944,21 +939,13 @@ } if (MONO_TYPE_ISSTRUCT (sig->ret)) { - if (m->new_ir) { - /* - * In the new IR, the cfg->vret_addr variable represents the - * vtype return value. - */ - inst = m->vret_addr; - } else { - inst = m->ret; - } + inst = m->vret_addr; offset += sizeof(gpointer) - 1; offset &= ~(sizeof(gpointer) - 1); inst->inst_offset = offset; inst->opcode = OP_REGOFFSET; inst->inst_basereg = frame_reg; - if (m->new_ir && G_UNLIKELY (m->verbose_level > 1)) { + if (G_UNLIKELY (m->verbose_level > 1)) { printf ("vret_addr ="); mono_print_ins (m->vret_addr); } @@ -1047,14 +1034,13 @@ sig = mono_method_signature (cfg->method); - if (cfg->new_ir && MONO_TYPE_ISSTRUCT (sig->ret)) { + if (MONO_TYPE_ISSTRUCT (sig->ret)) { cfg->vret_addr = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_ARG); if (G_UNLIKELY (cfg->verbose_level > 1)) { printf ("vret_addr = "); mono_print_ins (cfg->vret_addr); } } - } /* @@ -3688,10 +3674,7 @@ if (MONO_TYPE_ISSTRUCT (sig->ret)) { ArgInfo *ainfo = &cinfo->ret; - if (cfg->new_ir) - inst = cfg->vret_addr; - else - inst = cfg->ret; + inst = cfg->vret_addr; g_assert (arm_is_imm12 (inst->inst_offset)); ARM_STR_IMM (code, ainfo->reg, inst->inst_basereg, inst->inst_offset); } Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-arm.h =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/mini-arm.h 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-arm.h 2008-02-18 16:19:48 UTC (rev 96068) @@ -116,6 +116,7 @@ #define MONO_ARCH_COMMON_VTABLE_TRAMPOLINE 1 #define MONO_ARCH_ENABLE_NORMALIZE_OPCODES 1 +#define MONO_ARCH_HAVE_CREATE_VARS 1 #define ARM_NUM_REG_ARGS (ARM_LAST_ARG_REG-ARM_FIRST_ARG_REG+1) #define ARM_NUM_REG_FPARGS 0 Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-codegen.c =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/mini-codegen.c 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-codegen.c 2008-02-18 16:19:48 UTC (rev 96068) @@ -490,12 +490,6 @@ printf ("\n"); } -void -mono_print_ins (MonoInst *ins) -{ - mono_print_ins_index (-1, ins); -} - static void print_regtrack (RegTrack *t, int num) { @@ -514,8 +508,19 @@ printf ("liveness: %s [%d - %d]\n", r, t [i].born_in, t[i].killed_in); } } +#else +void +mono_print_ins_index (int i, MonoInst *ins) +{ +} #endif /* DISABLE_LOGGING */ +void +mono_print_ins (MonoInst *ins) +{ + mono_print_ins_index (-1, ins); +} + typedef struct InstList InstList; struct InstList { Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-ia64.c =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/mini-ia64.c 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-ia64.c 2008-02-18 16:19:48 UTC (rev 96068) @@ -825,13 +825,8 @@ cfg->ret->inst_c0 = cinfo->ret.reg; break; case ArgValuetypeAddrInIReg: - if (cfg->new_ir) { - cfg->vret_addr->opcode = OP_REGVAR; - cfg->vret_addr->dreg = cfg->arch.reg_in0 + cinfo->ret.reg; - } else { - cfg->ret->opcode = OP_REGVAR; - cfg->ret->inst_c0 = cfg->arch.reg_in0 + cinfo->ret.reg; - } + cfg->vret_addr->opcode = OP_REGVAR; + cfg->vret_addr->dreg = cfg->arch.reg_in0 + cinfo->ret.reg; break; case ArgAggregate: /* Allocate a local to hold the result, the epilog will copy it to the correct place */ @@ -975,8 +970,7 @@ if (cinfo->ret.storage == ArgAggregate) cfg->ret_var_is_local = TRUE; - - if (cfg->new_ir && (cinfo->ret.storage == ArgValuetypeAddrInIReg)) { + if (cinfo->ret.storage == ArgValuetypeAddrInIReg) { cfg->vret_addr = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_ARG); if (G_UNLIKELY (cfg->verbose_level > 1)) { printf ("vret_addr = "); Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-ops.h =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/mini-ops.h 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-ops.h 2008-02-18 16:19:48 UTC (rev 96068) @@ -683,9 +683,6 @@ MINI_OP(OP_X86_FP_LOAD_I4, "x86_fp_load_i4", NONE, NONE, NONE) MINI_OP(OP_X86_SETEQ_MEMBASE, "x86_seteq_membase", NONE, IREG, NONE) MINI_OP(OP_X86_SETNE_MEMBASE, "x86_setne_membase", NONE, IREG, NONE) -MINI_OP(OP_X86_ADD_MEMBASE, "x86_add_membase", NONE, IREG, IREG) -MINI_OP(OP_X86_SUB_MEMBASE, "x86_sub_membase", NONE, IREG, IREG) -MINI_OP(OP_X86_MUL_MEMBASE, "x86_mul_membase", NONE, IREG, IREG) MINI_OP(OP_X86_SHRD, "x86_shrd", IREG, IREG, IREG) MINI_OP(OP_X86_FXCH, "x86_fxch", NONE, NONE, NONE) #endif @@ -750,7 +747,6 @@ MINI_OP(OP_SPARC_OUTARG_FLOAT, "sparc_outarg_float", NONE, NONE, NONE) MINI_OP(OP_SPARC_OUTARG_REGPAIR_FLOAT, "sparc_outarg_float", NONE, NONE, NONE) MINI_OP(OP_SPARC_INARG_VT, "sparc_inarg_vt", NONE, NONE, NONE) -MINI_OP(OP_SPARC_LOCALLOC_IMM, "sparc_localloc_imm", NONE, NONE, NONE) MINI_OP(OP_SPARC_SETFREG_FLOAT, "sparc_setfreg_float", NONE, NONE, NONE) MINI_OP(OP_SPARC_BRZ, "sparc_brz", NONE, NONE, NONE) MINI_OP(OP_SPARC_BRLEZ, "sparc_brlez", NONE, NONE, NONE) Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-sparc.c =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/mini-sparc.c 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-sparc.c 2008-02-18 16:19:48 UTC (rev 96068) @@ -828,16 +828,10 @@ #ifdef SPARCV9 g_assert_not_reached (); #else - if (cfg->new_ir) { - cfg->vret_addr->opcode = OP_REGOFFSET; - cfg->vret_addr->inst_basereg = sparc_fp; - cfg->vret_addr->inst_offset = 64; - } else { - /* valuetypes */ - cfg->ret->opcode = OP_REGOFFSET; - cfg->ret->inst_basereg = sparc_fp; - cfg->ret->inst_offset = 64; - } + /* valuetypes */ + cfg->vret_addr->opcode = OP_REGOFFSET; + cfg->vret_addr->inst_basereg = sparc_fp; + cfg->vret_addr->inst_offset = 64; #endif break; default: @@ -3333,10 +3327,8 @@ } break; } - case OP_SPARC_LOCALLOC_IMM: case OP_LOCALLOC_IMM: { - gint32 offset = cfg->new_ir ? ins->inst_imm : ins->inst_c0; - gint32 offset2; + gint32 offset = ins->inst_imm; #ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK /* Perform stack touching */ Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-sparc.h =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/mini-sparc.h 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-sparc.h 2008-02-18 16:19:48 UTC (rev 96068) @@ -128,6 +128,7 @@ #define MONO_ARCH_IMT_REG sparc_g1 #define MONO_ARCH_COMMON_VTABLE_TRAMPOLINE 1 #define MONO_ARCH_ENABLE_NORMALIZE_OPCODES 1 +#define MONO_ARCH_HAVE_CREATE_VARS 1 #ifdef SPARCV9 #define MONO_ARCH_NO_EMULATE_LONG_SHIFT_OPS Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-x86.c =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/mini-x86.c 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-x86.c 2008-02-18 16:19:48 UTC (rev 96068) @@ -862,7 +862,7 @@ switch (cinfo->ret.storage) { case ArgOnStack: - if (cfg->new_ir && MONO_TYPE_ISSTRUCT (sig->ret)) { + if (MONO_TYPE_ISSTRUCT (sig->ret)) { /* * In the new IR, the cfg->vret_addr variable represents the * vtype return value. @@ -928,7 +928,7 @@ if (cinfo->ret.storage == ArgValuetypeInReg) cfg->ret_var_is_local = TRUE; - if (cfg->new_ir && (cinfo->ret.storage != ArgValuetypeInReg) && MONO_TYPE_ISSTRUCT (sig->ret)) { + if ((cinfo->ret.storage != ArgValuetypeInReg) && MONO_TYPE_ISSTRUCT (sig->ret)) { cfg->vret_addr = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_ARG); } } @@ -2573,9 +2573,15 @@ case OP_X86_ADD_MEMBASE_IMM: x86_alu_membase_imm (code, X86_ADD, ins->inst_basereg, ins->inst_offset, ins->inst_imm); break; + case OP_X86_ADD_REG_MEMBASE: + x86_alu_reg_membase (code, X86_ADD, ins->sreg1, ins->sreg2, ins->inst_offset); + break; case OP_X86_SUB_MEMBASE_IMM: x86_alu_membase_imm (code, X86_SUB, ins->inst_basereg, ins->inst_offset, ins->inst_imm); break; + case OP_X86_SUB_REG_MEMBASE: + x86_alu_reg_membase (code, X86_SUB, ins->sreg1, ins->sreg2, ins->inst_offset); + break; case OP_X86_AND_MEMBASE_IMM: x86_alu_membase_imm (code, X86_AND, ins->inst_basereg, ins->inst_offset, ins->inst_imm); break; @@ -2620,8 +2626,8 @@ case OP_X86_DEC_REG: x86_dec_reg (code, ins->dreg); break; - case OP_X86_MUL_MEMBASE: case OP_X86_MUL_REG_MEMBASE: + case OP_X86_MUL_REG_MEMBASE: x86_imul_reg_membase (code, ins->sreg1, ins->sreg2, ins->inst_offset); break; case OP_X86_AND_REG_MEMBASE: @@ -2636,12 +2642,12 @@ case OP_BREAK: x86_breakpoint (code); break; - case OP_NOP: - case OP_DUMMY_USE: - case OP_DUMMY_STORE: - case OP_NOT_REACHED: - case OP_NOT_NULL: - break; + case OP_NOP: + case OP_DUMMY_USE: + case OP_DUMMY_STORE: + case OP_NOT_REACHED: + case OP_NOT_NULL: + break; case OP_ADDCC: case OP_IADDCC: case OP_IADD: @@ -3279,6 +3285,11 @@ case OP_CGT_UN: case OP_ICGT_UN: case OP_CNE: + case OP_ICEQ: + case OP_ICLT: + case OP_ICLT_UN: + case OP_ICGT: + case OP_ICGT_UN: x86_set_reg (code, cc_table [mono_opcode_to_cond (ins->opcode)], ins->dreg, cc_signed_table [mono_opcode_to_cond (ins->opcode)]); x86_widen_reg (code, ins->dreg, ins->dreg, FALSE, FALSE); break; @@ -3620,10 +3631,13 @@ break; case OP_X86_FPOP: x86_fstp (code, 0); - break; + break; case OP_X86_FXCH: x86_fxch (code, ins->inst_imm); break; + case OP_X86_FXCH: + x86_fxch (code, ins->inst_imm); + break; case OP_FREM: { guint8 *l1, *l2; Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini.c =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/mini.c 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/mini.c 2008-02-18 16:19:48 UTC (rev 96068) @@ -579,14 +579,23 @@ } while (0) #define NEW_RETLOADA(cfg,dest) do { \ - (dest) = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoInst)); \ - (dest)->ssa_op = MONO_SSA_ADDRESS_TAKEN; \ - (dest)->inst_i0 = (cfg)->ret; \ - (dest)->inst_i0->flags |= MONO_INST_INDIRECT; \ - (dest)->opcode = cfg->ret_var_is_local ? OP_LDADDR : CEE_LDIND_I; \ - (dest)->type = STACK_MP; \ - (dest)->klass = (dest)->inst_i0->klass; \ - (cfg)->disable_ssa = TRUE; \ + if (cfg->vret_addr) { \ + (dest) = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoInst)); \ + (dest)->ssa_op = MONO_SSA_LOAD; \ + (dest)->inst_i0 = cfg->vret_addr; \ + (dest)->opcode = mini_type_to_ldind ((cfg), (dest)->inst_i0->inst_vtype); \ + (dest)->type = STACK_MP; \ + (dest)->klass = (dest)->inst_i0->klass; \ + } else { \ + (dest) = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoInst)); \ + (dest)->ssa_op = MONO_SSA_ADDRESS_TAKEN; \ + (dest)->inst_i0 = (cfg)->ret; \ + (dest)->inst_i0->flags |= MONO_INST_INDIRECT; \ + (dest)->opcode = cfg->ret_var_is_local ? OP_LDADDR : CEE_LDIND_I; \ + (dest)->type = STACK_MP; \ + (dest)->klass = (dest)->inst_i0->klass; \ + (cfg)->disable_ssa = TRUE; \ + } \ } while (0) #define NEW_ARGLOADA(cfg,dest,num) do { \ @@ -1804,6 +1813,92 @@ return mono_type_to_stind (type); } +int +mono_op_imm_to_op (int opcode) +{ + switch (opcode) { + case OP_ADD_IMM: + return OP_PADD; + case OP_IADD_IMM: + return OP_IADD; + case OP_LADD_IMM: + return OP_LADD; + case OP_ISUB_IMM: + return OP_ISUB; + case OP_LSUB_IMM: + return OP_LSUB; + case OP_AND_IMM: +#if SIZEOF_VOID_P == 4 + return OP_IAND; +#else + return OP_LAND; +#endif + case OP_IAND_IMM: + return OP_IAND; + case OP_LAND_IMM: + return OP_LAND; + case OP_IOR_IMM: + return OP_IOR; + case OP_LOR_IMM: + return OP_LOR; + case OP_IXOR_IMM: + return OP_IXOR; + case OP_LXOR_IMM: + return OP_LXOR; + case OP_ISHL_IMM: + return OP_ISHL; + case OP_LSHL_IMM: + return OP_LSHL; + case OP_ISHR_IMM: + return OP_ISHR; + case OP_LSHR_IMM: + return OP_LSHR; + case OP_ISHR_UN_IMM: + return OP_ISHR_UN; + case OP_LSHR_UN_IMM: + return OP_LSHR_UN; + case OP_IDIV_IMM: + return OP_IDIV; + case OP_IDIV_UN_IMM: + return OP_IDIV_UN; + case OP_IREM_UN_IMM: + return OP_IREM_UN; + case OP_IREM_IMM: + return OP_IREM; + case OP_DIV_IMM: +#if SIZEOF_VOID_P == 4 + return OP_IDIV; +#else + return OP_LDIV; +#endif + case OP_REM_IMM: +#if SIZEOF_VOID_P == 4 + return OP_IREM; +#else + return OP_LREM; +#endif + case OP_ADDCC_IMM: + return OP_ADDCC; + case OP_ADC_IMM: + return OP_ADC; + case OP_SUBCC_IMM: + return OP_SUBCC; + case OP_SBB_IMM: + return OP_SBB; + case OP_IADC_IMM: + return OP_IADC; + case OP_ISBB_IMM: + return OP_ISBB; + case OP_COMPARE_IMM: + return OP_COMPARE; + case OP_ICOMPARE_IMM: + return OP_ICOMPARE; + default: + printf ("%s\n", mono_inst_name (opcode)); + g_assert_not_reached (); + } +} + /* * When we need a pointer to the current domain many times in a method, we * call mono_domain_get() once and we store the result in a local variable. @@ -5988,7 +6083,7 @@ if (ins->opcode == CEE_STOBJ) { NEW_RETLOADA (cfg, ins); /* FIXME: it is possible some optimization will pass the a heap pointer for the struct address, so we'll need the write barrier */ - handle_stobj (cfg, bblock, ins, *sp, ip, ins->klass, FALSE, FALSE, FALSE); + handle_stobj (cfg, bblock, ins, *sp, ip, cfg->ret->klass, FALSE, FALSE, FALSE); } else { ins->opcode = OP_SETRET; ins->cil_code = ip; Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini.h =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/mini.h 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/mini.h 2008-02-18 16:19:48 UTC (rev 96068) @@ -111,6 +111,7 @@ #define MONO_ADD_INS(b,inst) do { \ if ((b)->last_ins) { \ (b)->last_ins->next = (inst); \ + (inst)->prev = (b)->last_ins; \ (b)->last_ins = (inst); \ } else { \ (b)->code = (b)->last_ins = (inst); \ @@ -336,7 +337,7 @@ /* used by the register allocator */ gint32 dreg, sreg1, sreg2; - MonoInst *next; + MonoInst *next, *prev; union { union { @@ -645,10 +646,9 @@ MonoInst **args; /* - * In the new IR, this variable represents the hidden argument holding the vtype + * This variable represents the hidden argument holding the vtype * return address. If the method returns something other than a vtype, or - * the vtype is returned in registers (cfg->ret_var_is_local in the old JIT), - * this is NULL. + * the vtype is returned in registers this is NULL. */ MonoInst *vret_addr; @@ -1090,7 +1090,9 @@ int mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options) MONO_INTERNAL; MonoCompile *mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, gboolean run_cctors, gboolean compile_aot, int parts) MONO_INTERNAL; void mono_destroy_compile (MonoCompile *cfg) MONO_INTERNAL; -MonoJitICallInfo *mono_find_jit_opcode_emulation (int opcode) MONO_INTERNAL; +MonoJitICallInfo *mono_find_jit_opcode_emulation (int opcode) MONO_INTERNAL; +void mono_print_ins_index (int i, MonoInst *ins) MONO_INTERNAL; +void mono_print_ins (MonoInst *ins) MONO_INTERNAL; gboolean mini_class_is_system_array (MonoClass *klass); MonoMethodSignature *mono_get_element_address_signature (int arity); @@ -1171,6 +1173,7 @@ CompRelation mono_opcode_to_cond (int opcode) MONO_INTERNAL; CompType mono_opcode_to_type (int opcode, int cmp_opcode) MONO_INTERNAL; CompRelation mono_negate_cond (CompRelation cond) MONO_INTERNAL; +int mono_op_imm_to_op (int opcode) MONO_INTERNAL; void mono_decompose_long_opts (MonoCompile *cfg) MONO_INTERNAL; void mono_decompose_vtype_opts (MonoCompile *cfg) MONO_INTERNAL; Modified: branches/vargaz/mini-linear-il/mono/mono/mini/tramp-alpha.c =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/mini/tramp-alpha.c 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/mini/tramp-alpha.c 2008-02-18 16:19:48 UTC (rev 96068) @@ -181,7 +181,7 @@ } // alpha_at points to start of this method !!! - alpha_ldq(code, alpha_r0, alpha_at, off); + alpha_ldq(code, alpha_pv, alpha_at, off); alpha_br(code, alpha_zero, 2); *code = (unsigned int)(((unsigned long)mono_get_lmf_addr) & 0xFFFFFFFF); @@ -193,7 +193,7 @@ * The call might clobber argument registers, but they are already * saved to the stack/global regs. */ - alpha_jsr(code, alpha_ra, alpha_r0, 0); + alpha_jsr(code, alpha_ra, alpha_pv, 0); // Save lmf_addr alpha_stq(code, alpha_r0, alpha_sp, Modified: branches/vargaz/mini-linear-il/mono/mono/tests/ChangeLog =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/tests/ChangeLog 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/tests/ChangeLog 2008-02-18 16:19:48 UTC (rev 96068) @@ -1,3 +1,7 @@ +2008-02-17 Raja R Harinath <[EMAIL PROTECTED]> + + * Makefile.am (SMCS): Add temporary-smcs-hack flag. + 2008-02-04 Massimiliano Mantione <[EMAIL PROTECTED]> * Makefile.am: Re-enabled bug-77127.exe (was fixed in r95036). Modified: branches/vargaz/mini-linear-il/mono/mono/tests/Makefile.am =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/tests/Makefile.am 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/tests/Makefile.am 2008-02-18 16:19:48 UTC (rev 96068) @@ -24,7 +24,7 @@ MCS = $(RUNTIME) $(mcs_topdir)/class/lib/default/mcs.exe -unsafe -nowarn:0162 -nowarn:0168 -nowarn:0219 GMCS = $(RUNTIME2) $(mcs_topdir)/class/lib/net_2_0/gmcs.exe -unsafe -nowarn:0162 -nowarn:0168 -nowarn:0219 -SMCS = $(RUNTIME21) $(mcs_topdir)/class/lib/net_2_1/smcs.exe -unsafe -nowarn:0162 -nowarn:0168 -nowarn:0219 +SMCS = $(RUNTIME21) --security=temporary-smcs-hack $(mcs_topdir)/class/lib/net_2_1/smcs.exe -unsafe -nowarn:0162 -nowarn:0168 -nowarn:0219 ILASM = $(RUNTIME) $(mcs_topdir)/class/lib/default/ilasm.exe ILASM2 = $(RUNTIME2) $(mcs_topdir)/class/lib/net_2_0/ilasm.exe @@ -387,9 +387,9 @@ endif endif -if INSTALL_2_1 -test : test-coreclr-security -endif +#if INSTALL_2_1 +#test : test-coreclr-security +#endif assemblyresolve/test/asm.dll: $(MAKE) -C assemblyresolve prereq Modified: branches/vargaz/mini-linear-il/mono/mono/utils/ChangeLog =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/utils/ChangeLog 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/utils/ChangeLog 2008-02-18 16:19:48 UTC (rev 96068) @@ -1,3 +1,8 @@ +2008-02-13 Zoltan Varga <[EMAIL PROTECTED]> + + * mono-membar.h (mono_memory_barrier): Applied patch by Sergey Tikhonov + <[EMAIL PROTECTED]>. Add alpha support. + 2008-01-11 Zoltan Varga <[EMAIL PROTECTED]> * mono-io-portability.c: Include errno.h since it is needed by code inside Modified: branches/vargaz/mini-linear-il/mono/mono/utils/mono-membar.h =================================================================== --- branches/vargaz/mini-linear-il/mono/mono/utils/mono-membar.h 2008-02-18 15:42:36 UTC (rev 96067) +++ branches/vargaz/mini-linear-il/mono/mono/utils/mono-membar.h 2008-02-18 16:19:48 UTC (rev 96068) @@ -135,6 +135,21 @@ { mono_memory_barrier (); } +#elif defined(__alpha__) +static inline void mono_memory_barrier (void) +{ + __asm__ __volatile__ ("mb" : : : "memory"); +} + +static inline void mono_memory_read_barrier (void) +{ + mono_memory_barrier (); +} + +static inline void mono_memory_write_barrier (void) +{ + mono_memory_barrier (); +} #endif #endif /* _MONO_UTILS_MONO_MEMBAR_H_ */ _______________________________________________ Mono-patches maillist - Mono-patches@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-patches