2002-05-22 Martin Baulig * debug-dwarf2.c: Produce assembler code which is free of comments and extra whitespaces so that it's suitable for `as -f'. 2002-05-22 Martin Baulig * debug-dwarf2.c (dwarf2_write_section_end): Removed. This is not needed and not supported by all assemblers. (dwarf2_write_2byte): Use ".word" instead of ".2byte" since ".2byte" is a GNU extension. * mono.c (--debug): Small fix in the argument parsing. 2002-05-22 Martin Baulig * debug.c: Added "dont_assemble" and "dont_precompile" argument for dwarf-plus. * mono.c: Applied patch from Miguel: (--debug): This is now a `--debug=[FORMAT]' argument where FORMAT defaults to dwarf-plus. 2002-05-21 Martin Baulig * debug.c (mono_debug_source_location_from_address): Added support for the dwarf2-plus format. 2002-05-21 Martin Baulig * debug.c (mono_debug_source_location_from_address): New function. (mono_debug_il_offset_from_address): New function. * exception.c (arch_handle_exception): If we have debugging support, include information about the source location and IL offset in the stack trace. 2002-05-21 Dietmar Maurer * jit.c (mono_analyze_stack): LDARG uses 16bit argument (fix bug #25058) * x86.brg (stmt): removed unnecessary assertion * jit.c (check_inlining): we cant inline throw instructions (because it breaks some basic block requirements) 2002-05-21 Martin Baulig * debug-private.h (MonoDebugFlags): New enum typedef. * debug.c (mono_debug_open): Added a few useful arguments. See the manpage for details. 2002-05-21 Martin Baulig * debug.c (mono_debug_open_file): Renamed to mono_debug_open(), now takes a `MonoAssembly *' argument instead of a `char *filename' one. Also added `const char **args' argument. * mono.c (mono_jit_assembly): Renamed to mono_jit_compile_image(), added `int verbose' argument and made it public. (mono_jit_compile_class): New public function, moved the code to compile all methods in a class here from main(). (--compile): The argument can now also be an image (in `@imagename' format). Updated documentation for this command line argument. (--precompile): New command line argument to precompile an image/class/method before executing the main app. This argument can be given multiple times. (--break): Renamed the "--debug" command line argument to "--break". (--debug): New command line argument to specify the debugging format. (--stabs, --dwarf, --dwarf-plus): Removed, obsoleted by "--debug". (--debug-args): New command line argument. This is a comma-separated list of additional arguments for the symbol writer. (usage): Beautified the help text a bit. * debug-dwarf2-plus.c (mono_debug_open_assembly_dwarf2_plus): Use the new public mono_jit_compile_image() function rather than duplication this functionality here. 2002-05-21 Martin Baulig * debug-dwarf2-plus.c: This is now working again :-) * debug.c (mono_debug_open_file): When using MONO_DEBUG_FORMAT_DWARF2_PLUS, we create two MonoDebugHandles: one for MONO_DEBUG_FORMAT_DWARF2_PLUS and one for the fallback MONO_DEBUG_FORMAT_DWARF2. 2002-05-21 Martin Baulig * jit.c (mono_debug_handle): Removed this global variable. * debug.c (mono_debug_close): Removed. (mono_debug_cleanup): New global function. (mono_debug_add_image): New global function. (mono_debug_handle_from_class): New global function. (mono_debug_write_symbols): New global function. (mono_debug_add_type): Removed `MonoDebugHandle *' argument. (mono_debug_add_method): Likewise. 2002-05-21 Martin Baulig Work around a hard-to-fix bug in GDB and create a single dwarf/stabs file for all assemblies. Currently, the JIT doesn't put all methods from a single assembly into a continuous region of memory. We were previously creating valid DWARF 2 files for this, but unfortunately GDB's symbol tables get messed up when it reads more than one such file. * debug-private.h (AssemblyDebugInfo): Moved `f', `producer_name', `next_idx', `methods', `type_hash', `source_files' and `format' into the MonoDebugHandle. * debug.c (mono_debug_get_type): This now operates on the MonoDebugHandle, not on the AssemblyDebugInfo. (mono_debug_open_file): Moved some stuff here from mono_debug_open_assembly(). * debug-dwarf2.c (mono_debug_write_assembly_dwarf2): Renamed into mono_debug_write_dwarf2(). (mono_debug_open_assembly_dwarf2): Removed. (mono_debug_close_assembly_dwarf2): Removed. * debug-stabs.c (mono_debug_write_assembly_stabs): Renamed into mono_debug_write_stabs(). (mono_debug_open_assembly_stabs): Removed. (mono_debug_close_assembly_stabs). * debug-dwarf2-plus.c: This is currently broken. :-( 2002-05-20 Martin Baulig * debug.h (mono_debug_format): New global variable. (MonoDebugFormat): Added MONO_DEBUG_FORMAT_NONE. * debug-private.h (MonoDebugHandle): Added `objfiles' field which is a whitespace separated list of symbol files. (AssemblyDebugInfo): Added `objfile' filed which is the name of the symbol file. * mono.c (main): Pass the assembly file name to mono_debug_open_file(). * debug.c (mono_debug_make_symbols): Link all symbol files into a big `.o' symbol file. 2002-05-20 Martin Baulig * debug.c (debug_load_method_lines): Check whether the assembly file is newer than the IL file and recreate the IL file if necessary. 2002-05-20 Miguel de Icaza * mono.c Updated copyright years. 2002-05-18 Miguel de Icaza * mono.c (usage): Relayout command line options. 2002-05-17 Dietmar Maurer * x86.brg (reg): fixed array bound check * emit-x86.c (enter_method): print method signature * exception.c (arch_handle_exception): set trace info before we call handlers. 2002-05-16 Dietmar Maurer * jit.c (mono_find_final_block): make it work with mcs * x86.brg: buf fix. if exception variable is allocated to a register. * jit.c (mono_find_final_block): bug fix. 2002-05-15 Dietmar Maurer * delegate.c (arch_end_invoke): fix bug #24653, simplified the code using new runtime_invoke feature. * jit.c (mono_analyze_flow): try blocks are followed by handler blocks, so we need to add all handler blocks as succesors. (mono_thread_start_cb): set end_of_stack * exception.c (arch_handle_exception): correctly save/restore caller saved regs. * emit-x86.c (arch_emit_prologue): correctly save/restore caller saved regs. * jit.c (mono_cfg_new): allocate space for caller saved registers. 2002-05-14 Dietmar Maurer * jit.c: only use one TLS slot to store jit data * exception.c (arch_handle_exception): print function signature, use thread relative end_of_stack 2002-05-13 Dietmar Maurer * jit.c (OPT_BOOL): new. opt. for boolean variables - we simply store them as 32 bit integers. (mono_analyze_stack): we need to generate a temporary var for SHL/SHR because the tree allocator can fail otherwise * exception.c (arch_handle_exception): EIP now points to the call instruction, not to the instruction after the call. This fixes the bug reported by Linus Upson (tests/exception8.cs) 2002-05-11 Dietmar Maurer * jit.c (mono_analyze_flow): always allocate the forest array (mono_stack_duplicate_used_var): impl. (mono_copy_used_var): impl. * x86.brg: bug fix in SHR/SHL * emit-x86.c (arch_emit_prologue): check if live_in_set != NULL 2002-05-11 Sergey Chaban * mono.c: new --fast-iconv command line option to enable fast FP-to-integer conversion code. * jit.c, jit.h: added global variable to store state for the above option. This optimization is disabled by default. * x86.brg: added code to emit fast FP-to-integer conversion sequences. 2002-05-10 Dan Lewis * emit-x86.c: simple definite assignment analysis optimization for uninitialized locals. Fri May 10 15:43:53 CEST 2002 Paolo Molaro * x86.brg, emit-x86.c: patch the branch targets with x86_patch(). 2002-05-10 Dietmar Maurer * linear-scan.c (mono_update_gen_set): improvement/bug fix * x86.brg: added additional rules to handle global allocated registers * mono.c (usage): the option is called --nols, and it dissables linear scan. * x86.brg: better LDIND_R4, LDIND_R8, STIND_R4, STIND_R8 2002-05-09 Dietmar Maurer * linear-scan.c: linear scan reg. allocation and data flow analysis use Paolo's great bitset implementation. * jit.c (arch_allocate_var): add live range info (mono_cfg_add_successor): create list of successors for basic blocks. * mono.c (main): new option --ls to enable linear scan * exception.c (arch_handle_exception): print instruction pointer relative to method start address. * jit.c (mono_print_ctree): print register number if locals are allocate in registers. * emit-x86.c (arch_emit_prologue): initialize reg. allocated locals (arch_emit_epilogue): take care when restoring save registers, because the stack pointer may has changed. * x86.brg: s/VAROFFSET/VARINFO/ modified to support global register allocation Mon May 6 15:38:15 CEST 2002 Paolo Molaro * jit.h, jit.c, emit-x86.c: x86 cpu detection code from Sergey. 2002-05-03 Sergey Chaban * x86.brg: more coni4 optimizations MUL: generate optimized code for some consts other than powers of 2 (hardcoded impl. for 3, 5, 10 etc.); DIV_UN: multiply with reciprocal instead of dividing; 2002-05-03 Dietmar Maurer * x86.brg: use VAROFFSET macro * emit-x86.c (tree_emit): allocate space for spilled regs in activation frame instead of pushing them to the stack. * x86.brg: replace BXX with CBRANCH/COMPARE replaced CXX CSET/COMPARE * emit-x86.c (arch_allocate_regs): improved register allocation 2002-05-02 Dietmar Maurer * delegate.c (mono_delegate_cleanup): signal semaphore in order to exit threads. 2002-04-30 Dick Porter * mono.c (main): Tell glib to not abort when g_log() etc print recursively 2002-04-30 Dietmar Maurer * x86.brg: opt. LDELEMA impl. (MUL) use shift when possible. (DIV) use shift when possible. impl. various opt. with coni4 * exception.c (arch_handle_exception): use ctx->SC_EBP in end_of_stack check as suggested by Linus Upson 2002-04-29 Dietmar Maurer * x86.brg (LDLEN, UNBOX): removed unnecessary NULL check. * exception.c: included the Freebsd patch from Sandro Tolaini Mon Apr 29 15:18:00 CEST 2002 Paolo Molaro * mono.c, jit.c: use mono_runtime_run_main (). 2002-04-29 Dietmar Maurer * jit.c (mono_analyze_stack): dont call methods on Object with METHOD_ATTRIBUTE_FINAL directly because it breaks remoting. * x86.brg: added more CONV_U rules * jit.c (mono_analyze_stack): avoid recursive call of virtual methods: fixes Bug #23778 (mono_analyze_stack): emit right CONV_UX opcodes: fixes bug 23547 * exception.c (arch_handle_exception): only g_assert(cleanup) if we really need it. 2002-04-27 Patrik Torstensson * x86.brg: fixed bug in CONV_I8 (invalid stack correction) 2002-04-27 Martin Baulig * jit.h (MonoFlowGrap): Renamed `epilogue_begin' to `epilogue_end', there's already `epilog' so we don't need `epilogue_begin'. * debug.c (mono_debug_add_method): Use `cfg->epilogue_end' to get the size of the method's code. 2002-04-25 Martin Baulig * debug-dwarf2.c (dwarf2_write_string_type): Reflect latest MonoString changes. 2002-04-25 Dietmar Maurer * x86.brg: enable stmt: STIND_I4 (addr, coni4) again, added CONV_OVF_I4 (fix bug #23808) 2002-04-23 Dietmar Maurer * x86.brg: code cleanup - use x86_patch () * jit.c (mono_analyze_stack): only use MB_TERM_CHECKTHIS when necessary (mono_analyze_stack): don't store constants in temp. variables for CEE_DUP * x86.brg (stmt): removed stmt: STIND_I4 (addr, coni4) rule because it slows down performance. 2002-04-21 Dan Lewis * emit-x86.c: enter_method handles 8-byte aligned parameters. 2002-04-20 Dan Lewis * jit,h, jit.c, x86.brg: NEWOBJ_SPEC and NEWARR_SPEC terminals for non-shared code. 2002-04-20 Dietmar Maurer * jit.c (check_inlining): added statistics about inlineing * mono.c (usage): new switch --noinline to disable inlining * jit.c (mono_analyze_stack): added a check for (this!=NULL) if we inline methods (to keep semantics) * x86.brg: added constant folding for inegers * emit-x86.c (tree_allocate_regs): handle the special case when chain rules need a register. 2002-04-19 Dietmar Maurer * invoke.c (arch_create_native_wrapper): do not save LMF for Strings * jit.c (check_inlining): better inlining support 2002-04-19 Dan Lewis * x86.brg: LDLEN uses max_length instead of bounds[0] * jit.c: support for new szarray format 2002-04-18 Dietmar Maurer * jit.c (check_inlining): added inlining support 2002-04-17 Dietmar Maurer * x86.brg: optimized version of castclass and isinst Wed Apr 17 12:34:56 CEST 2002 Paolo Molaro * emit-x86.c, invoke.c: track time spent compiling. Wed Apr 17 10:58:37 CEST 2002 Paolo Molaro * emit-x86.c, invoke.c: call profile callbacks if needed. * jit.c, jit.h, mono.c: add --profile command line option. 2002-04-16 Gonzalo Paniagua Javier * jit.h: included mono/io-layer/io-layer.h to avoid breaking compilation under windows when upgrading mingw and w32api to version 1.3 (thanks Dick!). 2002-04-15 Patrik Torstensson * jit.c: changed the array icalls to use full names 2002-04-15 Dietmar Maurer * x86.brg: check the this pointer before calling non-virtual functions * emit-x86.c (arch_emit_prologue): initialize local vars. * x86.brg: removed incredible clumsy code 2002-04-13 Martin Baulig * debug-dwarf2.c (dwarf2_write_variable_location): New static func to write the location of a variable. (dwarf2_write_variable, dwarf2_write_parameter): Take a MonoDebugVarInfo instead of a stack offset and use dwarf2_write_variable_location() to write the location. 2002-04-13 Martin Baulig * debug.c, debug-stabs.c, debug-dwarf2.c: Reflect latest debug-symfile.h API changes. 2002-04-12 Gonzalo Paniagua Javier * Makefile.am: use of the new '-s' option in monoburg. 2002-04-12 Martin Baulig * debug-dwarf2.c (dwarf2_write_variable): Emit info about the variable's lifetime. 2002-04-10 Sergey Chaban * win32-exception: added Win32 SEH exception filter that translates CONTEXT to sigcontext; * jit.c: added Win32 SEH init/reset calls, compute sigcontext address in a platfrom-dependent way; * jit.h: use win32-exception instead of signal if PLATFORM_WIN32 and avoid io-layer includes; * delegate.c: do not include io-layer stuff if PLATFORM_WIN32 is defined; 2002-04-09 Dietmar Maurer * delegate.c (arch_end_invoke): restore output arguments Mon Apr 8 17:16:40 CEST 2002 Paolo Molaro * jit.c: call mono_runtime_init (). 2002-04-08 Dietmar Maurer * jit.c (mono_jit_cleanup): added more statistics * invoke.c (arch_create_native_wrapper): special case EndInvoke - we need to pass the MonoMethod pointer as first argument. * delegate.c (mono_async_invoke): notify all listeners, not only a single one. (arch_end_invoke): we now pass a MonoMethod as first parameter and use arch_method_call_message_new() to access the stack. (arch_end_invoke): wait until we really finished processing (async_invoke_abort): notify all listeners, not only a single one. 2002-04-06 Dietmar Maurer * message.c (arch_return_value): impl. (arch_method_return_message_restore): consider delegate BeginInvoke * jit.c: removed jit_exec_main() * delegate.c (arch_begin_invoke): use the message builder to make it architecture independent - still needs more cleanup. 2002-04-05 Dietmar Maurer * delegate.c (mono_delegate_ctor): support for transparent proxy * x86.brg (freg): bug fix in CONV_R* opcodes 2002-04-04 Dietmar Maurer * message.c: added documentation 2002-04-03 Dietmar Maurer * mono.c (main): use --trace instead of --trace-calls * x86.brg: impl. REMOTE_STIND_XX * message.c (mono_store_remote_field): impl. 2002-03-30 Dietmar Maurer * x86.brg: impl. REMOTE_FIELD (load fields of remote objects) * message.c (mono_load_remote_field): impl. * jit.c (mono_analyze_stack): only call marshalbyref methods through the vtable. (mono_analyze_stack): consider marshalbyref objects in LDFLD Fri Mar 29 16:00:27 CET 2002 Paolo Molaro * x86.brg: kill pointer arithmetric. 2002-03-28 Martin Baulig * jit.c (mono_debug_insert_breakpoint): New global variable. (mono_debug_last_breakpoint_address): New global variable. * emit-x86.c (arch_compile_method): If `mono_debug_insert_breakpoint' is non-zero, insert a breakpoint; if it's positive, decrement it when done. Set `mono_debug_last_breakpoint_address' to the address of the last inserted breakpoint. * debug.h: Provide external declaration of `mono_debug_insert_breakpoint' and `mono_debug_last_breakpoint_address', also documented them here. 2002-03-28 Martin Baulig * debug-private.h (MonoDebugHandle): Renamed `format' to `default_format'. (AssemblyDebugInfo): Added `format'. * debug.c: Use the AssemblyDebugInfo's `format' field to determine the format, this allows us choose the format on a per-assembly basis. (mono_debug_open_assembly): When using MONO_DEBUG_FORMAT_DWARF2_PLUS, fall back to MONO_DEBUG_FORMAT_DWARF2 if the symbol file does not exist, but the IL file exists. (debug_generate_method_lines): Generate correct IL offsets. 2002-03-28 Martin Baulig * jit.h (MonoFlowGraph): Added `prologue_end' and `epilogue_start' fields. * emit-x86.c (arch_compile_method): Set prologue_end and epilogue_start. * debug-private.h (DebugMethodInfo): Renamed `frame_start_offset' to `prologue_end_offset', added `epilogue_begin_offset' and `last_line'. * debug.c (debug_generate_method_lines): Don't return if we don't have line numbers, we still need to generate the IL offsets here. Emit line numbers for `prologue_end_offset' (the first line of actual code) and `epilogue_begin_offset' (the line of the method's closing brace). Don't crash if cfg->bblocks [i].forest is NULL. (mono_debug_add_method): Don't crash if we don't have line numbers. Initialize the newly added fields. * debug-stabs.c: Record first and last line, emit filename info at the beginning of the stab file, gdb ignores the types otherwise. * debug-dwarf2.c: Use the new prologue_end_offset instead of guessing it; emit line number info for the first and last line. 2002-03-28 Dietmar Maurer * invoke.c (arch_create_delegate_trampoline): impl. Thu Mar 28 11:58:53 CET 2002 Paolo Molaro * Makefile.am, mono.c, jit.h, jit.c: build the libmono library with the jit runtime to easy embedding. main() is moved to mono.c, now. * jit.c: use opcode names from libmetadata. * debug.h, debug.c: constify char* argument. 2002-03-28 Dietmar Maurer * jit.c: catching SIGSEGV again, added proxy support 2002-03-21 Dietmar Maurer * delegate.c (mono_delegate_init): remove unused worker threads 2002-03-27 Mike Kestner * delegate.c (arch_get_delegate_invoke): malloc a bigger area Tue Mar 26 19:54:45 CET 2002 Paolo Molaro * jit.c: remove glib mem vtable code. 2002-03-26 Martin Baulig * debug-dwarf2.c (write_method_lines_dwarf2): Don't generate method lines if we don't have line number information. (write_method_dwarf2): Use `minfo->method_info.this_offset' instead of hardcoding 8. * debug-stabs.c (write_method_stabs): Don't generate method lines if we don't have line number information. Use `minfo->method_info.this_offset' instead of hardcoding 8. * debug.c (debug_generate_method_lines): Don't crash if we don't have line number information. (mono_debug_open_assembly): Don't generate line numbers for MONO_DEBUG_FORMAT_DWARF2_PLUS. (mono_debug_add_method): Don't store the 'this' offset in `param_offsets', but it in the new `this_offset' field. Mon Mar 25 13:03:35 CET 2002 Paolo Molaro * debug.c (debug_generate_method_lines): Use correct addresses for record_il_offset(). Mon Mar 25 13:03:35 CET 2002 Paolo Molaro * jit.c: do not set the glib mem vtable anymore. * Makefile.am: link to libmonoutils. 2002-03-25 Martin Baulig * debug.h (mono_debug_make_symbols): Documented this function. 2002-03-24 Martin Baulig * debug.c (mono_debug_add_method): Include the `this' offset in the `minfo->method_info.param_offsets' array. 2002-03-23 Martin Baulig * x86.brg (lreg: CONV_I8 (reg)): X86_XOR modifies the flags, so we need to do it before the X86_CMP. (reg: CLT (lreg, lreg)): Use correct x86_branch8() targets. (reg: CLT (lreg, lreg)): Likewise. (reg: CLT_UN (lreg, lreg)): Likewise. (reg: CLT_UN (lreg, lreg)): Likewise. (reg: CGT (lreg, lreg)): Likewise. (reg: CGT (lreg, lreg)): Likewise. (reg: CGT_UN (lreg, lreg)): Likewise. (reg: CGT_UN (lreg, lreg)): Likewise. 2002-03-23 Martin Baulig * debug-private.h (AssemblyDebugInfo): Added `_priv'. * debug-dwarf2-plus.c (mono_debug_open_assembly_dwarf2_plus): Open the symbol file here. (mono_debug_close_assembly_dwarf2_plus): Close the symbol file here. (mono_debug_write_assembly_dwarf2_plus): Only call mono_debug_update_symbol_file() here. Thu Mar 21 17:35:48 CET 2002 Paolo Molaro * jit.c: inter strings before executing a method. Do not intern command line arguments anymore. 2002-03-21 Martin Baulig * debug.h (MonoDebugFormat): Added MONO_DEBUG_FORMAT_DWARF2_PLUS. * debug-dwarf2-plus.c: This debugging format reads a symbol file which has been created by MCS and fills in all machine dependent stuff. * debug-private.h (DebugMethodInfo): Added `MonoDebugMethodInfo method_info', removed everything which is already in MonoDebugMethodInfo. * debug.c (debug_generate_method_lines): Generate the MonoILOffsetInfo array. (mono_debug_make_symbols): Don't open the file or call as, this is done in the backend code. * jit.c (main): Added "--dwarf-plus" command line option to use the new MONO_DEBUG_FORMAT_DWARF2_PLUS debugging format. 2002-03-21 Dietmar Maurer * jit.c (usage): new option to specify maximum number of worker threads (mono_analyze_stack): avoid cyclic dependency in CEE_LDFTN * delegate.c (async_invoke_abort): added support for asynchronous exceptions (arch_get_async_invoke): notify listeners before we call the asynchronous callback 2002-03-20 Dietmar Maurer * delegate.c (async_invoke_thread): support for domains (async_invoke_thread): create workers only when needed 2002-03-19 Dietmar Maurer * delegate.c (async_invoke_thread): initial support for BeginInvoke/EndInvoke 2002-03-18 Dietmar Maurer * x86.brg: impl. lreg: XOR (lreg, lreg) impl. REM (freg, freg) 2002-03-17 Martin Baulig * debug.c (mono_debug_open_assembly): Call mono_debug_get_type() on all base types. * debug-dwarf2.c: Added support for strings and arrays. 2002-03-17 Martin Baulig * debug.c (mono_debug_get_type): Recursively call this for all function members of a class type. (mono_debug_add_method): Don't mangle function names, this must be done by the debugger backend if the debugging format needs mangled names. * debug-dwarf2.c: Improved support for classes, added member functions. 2002-03-16 Martin Baulig * debug.c (mono_debug_get_type): Recursively call this for all members and parent classes of a class type. * debug-dwarf2.c: Added basic support for classes. Set source language to C++ since GDB doesn't like Java very much. 2002-03-16 Martin Baulig * debug-dwarf2.c: Added support for enums. 2002-03-15 Martin Baulig * debug.c (mono_debug_get_type): Recursively call this for all members of a struct type. * debug-dwarf2.c: Added support for structs. 2002-03-15 Dietmar Maurer * emit-x86.c (arch_create_jit_trampoline): adapt save/restore LMF to new MonoLMF layout 2002-03-14 Dietmar Maurer * emit-x86.c (arch_create_native_wrapper): new code to generate wrappers for calling native functions. (arch_create_native_wrapper): free allocated strings (arch_handle_exception): made mono_jit_info_table domain dependent 2002-03-14 Martin Baulig * debug.c (MonoDebugFormat): New public enums specifying which debugging format to use. (mono_debug_open_file): Added MonoDebugFormat argument. (mono_debug_make_symbols): Don't take an argument to make it easier to call this function from GDB. It's now safe to call this function multiple times; it'll always write a complete debugging file. * debug.c: Splitted this file into a general part which remains in this file and the debugging format specific parts debug-stabs.c and debug-dwarf2.c. All public functions now call a corresponding format specific function. * debug.c: The following changes are private to debug.c: (AssemblyDebugInfo, MonoDebugHandle): Moved declarations to debug-private.h. (record_line_number, debug_generate_method_lines): New private functions. (mono_debug_open_ass): Renamed to mono_debug_open_assembly; this function now calls a debugging-format-specific function (mono_debug_open_assembly_stabs or mono_debug_open_assembly_dwarf2). (mono_debug_make_symbols): Calls mono_debug_write_assembly_stabs/dwarf2(). It's now safe to call this function multiple times. (mono_debug_get_type): New public function. This takes a `MonoClass *' and returns an unique index for this type. It's used to ensure that we only write each class once to the debugging file. (mono_debug_add_method, mono_debug_add_type): Store all the data in an internal data structure, but don't directly write to the debugging file. This is done later from mono_debug_write_assembly(). * jit.c (main): Added "--dwarf" command line argument to generate DWARF 2 debugging output. Call mono_debug_close() on cleanup if necessary. 2002-03-14 Martin Baulig * debug-private.h: New private header file. * debug-stabs.c: Added the stabs type generation stuff which was previously in debug.c. * debug-dwarf.c: Started to implement type support. We're currently only writing this most basic types to the dwarf file, but this will change soon. 2002-03-13 Martin Baulig * debug-stabs.c, debug-dwarf2.c: New files containing my new debugging code. They're now in CVS, but not yet used anywhere. 2002-03-11 Dietmar Maurer * emit-x86.c (mono_delegate_ctor): use C impl. instead of x86_* macros, included new delegate code from Daniel Stodden. Mon Mar 11 14:47:21 CET 2002 Paolo Molaro * jit.c: verify that corlib and runtime are in sync. Mon Mar 11 11:30:56 CET 2002 Paolo Molaro * emit-x86.c, jit.c: use the debug-helpers facilities to describe and match a method when debugging. 2002-03-10 Martin Baulig * emit-x86.c (arch_compile_method): When emitting stabs debugging output, put a nop instruction at the start of all functions so that the adresses won't change when using --debug. * debug.c (mono_debug_add_method): `tree->cli_addr' is an offset into the bytecode area, stabs needs a line number in the .il file. Use the new info->moffsets to get the line number. (AssemblyDebugInfo): Added `total_lines' and `moffsets' fields. `moffsets' is an array of `total_lines' fields (total number of lines in the .il file); for each line in the .il field, this array contains the bytecode offset if it's an "IL_xxxx" line, -1 if it's the last line of a method and 0 otherwise. (debug_load_method_lines): Read the whole .il file and initialize the info->moffsets field. 2002-03-09 Martin Baulig * x86.brg (DIV_UN): Clear EDX before performing the division and remove the unnecessary CDQ instruction. 2002-03-07 Dietmar Maurer * jit.c (mono_analyze_stack): only load addresses of value types on the runtime stack. 2002-03-07 Duncan Mak * Makefile.am: A small patch fixing errors in vpath-based builds (make clean failing to rerun monoburg due to BUILT_SOURCES usage), committed for Daniel Stodden . Thu Mar 7 17:22:52 CET 2002 Paolo Molaro * jit.c: Boehm-GC enable. 2002-03-07 Dietmar Maurer * x86.brg (SAVE_LFM): bug fix: patch the saved IP because we realloc that code sometimes! * emit-x86.c (mono_compute_branches): support several types of jump infos 2002-03-06 Dietmar Maurer * x86.brg: impl. MUL_OVF_UN (reg, reg) * jit.c (mono_find_final_block): find correct finally handler. * emit-x86.c (arch_create_jit_trampoline): bug fix: preserve caller saved registers. 2002-03-05 Dietmar Maurer * x86.brg: use x86_widen_reg for CONV opcodes 2002-03-01 Dietmar Maurer * jit.c (MAKE_SPILLED_BI_ALU): remove unnecessary assertions * emit-x86.c (arch_handle_exception): big fix - dont use uninitialized next_bp (arch_compile_method): make the jit thread save (x86_magic_trampoline): moved lock/unlock to x86_magic_trampoline to avoid need of recursive mutexes * x86.brg: use new mono_assert macros 2002-02-28 Dietmar Maurer * emit-x86.c (arch_create_jit_trampoline): save/restore LMF before calling into unmanaged code (arch_compile_method). * x86.brg: impl. CONV_I4 (freg) with correct rounding (lreg): impl CALL_I8(INTF_ADDR) impl. CONV_R_UN (reg) bug fix im REM_UN 2002-02-27 Dietmar Maurer * emit-x86.c (arch_runtime_invoke): impl. runtime invoke for the jit. 2002-02-26 Dietmar Maurer * x86.brg: bug fix in CLT(lreg,lreg) (reg): bug fix in CONV_OVF_I4(lreg) (lreg): replaced x86_call_reg with x86_call_code * emit-x86.c (mono_add_jump_info): impl. (mono_compute_branches): patch real jump address (instead of emitting code twice) Tue Feb 26 11:56:03 CET 2002 Paolo Molaro * x86.brg: optimize cmp reg,0 -> test reg. Sun Feb 24 13:58:34 CET 2002 Paolo Molaro * jit.h, jit.c, emit-x86.c: Added a few statistics counters and the --stats command line option to print them. Fixed memory leak in arch_compile_method () when a method's code is found in the cache. Fix magic trampoline to deal with static calls. 2002-02-21 Dietmar Maurer * x86.brg: impl. SHR_UN for lreg, added new test, bug fix for BNE_UN 2002-02-19 Dietmar Maurer * emit-x86.c (arch_compile_method): add shared code to mono_root_domain (arch_create_jit_trampoline): cache trampoline code 2002-02-18 Dietmar Maurer * jit.c (mono_analyze_stack): optimize LDSFLD/STSFLD for domain specific code. (mono_analyze_stack): use MB_TERM_LDELEMA to perform bound check * x86.brg: do not encode exception objects into the instruction stream, because they are domain dependend. Use arch_get_throw_exception_by_name() instead; Mon Feb 18 15:51:40 CET 2002 Paolo Molaro * jit.c: intern command line arguments. 2002-02-18 Dietmar Maurer * jit.c (mono_analyze_stack): use the magic trampoline for all calls (since we cant store the address of compiled code in method->addr). (mono_analyze_stack): imp. LDSTR for shared code * emit-x86.c (x86_magic_trampoline): handle x86_call_code(). (arch_compile_method): add a cache for compiled methods to avoid recompilation. dont use method->addr to store domain dependent code address. 2002-02-15 Dietmar Maurer * x86.brg: impl. BLE,BGT for freg Sat Feb 16 16:27:42 CET 2002 Paolo Molaro * emit-x86.c: handle unreachable code. Eliminate some unneeded malloc() calls. * jit.c: handle unreachable code. Move setting of mono_end_of_stack to main(). Add --compile classname and --ncompile num command line options to do performance evaluation of the jitter (and help debugging). 2002-02-15 Dietmar Maurer * emit-x86.c (arch_compile_method): bug fix in static delegate Invoke code. 2002-02-14 Dietmar Maurer * jit.c (mono_analyze_stack): do a LDIND after NEWOBJ for value types. 2002-02-13 Dietmar Maurer * jit.c (mono_analyze_stack): impl. CEE_SIZEOF 2002-02-13 Miguel de Icaza * jit.c (arch_allocate_var): Only assert that the alignment is at least 32-bits aligned, not always 32-bits aligned (for I8 for example). Mon Feb 11 11:20:57 CET 2002 Paolo Molaro * x86.brg: fix invalid cast check in unbox. Pack MBTree structure. Sun Feb 10 12:54:05 CET 2002 Paolo Molaro * emit-x86.c: make x86_magic_trampoline() handle call instructions with an imm8 displacement. x86.brg not yet changed to take advantage of it. Sun Feb 10 11:47:30 CET 2002 Paolo Molaro * jit.c: use opcode info from libmetadata to do flow analysis and simplify code. 2002-02-06 Dietmar Maurer * jit.c (MAKE_LDELEM, MAKE_STELEM): added bound checking 2002-02-05 Dietmar Maurer * x86.brg: use element_class for type check 2002-02-04 Dietmar Maurer * jit.c (main): impl. __array_Address icall * mempool.c (mono_mempool_alloc): handle large block allocation 2002-02-01 Dietmar Maurer * x86.brg: impl. SHL/SHR/CLT for 64 bit values 2002-01-31 Dietmar Maurer * x86.brg: impl. CEQ(lreg,lreg) * jit.c (mono_analyze_stack): impl. LDVIRTFTN (mono_analyze_stack): handle MONO_TABLE_MEMBERREF in LDSFLD/STSFLD * x86.brg: removed some dead code. 2002-01-18 Dietmar Maurer * jit.c (arch_allocate_var): fixed alignment bugs 2002-01-17 Dietmar Maurer * jit.c (mono_analyze_stack): use LDIND_REF/STIND_REF 2002-01-16 Dietmar Maurer * jit.c (main): install the trampoline before we start to create objects. * x86.brg: impl. CLT_UN, CGT_UN * emit-x86.c (leave_method): added check for null object (enter_method): consider byref arguments 2002-01-14 Dietmar Maurer * x86.brg: bug fix in CONV_OVF_I1_UN impl. ADD_OVF, MUL_OVF impl. ADD_OVF_UN, SUB_OVF, SUB_OVF_UN (SUB (lreg, lreg)): bug fix - use SBB instead of SUB (EMIT_COND_EXCEPTION): added signed flag Fri Jan 11 20:06:22 CET 2002 Paolo Molaro * jit.c: implement stloc, ldloc, ldloca. 2002-01-11 Dietmar Maurer * jit.c (mono_analyze_stack): fixed calculation of last_instr * x86.brg (LDLEN): emit null_reference exception (BLE_UN): bug fix. (RET, RET_VOID, RET_OBJ, ...) fixed jump to epilog 2002-01-04 Dietmar Maurer * x86.brg: bug fix in CASTCLASS 2001-12-21 Dietmar Maurer * jit.c (mono_analyze_stack): spill MUL to avoid problem with register allocation. * emit-x86.c (arch_compile_method): fixed static delegate bug 2001-12-16 Miguel de Icaza * x86.brg, jit.c: Split up the nodes that we used to share on CONV_OVF. They were sharing the nodes because they are the same on 32-bit machines, but on 64-bit machines you need different code for them. 2001-12-17 Dietmar Maurer * x86.brg: removed prerequisite that (tree->left->reg1 < tree->right->reg1) to make register allocation easier. 2001-12-16 Dietmar Maurer * emit-x86.c (arch_handle_exception): new code to handle exceptions inside unmanaged code. * x86.brg: impl. SAVE_LMF, RESTORE_LMF, pass implizit valuetype address as first argument. 2001-12-15 Dietmar Maurer * x86.brg: pass exceptions on the stack * jit.h (ISSTRUCT): new macro to check for real value types (return false for enum types). 2001-12-11 Dietmar Maurer * x86.brg: use position indepentent code if possible. * x86.brg (EMIT_COND_EXCEPTION): new macro. * emit-x86.c (mono_emit_cfg): impl. variable code buffer size 2001-12-10 Dietmar Maurer * jit.c (mono_analyze_flow): use g_malloc0 o allocate large bcinfo blocks. (mono_analyze_flow): use g_malloc0 o allocate large bblocks array. * x86.brg (stmt): added opt. for STIND_R4/STIND_R8 2001-12-07 Dietmar Maurer * jit.c (mono_allocate_intvar): bug fix. * emit-x86.c (get_unbox_trampoline): impl. * jit.c (mono_analyze_stack): impl STOBJ, LEAVE 2001-12-06 Dietmar Maurer * x86.brg: raise exceptions. 2001-12-05 Dietmar Maurer * x86.brg: impl. CEQ for freg, NEWSTRUCT now allocates valuetypes on the stack. 2001-12-06 Miguel de Icaza * jit.c (mono_analyze_stack), x86.brg: Implement CONV.OVF.I1, CONV.OVF.I4, CONV.OVF.I1.UN, CONV.OVF.U1, CONV.OVF.U1.UN, CONV.OVF.I2.UN, CONV.OVF.I8.UN 2001-12-04 Dietmar Maurer * x86.brg: impl. UNBOX, NEWSTRUCT, removed VTYPE, bug fixes, removed the locaddr nonterminal, reimplemented value types * jit.c: reimplemented value type support, better support for enumeration types. 2001-12-03 Miguel de Icaza * x86.brg, jit.c: Implement conv.ovf.u4, conv.ovf.u2, conv.ovf.i2, conv.ovf.u8 Mon Dec 3 17:16:36 CET 2001 Paolo Molaro * jit.c: call mono_init() after registering internal calls. 2001-11-30 Dietmar Maurer * emit-x86.c (tree_preallocate_regs): improved register allocation * x86.brg: impl. ISINST, CASTCLASS Fri Nov 30 12:02:24 CET 2001 Paolo Molaro * x86.brg: rearrange fields to reduce struct size. * jit.c: use signature->param_count, not signature->params_size. * debug.c: off-by-one error fix. 2001-11-29 Radek Doulik * Makefile.am: build mono only for X86 architecture, compilation fails for ppc now because of accessing registers in sigcontext structure 2001-11-29 Dietmar Maurer * jit.c (mono_analyze_stack): bug fix in DUP Thu Nov 29 12:32:01 CET 2001 Paolo Molaro * debug.c: fix type handling. Position function position at start of IL code. Output more fine-grained stepping information. 2001-11-28 Dietmar Maurer * x86.brg (LDIND_I1, LDIND_I2): use x86_widen_ instead of x86_mov_ * jit.c (mono_analyze_stack): record the cli_address for later use with gdb. (sigsegv_signal_handler): translate sigsegv into "Internal error" exception. Tue Nov 27 16:32:41 CET 2001 Paolo Molaro * debug.c, debug.h: added support for generating stabs. Stabs can be compiled with as and the resulting object file can be loaded in a gdb session with add-symbol-file object.o. * jit.c, jit.h: add --stabs and --debug command line arguments. Keep track where locals and arguments are stored in the stack. Add support for passing command line arguments to CLR programs. * emit-x86.c: insert a breakpoint at method invocation if needed. 2001-11-27 Dietmar Maurer * jit.c: exception support * emit-x86.c (arch_emit_epilogue): bug fix: restore the regs in the right order. 2001-11-26 Dick Porter * Makefile.am (mono_LDADD): Add io-layer library 2001-11-19 Dietmar Maurer * jit.c (mono_analyze_stack): impl. LDFTN (MAKE_SPILLED_BI_ALU): always spill DIV/REM results to memory to make register allocation easier on x86 * emit-x86.c (enter_method): more debugging output for Strings (arch_compile_method): added delegate support (arch_compile_method): align EBP to 8 byte boundary Mon Nov 19 11:36:22 CET 2001 Paolo Molaro * jit.c: use mono_install_trampoline (), instead of exporting a function to a lower-level library. 2001-11-16 Dietmar Maurer * x86.brg (STRING_ARG): impl. a way to marshal strings. This will be extensible to handle all possible kinds of marshalling requirements. * jit.c (map_call_type): added MB_TERM_CALL_VOID (mono_analyze_stack): impl. LDELEMA, reimplemented CALL instructions to handle this arguments more effectively. 2001-11-15 Dietmar Maurer * Makefile.am (mono_SOURCES): renamed testjit to mono * x86.brg: added debugging support * testjit.c: added support for value types, CFG improvements * emit-x86.c (enter_method): handle value types (tree_allocate_regs): impl. a better way to handle chain rules 2001-11-10 Dietmar Maurer * x86.brg (INITOBJ): bug fix: initialize data before use, simplified the code. 2001-11-09 Miguel de Icaza * testjit.c (mono_analyze_stack): Remove compiler warning by testing against NULL. 2001-11-09 Dick Porter * Makefile.am (testjit_LDADD): Don't need THREAD_LIBS any more 2001-11-09 Dietmar Maurer * testjit.c (mono_analyze_stack): new BOX impl. * x86.brg: implemented INITOBJ * testjit.c (mono_analyze_stack): finished array support (mono_analyze_stack): reimplemented DUP instruction 2001-11-08 Dietmar Maurer * testjit.c (MAKE_STELEM, MAKE_LDELEM): we build a tree which represents the address of the element. This way we can emit highly optimized x86 instructions to access elements (using base+index+offset adressing mode) 2001-11-07 Miguel de Icaza * mempool.c: Include string.h to kill warning. * testjit.c: Add typecast to kill warning. * x86.brg: Include string.h to eliminate warning. * emit-x86.c (tree_allocate_regs): Fix arguments to g_warning to kill warning. 2001-11-07 Dietmar Maurer * emit-x86.c (enter_method): print out all method arguments (x86_magic_trampoline): impl. (arch_create_simple_jit_trampoline): we use different trampolines for static methods (no need to write the address back into to vtable). 2001-11-06 Dietmar Maurer * emit-x86.c (arch_create_jit_trampoline): optimised trampoline to use less the 16 bytes. * x86.brg: code cleanup 2001-11-05 Dietmar Maurer * testjit.c: bug fixes. * emit-x86.c (leave_method): print result values 2001-11-03 Dietmar Maurer * emit-x86.c (enter_method): new debugging code (leave_method): new debbuging code, this functions are called when you use the new option --trace-calls 2001-11-02 Dietmar Maurer * testjit.c: impl. STELEM_XX, STELEM_XX * x86.brg: impl. LDLEN, LDELEMA 2001-10-15 Dietmar Maurer * x86.brg: added some experimental code for CALL instructions - still not found the optimal way to do it. * testjit.c (map_stind_type): add support for value types with a size of 1, 2 or 4 bytes, implemented CEE_UNBOX, CEE_LDOBJ, CEE_LDSTR, CEE_LDFLD, CEE_LDFLDA, CEE_STFLD, CEE_NEWOBJ, CEE_CEQ (ctree_create_newobj): impl. * emit-x86.c (tree_allocate_regs): removed allocation code for addr nonterminal. (get_address): use a simple, but bug free search instead of the buggy binary search. 2001-10-12 Dietmar Maurer * testjit.c: support virtual functions * x86.brg: support different addressing modes for calls 2001-10-11 Dietmar Maurer * testjit.c: impl. STFLD 2001-10-10 Dietmar Maurer * x86.brg: impl. CEQ 2001-10-04 Dick Porter * testjit.c: * emit-x86.c: include mono-endian.h not endian.h 2001-10-02 Dietmar Maurer * testjit.c (ctree_create_dup): really duplicate the tree. attach the arguments to the CALL node. Added a new macro to make argument order configurable (ARCH_ARGS_RIGHT_TO_LEFT). 2001-10-01 Dietmar Maurer * interp.brg: the burm based interpreter: added the file as example. 2001-09-27 Dietmar Maurer * x86.brg: cleanup * testjit.c: impl. LDIND/STIND/LDLOCA, use g_malloc to alloc static data. (map_stind_type): support enum types (map_ldind_type): support enum types * emit-x86.c (tree_allocate_regs): added code to support register allocation for addressing modes trees. (tree_emit): bug fix: we have to emit all mono_burg_functins. The previous impl. did not work for chain rules. (compute_branches): support for SWITCH statements * x86.brg: added rules to model x86 addressing modes 2001-09-26 Dietmar Maurer * emit-x86.c (compute_branches): implemented SWITCH * testjit.c (mono_create_forest): implemented LDIND/STIND opcodes (map_ldind_type): add enumeration types. (map_stind_type): add enumeration types. * emit-x86.c (arch_compile_method): more documentation. * testjit.c: moved the architecture specific things to emit-x86.c and x86.brg. Added more documentation. code cleanup. 2001-09-25 Dietmar Maurer * x86.brg: we now have different types of addresses: ADDR_L for local values, ADDR_A for arguments and ADDR_G for global addresses. We also use LDIND_XX token to load values from a specific address instead of LDLOC/STLOC. * testjit.c: use the new adressing scheme everywhere: LDIND _XX (ADDR_X), and STIND_XX (ADDR_X, tree) 2001-09-24 Dietmar Maurer * testjit.c (main): fix bug in parameter parsing * x86.brg: impl. more opcodes 2001-09-23 Dick Porter * Makefile.am (testjit_LDADD): rename PTHREAD_LIBS to THREAD_LIBS 2001-09-23 Dietmar Maurer * testjit.c: use the memory pool to avoid memory leaks 2001-09-22 Dietmar Maurer * x86.brg: increment the stack pointer after function calls 2001-09-21 Dick Porter * Makefile.am (testjit_LDADD): Added PTHREAD_LIBS to the link line 2001-09-21 Dietmar Maurer * x86.brg: implemented long MUL/DIV (MB_OPT_LEVEL): define optimisation level macro * testjit.c (tree_allocate_regs): added a way to prevent EDX usage for operations like idiv. it is also possible to assign specific registers. 2001-09-20 Dietmar Maurer * x86.brg: added basic support for long * testjit.c (mono_compile_method): implemented POP 2001-09-19 Miguel de Icaza * testjit.c (usage): Added a couple of more usage options. 2001-09-19 Dietmar Maurer * x86.brg: added more floating point grammar * testjit.c (mono_compile_method): make local offsets negative * x86.brg: added some floating point trees * testjit.c (mono_compile_method): arguments on the runtime stack are at least 4 bytes * x86.brg: partly implemented 8,16 bit integers * testjit.c (get_address): mark basic blocks 2001-09-18 Dietmar Maurer * x86.brg: added some rules to optimize code * testjit.c (get_address): use a binary search to get the address (main): added an option to debug the jit (-d) Tue Sep 18 13:19:16 CEST 2001 Paolo Molaro * testjit.c: better/faster align code. Handle ldloc.s and stloc.s. 2001-09-17 Miguel de Icaza * testjit.c (mono_compile_method): Provide better error reporting. 2001-09-17 Dietmar Maurer * testjit.c (tree_get_address): impl. to fix address bug (tree_get_address): make sure that we can only jump to the first instruction of a tree. * x86.brg: emit real code for calls * testjit.c (create_jit_trampoline): creates a function to trigger jit compilation. (mono_compile_method): reversed argument order 2001-09-15 Dietmar Maurer * x86.brg (stmt): don't emit unnecessary register moves * testjit.c (tree_allocate_regs): free registers earlier 2001-09-14 Dietmar Maurer * x86.brg: branch addresses are now resolved * testjit.c (compute_branches): compute address of branches * x86.brg: emit real x86 instructions * testjit.c: call objdump to disassemble the output 2001-09-13 Dietmar Maurer * x86.brg: use the right offsets to access local variables and arguments. * emit-x86.c: only save/restore callee saved registers if they are really modified. * testjit.c (tree_allocate_regs): use the new MonoRegSet to allocate registers. (mono_compile_method): changed the tree for mothod calls * regset.h: impl. * regset.c: impl. 2001-09-10 Miguel de Icaza * x86.brg: Use Unix assembly syntax. * emit-x86.c: support code, should be moved * testjit.c: Use GPtrArrays instead of GLists, as those are very inefficient at appends. * Renamed `create_new_leave' to `create_new_leaf'