+2004-04-13 Miguel de Icaza <miguel@ximian.com>
+
+ * appdomain.c: Pass arguments to the bootstraping exceptions to
+ minimize JITed methods at boot
+
+ * metadata.c (mono_exception_from_name_two_strings): Allow for the
+ second string to be null.
+
+ * icall.c (ves_icall_System_Text_Encoding_InternalCodePage):
+ Change the protocol to minimize the JIT methods at startup. Now
+ it Returns the internal codepage, if the value of "int_code_page"
+ is 1 at entry, and we can not compute a suitable code page
+ number, returns the code page as a string.
+
2004-04-13 Jackson Harper <jackson@ximian.com>
* culture-info-tables.h: Fix number of decimal digits for all
#include <mono/metadata/marshal.h>
#include <mono/utils/mono-uri.h>
-#define MONO_CORLIB_VERSION 15
+#define MONO_CORLIB_VERSION 16
CRITICAL_SECTION mono_delegate_section;
MonoAppDomainSetup *setup;
MonoAppDomain *ad;
MonoClass *class;
-
+ MonoString *arg;
+
mono_marshal_init ();
mono_install_assembly_preload_hook (mono_domain_assembly_preload, NULL);
mono_type_initialization_init ();
+
/*
* Create an instance early since we can't do it when there is no memory.
*/
- domain->out_of_memory_ex = mono_exception_from_name (mono_defaults.corlib, "System", "OutOfMemoryException");
+ arg = mono_string_new (domain, "Out of memory");
+ domain->out_of_memory_ex = mono_exception_from_name_two_strings (mono_defaults.corlib, "System", "OutOfMemoryException", arg, NULL);
+
/*
* These two are needed because the signal handlers might be executing on
* an alternate stack, and Boehm GC can't handle that.
*/
- domain->null_reference_ex = mono_exception_from_name (mono_defaults.corlib, "System", "NullReferenceException");
- domain->stack_overflow_ex = mono_exception_from_name (mono_defaults.corlib, "System", "StackOverflowException");
+ arg = mono_string_new (domain, "A null value was found where an object instance was required");
+ domain->null_reference_ex = mono_exception_from_name_two_strings (mono_defaults.corlib, "System", "NullReferenceException", arg, NULL);
+ arg = mono_string_new (domain, "The requested operation caused a stack overflow.");
+ domain->stack_overflow_ex = mono_exception_from_name_two_strings (mono_defaults.corlib, "System", "StackOverflowException", arg, NULL);
/* GC init has to happen after thread init */
mono_gc_init ();
}
MonoException *
-mono_exception_from_name_domain (MonoDomain *domain,
- MonoImage *image,
- const char* name_space,
- const char *name)
+mono_exception_from_name_domain (MonoDomain *domain, MonoImage *image,
+ const char* name_space, const char *name)
{
MonoClass *klass;
MonoObject *o;
*
* Returns: the initialized exception instance.
*/
-static MonoException *
+MonoException *
mono_exception_from_name_two_strings (MonoImage *image, const char *name_space,
- const char *name, MonoString *a1, MonoString *a2)
+ const char *name, MonoString *a1, MonoString *a2)
{
MonoDomain *domain = mono_domain_get ();
MonoClass *klass;
MonoMethod *method = NULL;
MonoObject *o;
- int i;
+ int i, count = 1;
gpointer args [2];
+
+ if (a2 != NULL)
+ count++;
klass = mono_class_from_name (image, name_space, name);
o = mono_object_new (domain, klass);
if (strcmp (".ctor", klass->methods [i]->name))
continue;
sig = klass->methods [i]->signature;
- if (sig->param_count != 2)
+ if (sig->param_count != count)
continue;
- if (sig->params [0]->type != MONO_TYPE_STRING ||
- sig->params [1]->type != MONO_TYPE_STRING)
+ if (sig->params [0]->type != MONO_TYPE_STRING)
+ continue;
+ if (count == 2 && sig->params [1]->type != MONO_TYPE_STRING)
continue;
method = klass->methods [i];
}
*/
MonoException *
mono_exception_from_name_msg (MonoImage *image, const char *name_space,
- const char *name, const guchar *msg)
+ const char *name, const guchar *msg)
{
MonoException *ex;
MonoDomain *domain;
- ex = mono_exception_from_name (image, name_space, name);
+ ex = mono_exception_from_name (image, name_space, name);
domain = ((MonoObject *)ex)->vtable->domain;
MonoException *
mono_get_exception_thread_state (const guchar *msg)
{
- return mono_exception_from_name_msg (mono_defaults.corlib,
- "System.Threading", "ThreadStateException",
- msg);
+ return mono_exception_from_name_msg (
+ mono_defaults.corlib, "System.Threading", "ThreadStateException", msg);
}
MonoException *
const char* name_space,
const char *name);
+MonoException *
+mono_exception_from_name_two_strings (MonoImage *image, const char *name_space,
+ const char *name, MonoString *a1, MonoString *a2);
+
MonoException *
mono_exception_from_name_msg (MonoImage *image, const char *name_space,
const char *name, const guchar *msg);
#include <glib.h>
#include <stdarg.h>
#include <string.h>
+#include <ctype.h>
#include <sys/time.h>
#include <unistd.h>
#if defined (PLATFORM_WIN32)
return mono_string_new (mono_domain_get (), MONO_ASSEMBLIES);
}
+static const char *encodings [] = {
+ (char *) 1,
+ "ascii", "us_ascii", "us", "ansi_x3.4_1968",
+ "ansi_x3.4_1986", "cp367", "csascii", "ibm367",
+ "iso_ir_6", "iso646_us", "iso_646.irv:1991",
+ (char *) 2,
+ "utf_7", "csunicode11utf7", "unicode_1_1_utf_7",
+ "unicode_2_0_utf_7", "x_unicode_1_1_utf_7",
+ "x_unicode_2_0_utf_7",
+ (char *) 3,
+ "utf_8", "unicode_1_1_utf_8", "unicode_2_0_utf_8",
+ "x_unicode_1_1_utf_8", "x_unicode_2_0_utf_8",
+ (char *) 4,
+ "utf_16", "UTF_16LE", "ucs_2", "unicode",
+ "iso_10646_ucs2",
+ (char *) 5,
+ "unicodefffe", "utf_16be",
+ (char *) 6,
+ "iso_8859_1",
+ (char *) 0
+};
+
+/*
+ * Returns the internal codepage, if the value of "int_code_page" is
+ * 1 at entry, and we can not compute a suitable code page number,
+ * returns the code page as a string
+ */
static MonoString*
-ves_icall_System_Text_Encoding_InternalCodePage (void)
+ves_icall_System_Text_Encoding_InternalCodePage (gint32 *int_code_page)
{
const char *cset;
-
+ char *p;
+ char *codepage = NULL;
+ int code;
+ int want_name = *int_code_page;
+ int i;
+
+ *int_code_page = -1;
MONO_ARCH_SAVE_REGS;
g_get_charset (&cset);
+ p = codepage = strdup (cset);
+ for (p = codepage; *p; p++){
+ if (isascii (*p) && isalpha (*p))
+ *p = tolower (*p);
+ if (*p == '-')
+ *p = '_';
+ }
/* g_print ("charset: %s\n", cset); */
+
/* handle some common aliases */
- switch (*cset) {
- case 'A':
- if (strcmp (cset, "ANSI_X3.4-1968") == 0)
- cset = "us-ascii";
- break;
+ p = encodings [0];
+ code = 0;
+ for (i = 0; p != 0; ){
+ if ((int) p < 7){
+ code = (int) p;
+ p = encodings [++i];
+ continue;
+ }
+ if (strcmp (p, codepage) == 0){
+ *int_code_page = code;
+ break;
+ }
+ p = encodings [++i];
}
- return mono_string_new (mono_domain_get (), cset);
+
+ if (p - codepage > 5){
+ if (strstr (codepage, "utf_8") != -1)
+ *int_code_page |= 0x10000000;
+ }
+ free (codepage);
+
+ if (want_name && *int_code_page == -1)
+ return mono_string_new (mono_domain_get (), cset);
+ else
+ return NULL;
}
static MonoBoolean
}
g_module_symbol (module, "SharedWineInit", &shared_wine_init);
+ if (shared_wine_init == NULL)
+ return;
+
shared_wine_init ();
+
+ return;
}
+2004-04-13 Miguel de Icaza <miguel@ximian.com>
+
+ * inssel-x86.brg (reg): Add new rules for add, sub and mul that
+ can use the memory directly.
+
+ * cpu-pentium.md: Update documentation from a post from Zoltan.
+
+ add x86_add_membase, x86_sub_membase, x86_mul_membase
+
2004-04-13 Miguel de Icaza <miguel@ximian.com>
* mini-ppc.c: Remove unused definitions FLOAT_REGS and
# d EDX register
#
# len:number describe the maximun length in bytes of the instruction
-# number is a positive integer
+# number is a positive integer. If the length is not specified
+# it defaults to zero. But lengths are only checked if the given opcode
+# is encountered during compilation. Some opcodes, like CONV_U4 are
+# transformed into other opcodes in the brg files, so they do not show up
+# during code generation.
#
# cost:number describe how many cycles are needed to complete the instruction (unused)
#
x86_fp_load_i8: dest:f src1:b len:7
x86_fp_load_i4: dest:f src1:b len:7
x86_seteq_membase: src1:b len:7
+x86_add_membase: dest:i src1:i src2:b clob:1 len:11
+x86_sub_membase: dest:i src1:i src2:b clob:1 len:11
+x86_mul_membase: dest:i src1:i src2:b clob:1 len:13
adc: dest:i src1:i src2:i len:2 clob:1
addcc: dest:i src1:i src2:i len:2 clob:1
subcc: dest:i src1:i src2:i len:2 clob:1
MONO_OPT_INTRINS | \
MONO_OPT_AOT)
+
static guint32
parse_optimizations (const char* p)
{
system (cmd);
g_free (cmd);
cmd = g_strdup_printf (DIS_CMD " %s", o_file);
- system (cmd);
+ system (cmd);
+ g_free (cmd);
+
+ cmd = g_strdup_printf ("objdump -d -M intel %s", o_file);
+ system (cmd);
g_free (cmd);
g_free (o_file);
g_free (as_file);
/* fixme: nothing to do ??*/
}
+reg: CEE_ADD(reg, CEE_LDIND_I4 (base)) {
+ MonoInst *base = state->right->left->tree;
+
+ tree->dreg = state->reg1;
+ tree->sreg1 = state->left->reg1;
+ tree->sreg2 = base->inst_basereg;
+ tree->inst_offset = base->inst_offset;
+ tree->opcode = OP_X86_ADD_MEMBASE;
+ mono_bblock_add_inst (s->cbb, tree);
+}
+
+reg: CEE_SUB(reg, CEE_LDIND_I4 (base)) {
+ MonoInst *base = state->right->left->tree;
+
+ tree->dreg = state->reg1;
+ tree->sreg1 = state->left->reg1;
+ tree->sreg2 = base->inst_basereg;
+ tree->inst_offset = base->inst_offset;
+ tree->opcode = OP_X86_SUB_MEMBASE;
+ mono_bblock_add_inst (s->cbb, tree);
+}
+
+reg: CEE_MUL(reg, CEE_LDIND_I4 (base)) {
+ MonoInst *base = state->right->left->tree;
+
+ tree->dreg = state->reg1;
+ tree->sreg1 = state->left->reg1;
+ tree->sreg2 = base->inst_basereg;
+ tree->inst_offset = base->inst_offset;
+ tree->opcode = OP_X86_MUL_MEMBASE;
+ mono_bblock_add_inst (s->cbb, tree);
+}
%%
* (C) 2002 Ximian, Inc.
*
*/
-
#include <config.h>
#include <string.h>
MINI_OP(OP_STORE, "store")
MINI_OP(OP_OBJADDR, "objaddr")
MINI_OP(OP_VTADDR, "vtaddr")
-MINI_OP(OP_PHI, "phi")
+MINI_OP(OP_PHI, "phi")
MINI_OP(OP_RENAME, "rename")
MINI_OP(OP_COMPARE, "compare")
MINI_OP(OP_COMPARE_IMM, "compare_imm")
MINI_OP(OP_FCOMPARE, "fcompare")
MINI_OP(OP_LCOMPARE, "lcompare")
MINI_OP(OP_LOCAL, "local")
-MINI_OP(OP_ARG, "arg")
+MINI_OP(OP_ARG, "arg")
MINI_OP(OP_ARGLIST, "oparglist")
MINI_OP(OP_OUTARG, "outarg")
MINI_OP(OP_OUTARG_IMM, "outarg_imm")
MINI_OP(OP_X86_FP_LOAD_I8, "x86_fp_load_i8")
MINI_OP(OP_X86_FP_LOAD_I4, "x86_fp_load_i4")
MINI_OP(OP_X86_SETEQ_MEMBASE, "x86_seteq_membase")
-
+MINI_OP(OP_X86_ADD_MEMBASE, "x86_add_membase")
+MINI_OP(OP_X86_SUB_MEMBASE, "x86_sub_membase")
+MINI_OP(OP_X86_MUL_MEMBASE, "x86_mul_membase")
+
MINI_OP(OP_PPC_SUBFIC, "ppc_subfic")
MINI_OP(OP_PPC_SUBFZE, "ppc_subfze")
/* forward pass on the instructions to collect register liveness info */
while (ins) {
spec = ins_spec [ins->opcode];
+
DEBUG (print_ins (i, ins));
if (spec [MONO_INST_SRC1]) {
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_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_MEMBASE:
+ x86_alu_reg_membase (code, X86_SUB, ins->sreg1, ins->sreg2, ins->inst_offset);
+ break;
case OP_X86_INC_MEMBASE:
x86_inc_membase (code, ins->inst_basereg, ins->inst_offset);
break;
case OP_X86_DEC_REG:
x86_dec_reg (code, ins->dreg);
break;
+ case OP_X86_MUL_MEMBASE:
+ x86_imul_reg_membase (code, ins->sreg1, ins->sreg2, ins->inst_offset);
+ break;
case CEE_BREAK:
x86_breakpoint (code);
break;
x86_leave (code);
if (CALLCONV_IS_STDCALL (sig->call_convention)) {
- MonoJitArgumentInfo *arg_info = alloca (sizeof (MonoJitArgumentInfo) * (sig->param_count + 1));
+ MonoJitArgumentInfo *arg_info = alloca (sizeof (MonoJitArgumentInfo) * (sig->param_count + 1));
- stack_to_pop = mono_arch_get_argument_info (sig, sig->param_count, arg_info);
- }
- else
- if (MONO_TYPE_ISSTRUCT (cfg->method->signature->ret))
- stack_to_pop = 4;
+ stack_to_pop = mono_arch_get_argument_info (sig, sig->param_count, arg_info);
+ } else if (MONO_TYPE_ISSTRUCT (cfg->method->signature->ret))
+ stack_to_pop = 4;
else
- stack_to_pop = 0;
+ stack_to_pop = 0;
if (stack_to_pop)
x86_ret_imm (code, stack_to_pop);