Author: zoltan
Date: 2005-12-19 09:39:44 -0500 (Mon, 19 Dec 2005)
New Revision: 54602
Modified:
branches/vargaz/mini-linear-il/mono/mono/mini/cpu-pentium.md
branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c
branches/vargaz/mini-linear-il/mono/mono/mini/mini-codegen.c
branches/vargaz/mini-linear-il/mono/mono/mini/mini-ops.h
branches/vargaz/mini-linear-il/mono/mono/mini/mini-x86.c
Log:
Ongoing work
Modified: branches/vargaz/mini-linear-il/mono/mono/mini/cpu-pentium.md
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/cpu-pentium.md
2005-12-19 14:27:01 UTC (rev 54601)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/cpu-pentium.md
2005-12-19 14:39:44 UTC (rev 54602)
@@ -318,6 +318,7 @@
long_conv_to_ovf_i4_2: dest:i src1:i src2:i len:30
long_mul_ovf:
long_conv_to_r8_2: dest:f src1:i src2:i len:37
+long_conv_to_r4_2: dest:f src1:i src2:i len:64
long_conv_to_r_un: dest:f src1:i src2:i len:37
long_conv_to_r_un_2: dest:f src1:i src2:i len:37
long_shr_imm: dest:L src1:L clob:1 len:10
@@ -364,6 +365,7 @@
float_conv_to_u: dest:i src1:f len:36
call_handler: len:10
aot_const: dest:i len:5
+op_jump_table: dest:i len:5
load_gotaddr: dest:i len:64
got_entry: dest:i src1:b len:7
x86_test_null: src1:i len:2
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
2005-12-19 14:27:01 UTC (rev 54601)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/method-to-ir.c
2005-12-19 14:39:44 UTC (rev 54602)
@@ -577,6 +577,8 @@
#define EMIT_NEW_ARGLOADA(cfg,dest,num) do { NEW_ARGLOADA ((cfg), (dest),
(num)); MONO_ADD_INS ((cfg)->cbb, (dest)); } while (0)
+#define EMIT_NEW_RETLOADA(cfg,dest) do { NEW_RETLOADA ((cfg), (dest));
MONO_ADD_INS ((cfg)->cbb, (dest)); } while (0)
+
#define EMIT_NEW_UNALU(cfg,dest,op,dr,sr1) do { \
MONO_INST_NEW ((cfg), (dest), (op)); \
(dest)->opcode = op; \
@@ -2923,7 +2925,7 @@
}
}
- mono_bblock_add_inst (cfg->cbb, object_is_null);
+ MONO_ADD_INS (cfg->cbb, object_is_null);
return src;
}
@@ -3048,13 +3050,13 @@
}
}
- mono_bblock_add_inst (cfg->cbb, false_label);
+ MONO_ADD_INS (cfg->cbb, false_label);
MONO_EMIT_NEW_ICONST (cfg, res_reg, 0);
MONO_EMIT_NEW_BRANCH_LABEL (cfg, CEE_BR, end_label);
- mono_bblock_add_inst (cfg->cbb, object_is_null);
+ MONO_ADD_INS (cfg->cbb, object_is_null);
EMIT_NEW_UNALU (cfg, ins, OP_MOVE, res_reg, obj_reg);
ins->type = STACK_OBJ;
- mono_bblock_add_inst (cfg->cbb, end_label);
+ MONO_ADD_INS (cfg->cbb, end_label);
return ins;
}
@@ -3087,7 +3089,7 @@
MONO_EMIT_NEW_LOAD_MEMBASE (cfg, tmp_reg, obj_reg,
G_STRUCT_OFFSET (MonoObject, vtable));
mini_emit_isninst_iface_cast (cfg, tmp_reg, klass,
interface_fail_label, true_label);
- mono_bblock_add_inst (cfg->cbb, interface_fail_label);
+ MONO_ADD_INS (cfg->cbb, interface_fail_label);
MONO_EMIT_NEW_LOAD_MEMBASE (cfg, klass_reg, tmp_reg,
G_STRUCT_OFFSET (MonoVTable, klass));
if (cfg->compile_aot) {
@@ -3127,19 +3129,19 @@
mini_emit_isninst_cast (cfg, klass_reg, klass, false2_label,
true_label);
MONO_EMIT_NEW_BRANCH_LABEL (cfg, CEE_BR, false2_label);
- mono_bblock_add_inst (cfg->cbb, no_proxy_label);
+ MONO_ADD_INS (cfg->cbb, no_proxy_label);
mini_emit_isninst_cast (cfg, klass_reg, klass, false_label,
true_label);
}
- mono_bblock_add_inst (cfg->cbb, false_label);
+ MONO_ADD_INS (cfg->cbb, false_label);
MONO_EMIT_NEW_ICONST (cfg, dreg, 1);
MONO_EMIT_NEW_BRANCH_LABEL (cfg, CEE_BR, end_label);
- mono_bblock_add_inst (cfg->cbb, false2_label);
+ MONO_ADD_INS (cfg->cbb, false2_label);
MONO_EMIT_NEW_ICONST (cfg, dreg, 2);
MONO_EMIT_NEW_BRANCH_LABEL (cfg, CEE_BR, end_label);
- mono_bblock_add_inst (cfg->cbb, true_label);
+ MONO_ADD_INS (cfg->cbb, true_label);
MONO_EMIT_NEW_ICONST (cfg, dreg, 0);
- mono_bblock_add_inst (cfg->cbb, end_label);
+ MONO_ADD_INS (cfg->cbb, end_label);
/* FIXME: */
MONO_INST_NEW (cfg, ins, OP_ICONST);
@@ -3176,7 +3178,7 @@
MONO_EMIT_NEW_LOAD_MEMBASE (cfg, tmp_reg, obj_reg,
G_STRUCT_OFFSET (MonoObject, vtable));
mini_emit_isninst_iface_cast (cfg, tmp_reg, klass, fail_label,
ok_result_label);
- mono_bblock_add_inst (cfg->cbb, fail_label);
+ MONO_ADD_INS (cfg->cbb, fail_label);
MONO_EMIT_NEW_LOAD_MEMBASE (cfg, klass_reg, tmp_reg,
G_STRUCT_OFFSET (MonoVTable, klass));
if (cfg->compile_aot) {
@@ -3224,17 +3226,17 @@
MONO_EMIT_NEW_BRANCH_LABEL (cfg, CEE_BEQ, no_proxy_label);
mini_emit_isninst_cast (cfg, klass_reg, klass, fail_label,
ok_result_label);
- mono_bblock_add_inst (cfg->cbb, fail_label);
+ MONO_ADD_INS (cfg->cbb, fail_label);
MONO_EMIT_NEW_ICONST (cfg, dreg, 1);
MONO_EMIT_NEW_BRANCH_LABEL (cfg, CEE_BR, end_label);
- mono_bblock_add_inst (cfg->cbb, no_proxy_label);
+ MONO_ADD_INS (cfg->cbb, no_proxy_label);
mini_emit_castclass (cfg, klass_reg, klass);
}
- mono_bblock_add_inst (cfg->cbb, ok_result_label);
+ MONO_ADD_INS (cfg->cbb, ok_result_label);
MONO_EMIT_NEW_ICONST (cfg, dreg, 0);
- mono_bblock_add_inst (cfg->cbb, end_label);
+ MONO_ADD_INS (cfg->cbb, end_label);
/* FIXME: */
MONO_INST_NEW (cfg, ins, OP_ICONST);
@@ -4280,6 +4282,9 @@
case OP_LCONV_TO_R8:
MONO_EMIT_NEW_BIALU (cfg, OP_LCONV_TO_R8_2,
tree->dreg, tree->sreg1, tree->sreg1 + 1);
break;
+ case OP_LCONV_TO_R4:
+ MONO_EMIT_NEW_BIALU (cfg, OP_LCONV_TO_R4_2,
tree->dreg, tree->sreg1, tree->sreg1 + 1);
+ break;
case OP_LCONV_TO_R_UN:
MONO_EMIT_NEW_BIALU (cfg, OP_LCONV_TO_R_UN_2,
tree->dreg, tree->sreg1, tree->sreg1 + 1);
break;
@@ -4381,6 +4386,7 @@
MONO_EMIT_NEW_BIALU_IMM (cfg, OP_AND_IMM,
tree->dreg, tree->sreg1, 0xffff);
break;
case OP_LCONV_TO_OVF_I4:
+ case OP_LCONV_TO_OVF_I:
case OP_LCONV_TO_OVF_I4_UN:
/* FIXME: Is the I4_UN variant correct ? */
MONO_EMIT_NEW_BIALU (cfg, OP_LCONV_TO_OVF_I4_2,
tree->dreg, tree->sreg1, tree->sreg1 + 1);
@@ -5796,8 +5802,7 @@
MONO_INST_NEW (cfg, ins, CEE_NOP);
ins->opcode = mono_type_to_stind
(mono_method_signature (method)->ret);
if (ins->opcode == CEE_STOBJ) {
- NEW_RETLOADA (cfg, ins);
- MONO_ADD_INS (cfg->cbb, ins);
+ EMIT_NEW_RETLOADA (cfg, ins);
/*
* cfg->ret is a scalar
variable, so can't use its
* class field.
@@ -7746,6 +7751,10 @@
ip += 2;
break;
case CEE_MONO_LDNATIVEOBJ:
+ /*
+ * Similar to LDOBJ, but instead load the
unmanaged
+ * representation of the vtype to the stack.
+ */
CHECK_STACK (1);
CHECK_OPSIZE (6);
--sp;
@@ -7754,12 +7763,23 @@
g_assert (klass->valuetype);
mono_class_init (klass);
- ins = emit_ldobj (cfg, sp [0], ip, klass);
+ /*
+ * In theory, we should load the value to the
stack, but that
+ * would involve creating a variable whose type
is the native
+ * vtype, and this is a bit hard to do. So
instead we
+ * simulate the load by loading the original
address.
+ */
+ ins = sp [0];
+ ins->type = STACK_VTYPE;
+ ins->klass = klass;
*sp++ = ins;
ip += 6;
break;
-#if 0
case CEE_MONO_RETOBJ:
+ /*
+ * Same as RET, but return the native
representation of a vtype
+ * to the caller.
+ */
g_assert (cfg->ret);
g_assert (mono_method_signature
(method)->pinvoke);
CHECK_STACK (1);
@@ -7769,7 +7789,7 @@
token = read32 (ip + 2);
klass = (MonoClass
*)mono_method_get_wrapper_data (method, token);
- NEW_RETLOADA (cfg, ins);
+ EMIT_NEW_RETLOADA (cfg, ins);
emit_stobj (cfg, ins, *sp, ip, klass, TRUE);
if (sp != stack_start)
@@ -7783,7 +7803,6 @@
start_new_bblock = 1;
ip += 6;
break;
-#endif
case CEE_MONO_CISINST:
case CEE_MONO_CCASTCLASS: {
int token;
Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-codegen.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/mini-codegen.c
2005-12-19 14:27:01 UTC (rev 54601)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-codegen.c
2005-12-19 14:39:44 UTC (rev 54602)
@@ -834,12 +834,10 @@
}
if (spec [MONO_INST_SRC1]) {
- if (spec [MONO_INST_SRC1] == 'f')
- reginfo1 = reginfof;
- else
- reginfo1 = reginfo;
+ fp = spec [MONO_INST_SRC1] == 'f';
+ reginfo1 = fp ? reginfof : reginfo;
g_assert (ins->sreg1 != -1);
- if (is_soft_reg (ins->sreg1, fp))
+ if (cfg->new_ir && is_soft_reg (ins->sreg1, fp))
/* This means the vreg is not local to this bb
*/
g_assert (reginfo1 [ins->sreg1].born_in > 0);
reginfo1 [ins->sreg1].prev_use = reginfo1
[ins->sreg1].last_use;
@@ -855,12 +853,10 @@
ins->sreg1 = -1;
}
if (spec [MONO_INST_SRC2]) {
- if (spec [MONO_INST_SRC2] == 'f')
- reginfo2 = reginfof;
- else
- reginfo2 = reginfo;
+ fp = spec [MONO_INST_SRC2] == 'f';
+ reginfo2 = fp ? reginfof : reginfo;
g_assert (ins->sreg2 != -1);
- if (is_soft_reg (ins->sreg2, fp))
+ if (cfg->new_ir && is_soft_reg (ins->sreg2, fp))
/* This means the vreg is not local to this bb
*/
g_assert (reginfo2 [ins->sreg2].born_in > 0);
reginfo2 [ins->sreg2].prev_use = reginfo2
[ins->sreg2].last_use;
Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-ops.h
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/mini-ops.h 2005-12-19
14:27:01 UTC (rev 54601)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-ops.h 2005-12-19
14:39:44 UTC (rev 54602)
@@ -264,6 +264,7 @@
/* Variants of the original opcodes which take the two parts of the long as
two arguments */
MINI_OP(OP_LCONV_TO_R8_2,"long_conv_to_r8_2", FREG, IREG, IREG)
+MINI_OP(OP_LCONV_TO_R4_2,"long_conv_to_r4_2", FREG, IREG, IREG)
MINI_OP(OP_LCONV_TO_R_UN_2,"long_conv_to_r_un_2", FREG, IREG, IREG)
MINI_OP(OP_LCONV_TO_OVF_I4_2,"long_conv_to_ovf_i4_2", IREG, IREG, IREG)
Modified: branches/vargaz/mini-linear-il/mono/mono/mini/mini-x86.c
===================================================================
--- branches/vargaz/mini-linear-il/mono/mono/mini/mini-x86.c 2005-12-19
14:27:01 UTC (rev 54601)
+++ branches/vargaz/mini-linear-il/mono/mono/mini/mini-x86.c 2005-12-19
14:39:44 UTC (rev 54602)
@@ -2403,6 +2403,10 @@
mono_add_patch_info (cfg, offset,
(MonoJumpInfoType)ins->inst_i1, ins->inst_p0);
x86_mov_reg_imm (code, ins->dreg, 0);
break;
+ case OP_JUMP_TABLE:
+ mono_add_patch_info (cfg, offset,
(MonoJumpInfoType)ins->inst_i1, ins->inst_p0);
+ x86_mov_reg_imm (code, ins->dreg, 0);
+ break;
case OP_LOAD_GOTADDR:
x86_call_imm (code, 0);
/*
@@ -2869,6 +2873,15 @@
x86_fild_membase (code, X86_ESP, 0, TRUE);
x86_alu_reg_imm (code, X86_ADD, X86_ESP, 8);
break;
+ case OP_LCONV_TO_R4_2:
+ x86_push_reg (code, ins->sreg2);
+ x86_push_reg (code, ins->sreg1);
+ x86_fild_membase (code, X86_ESP, 0, TRUE);
+ /* Change precision */
+ x86_fst_membase (code, X86_ESP, 0, FALSE, TRUE);
+ x86_fld_membase (code, X86_ESP, 0, FALSE);
+ x86_alu_reg_imm (code, X86_ADD, X86_ESP, 8);
+ break;
case OP_LCONV_TO_R_UN:
case OP_LCONV_TO_R_UN_2: {
static guint8 mn[] = { 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0x3f, 0x40 };
@@ -4301,6 +4314,9 @@
else if ((code [0] >= 0x58) && (code [0] <= 0x58 + X86_NREG) && (code
[1] == 0x81))
/* pop <REG>; add <OFFSET>, <REG> */
return 3;
+ else if ((code [0] >= 0xb8) && (code [0] < 0xb8 + 8))
+ /* mov <REG>, imm */
+ return 1;
else {
g_assert_not_reached ();
return -1;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches