Compare commits

...
Author SHA1 Message Date
Zoltan Varga db39bf4937 2008-07-22 Zoltan Varga <[email protected]>
* mini.c (mini_method_compile): Rename the COUNT env variable to
	MONO_COUNT.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=108449
2008-07-22 10:28:37 +00:00
Zoltan Varga e69505ce7e Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=108396
2008-07-21 18:04:28 +00:00
Zoltan Varga dbcd6bfaab 2008-07-21 Zoltan Varga <[email protected]>
* method-to-ir.c (mini_emit_load_intf_bit_reg_class): Fix the aot case.

	* debug-mini.c (mono_debug_close_method): Use cfg->locals/args instead of
	indexing into the varinfo array.
	(write_variable): Handle dead variables more gracefully.

	* method-to-ir.c (UNVERIFIED): Sync with the version in mini.c.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=108395
2008-07-21 17:58:37 +00:00
Zoltan Varga f5c7674018 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=108368
2008-07-21 16:13:16 +00:00
Zoltan Varga 8d5b97e1c8 2008-07-21 Zoltan Varga <[email protected]>
* method-to-ir.c: Merge all the remaining mini.c changes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=108345
2008-07-21 14:21:07 +00:00
Zoltan Varga 88eaa3b38d 2008-07-16 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Merge ldtoken sharing changes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=108083
2008-07-16 19:34:29 +00:00
Zoltan Varga 6e15e7cc94 2008-07-16 Zoltan Varga <[email protected]>
* mini.c method-to-ir.c mini-amd64.c: More generic sharing updates.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=108082
2008-07-16 19:19:29 +00:00
Zoltan Varga 851b6d558e 2008-07-16 Zoltan Varga <[email protected]>
* mini.c jit-icalls.h jit-icalls.c: Move mono_object_castclass () to
	jit-icalls.c.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=108049
2008-07-16 15:45:46 +00:00
Zoltan Varga d65ffcd876 2008-07-16 Zoltan Varga <[email protected]>
* method-to-ir.c: Merge unbox sharing changes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=108026
2008-07-16 13:16:05 +00:00
Zoltan Varga db8f861d24 2008-07-15 Zoltan Varga <[email protected]>
* method-to-ir.c (emit_get_rgctx): Fix some FIXMEs.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=107938
2008-07-15 10:25:27 +00:00
Zoltan Varga 1d23cf4603 2008-07-14 Zoltan Varga <[email protected]>
* method-to-ir.c: Clean up the get_runtime_generic_context functions a bit:
	rename them to emit_get_rgctx_..., reduce number of parameters, pass the
	important parameters last.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=107912
2008-07-14 21:58:26 +00:00
Zoltan Varga 9fe8127292 Merge some of the generic sharing changes.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=107909
2008-07-14 21:31:01 +00:00
Zoltan Varga fb276e9c81 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=107904
2008-07-14 20:41:06 +00:00
Zoltan Varga 2829e1c9c3 2008-06-26 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Handle cases when ldfld is called with
	a vtype on the stack, instead of an address.

	* iltests.il.in (HAS_VALUE): Add a test.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=106684
2008-06-26 20:56:11 +00:00
Zoltan Varga bd6b57c749 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=106677
2008-06-26 20:02:54 +00:00
Zoltan Varga a0839a37b6 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=105508
2008-06-10 22:26:43 +00:00
Zoltan Varga c93c6dcb39 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=104647
2008-06-02 10:26:15 +00:00
Zoltan Varga b01cdd4f72 2008-05-30 Zoltan Varga <[email protected]>
* ir-emit.h (NEW_VARLOADA): Mark the component vars of a long var INDIRECT
	as well.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=104520
2008-05-30 13:55:07 +00:00
Zoltan Varga b937cc95bb 2008-05-30 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_local_regalloc): Fix some issues related to fixed sreg2
	allocation.

	* Makefile.am: Don't run bench.exe on make check, it takes too much time.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=104514
2008-05-30 13:38:36 +00:00
Zoltan Varga 324255795e 2008-05-22 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Merge more generic sharing changes missed
	earlier.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=103805
2008-05-22 16:33:31 +00:00
Zoltan Varga 36963777d7 2008-05-19 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Remove non-vtype restriction for
	generic sharing of NEWARR.

	* mini.c (mini_method_compile): Use cfg->args [0] for accessing the this 
	argument.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=103434
2008-05-18 23:33:42 +00:00
Zoltan Varga 372fcb7b55 2008-05-19 Zoltan Varga <[email protected]>
* mini.h (get_vreg_to_inst): Use braces around the argument.

	* method-to-ir.c: Check unverifiable status after calls to handle_stack_args ().
	Update FIXMEs.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=103433
2008-05-18 23:08:39 +00:00
Zoltan Varga 4213167b49 2008-05-19 Zoltan Varga <[email protected]>
* method-to-ir.c: Merge --debug=casts support.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=103431
2008-05-18 22:50:22 +00:00
Zoltan Varga 33d387f065 2008-05-18 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Merge generic sharing changes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=103428
2008-05-18 21:11:00 +00:00
Zoltan Varga bd2a5787a7 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=103425
2008-05-18 19:11:50 +00:00
Zoltan Varga 8ef2943e88 2008-05-07 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Optimize ldobj+stobj pairs.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=102739
2008-05-07 16:30:22 +00:00
Zoltan Varga dc8de752d2 2008-04-17 Zoltan Varga <[email protected]>
* branch-opts.c (mono_if_conversion): Remove some restrictions which are not
	 needed.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=100957
2008-04-16 23:26:04 +00:00
Zoltan Varga 5d8cd8a1e8 2008-04-14 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_local_regalloc): Free the hreg of a dreg even if the
	dreg is alive since the branches inside bblocks problem doesn't exist on
	the linear IR branch.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=100634
2008-04-14 12:16:03 +00:00
Zoltan Varga 20941b9e22 2008-04-14 Zoltan Varga <[email protected]>
* branch-opts.c (mono_if_conversion): Re-run the if conversion on merged blocks
	too. Rerun local optimizations if there was an if-conversion.

	* local-propagation.c (mono_local_deadce): Use MONO_INS_HAS_NO_SIDE_EFFECT.

	* mini.h (MONO_INS_HAS_NO_SIDE_EFFECT): Moved here from branch-opts.c, renamed from
	INS_HAS_NO_SIDE_EFFECT, added more instructions.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=100615
2008-04-14 00:35:10 +00:00
Zoltan Varga 549e9e15d2 2008-04-14 Zoltan Varga <[email protected]>
* local-propagation.c (mono_local_deadce): Eliminate OP_IADD_IMM/OP_ISUB_IMM
	as well.
	(mono_local_cprop2): Allow further iterations after a constant fold. Also
	special case ISUB/IADD pairs.

	* mini-codegen.c (mono_local_regalloc): If CLOB is '1', try to allocate
	sreg1 to the same hreg as dreg, to avoid a copy later.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=100614
2008-04-13 23:52:43 +00:00
Zoltan Varga f850c091e9 2008-04-13 Zoltan Varga <[email protected]>
* method-to-ir.c (type_from_op): Set ins->klass if ins->type is STACK_MP.
	(mono_spill_global_vars): Handle soft float.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=100584
2008-04-13 18:45:55 +00:00
Zoltan Varga 265e667831 2008-04-13 Zoltan Varga <[email protected]>
* mini-arm.c (mono_arch_emit_call): Fix passing of r4 arguments on the stack in
	the soft float case.

	* mini.c (mono_op_imm_to_op): Use OP_IADD/OP_LADD instead of OP_PADD since the
	later is mapped to CEE_ADD.

	* method-to-ir.c (mono_handle_soft_float): Fix a typo.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=100552
2008-04-13 13:20:23 +00:00
Zoltan Varga cf8e05c0a0 2008-04-11 Zoltan Varga <[email protected]>
* mini.c (mini_method_compile): Set cfg->opt by disabling SSAPRE instead of
	enabling everything.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=100465
2008-04-11 18:56:16 +00:00
Zoltan Varga fe5e127c24 2008-04-11 Zoltan Varga <[email protected]>
* mini-ppc.c (NEW_INS): Use mono_bblock_insert_after_ins ().

svn path=/branches/vargaz/mini-linear-il/mono/; revision=100462
2008-04-11 18:38:30 +00:00
Paolo Molaro 069f0ce2c5 Fri Apr 11 18:44:31 CEST 2008 Paolo Molaro <[email protected]>
* cpu-ppc.md, mini-ppc.c, mini-ppc.h, mini.h, decompose.c: first cut
	of powerpc port.


svn path=/branches/vargaz/mini-linear-il/mono/; revision=100454
2008-04-11 16:45:47 +00:00
Zoltan Varga a38a9a8d66 2008-04-11 Zoltan Varga <[email protected]>
* mini-arm.c (NEW_INS): Fix this after the ins_list changes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=100440
2008-04-11 15:20:37 +00:00
Zoltan Varga e3c5aabf6c 2008-04-11 Zoltan Varga <[email protected]>
* method-to-ir.c: Remove a FIXME, we are now faster on scimark as well.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=100430
2008-04-11 13:12:16 +00:00
Zoltan Varga c2e8cce063 2008-04-11 Zoltan Varga <[email protected]>
* mini-amd64.h (MONO_ARCH_EMIT_BOUNDS_CHECK): Add MONO_ARCH_EMIT_BOUNDS_CHECK
	definition which somehow got missing.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=100429
2008-04-11 13:08:12 +00:00
Zoltan Varga fff996aae3 2008-04-07 Zoltan Varga <[email protected]>
* method-to-ir.c (MONO_ARCH_EMIT_BOUNDS_CHECK): Move the arch-specific definitions
	to mini-amd64.h/mini-x86.h.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=100024
2008-04-07 15:48:09 +00:00
Zoltan Varga 3df8dbd498 2008-04-07 Zoltan Varga <[email protected]>
* method-to-ir.c: Add a FIXME.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99988
2008-04-06 23:14:43 +00:00
Zoltan Varga 7794268a51 2008-04-07 Zoltan Varga <[email protected]>
* method-to-ir.c: Move the branch+bblock macros to ir-emit.h as well.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99987
2008-04-06 23:02:43 +00:00
Zoltan Varga e32f635d7f 2008-04-07 Zoltan Varga <[email protected]>
* method-to-ir.c: Split up this now giant file a bit: Move the instruction 
	emission macros to ir-emit.h, and the various decompose functions to 
	decompose.c.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99986
2008-04-06 22:52:56 +00:00
Zoltan Varga e8fbd6100c 2008-04-05 Zoltan Varga <[email protected]>
* local-propagation.c: Move the if-conversion pass to branch-opts.c where it belongs.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99902
2008-04-05 10:35:42 +00:00
Zoltan Varga b5996d4d56 2008-04-05 Zoltan Varga <[email protected]>
* mini.c: Enable MONO_OPT_SSA if abcrem or ssapre is enabled, so code only needs to
	check whenever SSA is enabled.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99901
2008-04-05 10:33:02 +00:00
Zoltan Varga ab05d88d85 2008-04-02 Zoltan Varga <[email protected]>
* local-propagation.c (mono_branch_to_cmov): Rename this to mono_if_conversion ().

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99695
2008-04-02 21:41:56 +00:00
Zoltan Varga 64f8723ff7 2008-04-02 Zoltan Varga <[email protected]>
* mini.h mini.c method-to-ir.c: Rename cfg->disable_extended_bblocks to 
	cfg->enable_extended_bblocks. Add some comments as to why it is currently 
	disabled.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99692
2008-04-02 21:23:46 +00:00
Zoltan Varga 1b47579f1f 2008-04-01 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_handle_global_vregs): Make the component vregs of a long
	vreg volatile if the IR also uses the original vreg.

	* mini.c (mono_compile_create_var_for_vreg): Only make the component vregs of
	a long vreg volatile if it is needed by optimizations.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99574
2008-04-01 20:15:05 +00:00
Zoltan Varga c667560e5e 2008-04-01 Zoltan Varga <[email protected]>
* mini-x86.c (mono_arch_emit_inst_for_method): Add support for Min/Max.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99567
2008-04-01 19:39:03 +00:00
Zoltan Varga dda1fa727c 2008-04-01 Zoltan Varga <[email protected]>
* local-propagation.c (mono_local_cprop2): Avoid copy propagation if it would
	make it impossible to use reverse copy propagation later.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99566
2008-04-01 19:38:15 +00:00
Zoltan Varga 25c754f99d 2008-04-01 Zoltan Varga <[email protected]>
* local-propagation.c (mono_local_cprop2): Make def_index a gint32, so the
	def_index checks actually work. Also, disable copy propagation for floats.

	* method-to-ir.c (mono_spill_global_vars): Avoid using a previous lvreg for the
	destination, since this makes little sense, and it makes the liveness interval of
	the lvreg longer, leading to worse generated code.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99559
2008-04-01 18:36:04 +00:00
Zoltan Varga c6be527773 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=99550
2008-04-01 17:08:37 +00:00
Zoltan Varga 2971a77ea3 2008-04-01 Zoltan Varga <[email protected]>
* mini-s390.c (add_stackParm): Increase sz->stack_size.
	(mono_arch_allocate_vars): Handle vtype addresses passed on the stack.
	(mono_arch_output_basic_block): Fix OP_ADDCC.
	(mono_arch_decompose_long_opts): Remove OP_LADD, the generic code works for that
	too.

	* object.cs: Add tests for passing a vtype addr on the stack on s390.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99539
2008-04-01 16:05:34 +00:00
Zoltan Varga a18944c912 2008-04-01 Zoltan Varga <[email protected]>
* mini-s390.c (mono_arch_output_basic_block): Fix OP_ICONV_TO_I1/I2.

	* basic.cs: Add new tests.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99484
2008-03-31 22:40:22 +00:00
Zoltan Varga d5db38f930 2008-03-31 Zoltan Varga <[email protected]>
* method-to-ir.c (mini_emit_inst_for_method): Use LEA in the get_Chars 
	implementation.

	* mini-amd64.c (mono_arch_output_basic_block): Avoid a rex prefix in
	LOADU1/LOADU2_MEMBASE.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99432
2008-03-31 16:06:53 +00:00
Zoltan Varga 47ee6f6b0d 2008-03-31 Zoltan Varga <[email protected]>
* mini-s390.c (mono_arch_emit_call): Fix a problem when passing a vtype address 
	on the stack.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99421
2008-03-31 13:41:15 +00:00
Zoltan Varga d446baf6df 2008-03-31 Zoltan Varga <[email protected]>
* mini-s390.c (mono_arch_output_basic_block): Fix SUBCC implementation.
	(mono_arch_decompose_long_opts): Remove LSUB, the generic code works on s390 too.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99417
2008-03-31 12:36:04 +00:00
Zoltan Varga 147e8a0e8f 2008-03-30 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_local_regalloc): Add asserts for some situations which are
	not yet handled.

	* cpu-s390.md: Remove clob:1 from some opcodes where it is not needed to avoid
	tripping up the local register allocator.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99348
2008-03-30 16:29:26 +00:00
Zoltan Varga f0be15f518 2008-03-30 Zoltan Varga <[email protected]>
* method-to-ir.c (decompose_opcode): Handle OP_LCONV_TO_OVF_U8_UN.

	* mini.c (mono_decompose_op_imm): Set bb->max_vreg.

	* mini-s390.c: Fix build.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99316
2008-03-30 10:21:04 +00:00
Zoltan Varga 590f425785 2008-03-29 Zoltan Varga <[email protected]>
* mini-s390.c: Fix build.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99308
2008-03-29 21:19:31 +00:00
Zoltan Varga 53767b2294 2008-03-29 Zoltan Varga <[email protected]>
* mini-s390x.c (mono_arch_allocate_vars): Fix vararg calls which return a 
	vtype.

	* cpu-s390x.md: Avoid clob:1 on some opcodes, since mono_arch_output_basic_block
	already handles them.

	* mini-s390.c (get_call_info): Fix passing of small float/double structures.
	
	* mini-s390x.c (get_call_info): Fix passing of small float/double structures.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99305
2008-03-29 19:22:01 +00:00
Zoltan Varga cbfd23cf41 2008-03-29 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Add sign extension to the SWITCH 
	implementation just as in inssel.brg.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99292
2008-03-29 16:23:29 +00:00
Zoltan Varga a402181ea7 2008-03-29 Zoltan Varga <[email protected]>
* cpu-s390x.md mini-s390x.c: Add int_conv_to_r_un.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99270
2008-03-29 05:06:49 +00:00
Zoltan Varga 68e9866d6c 2008-03-28 Zoltan Varga <[email protected]>
* inssel-s390x.brg cpu-s390x.md mini-s390x.h mini-s390x.c: Finish S390 port.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99229
2008-03-28 18:00:59 +00:00
Zoltan Varga 31f07bcf5f 2008-03-28 Zoltan Varga <[email protected]>
* mini.c (mini_method_compile): Print a different message when a shared method is
	compiled.

	* mini-s390.c (emit_load_volatile_registers): Fix a merge problem.

	* method-to-ir.c (mono_method_to_ir2): Fix build on platforms without
	MONO_ARCH_VTABLE_REG defined.

	* cpu-s390x.md mini-s390x.h mini-s390x.c: Implement long/float/call support.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99185
2008-03-28 11:36:39 +00:00
Zoltan Varga 551e4073dd 2008-03-26 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Fix generic sharing support in ldtoken.

	* gshared.cs: Add new tests.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99043
2008-03-26 17:22:40 +00:00
Zoltan Varga c8ea79a789 2008-03-26 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Ongoing generic sharing work.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=99000
2008-03-26 00:17:26 +00:00
Zoltan Varga c29ddc5aea 2008-03-25 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Implement generic sharing of NEWOBJ and
	LDTOKEN.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98992
2008-03-25 20:12:32 +00:00
Zoltan Varga 83e83befee 2008-03-25 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Simplify the newobj vtype code a bit.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98989
2008-03-25 19:20:23 +00:00
Zoltan Varga d80a88ab66 2008-03-25 Zoltan Varga <[email protected]>
* method-to-ir.c: Disable generic sharing for most opcodes to avoid running into
	not-implemented parts.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98986
2008-03-25 18:52:25 +00:00
Zoltan Varga 952d650bd9 2008-03-25 Zoltan Varga <[email protected]>
* method-to-ir.c: Port some of the generic sharing changes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98977
2008-03-25 16:06:08 +00:00
Zoltan Varga a4f96fc6d0 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=98948
2008-03-25 09:23:50 +00:00
Zoltan Varga 28279efc6c 2008-03-25 Zoltan Varga <[email protected]>
* mini-amd64.c (add_valuetype): Fix handling of vtypes in the managed case.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98939
2008-03-25 07:37:11 +00:00
Zoltan Varga d046baba56 2008-03-24 Zoltan Varga <[email protected]>
* method-to-ir.c (NEW_I8CONST): Set ins->type.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98923
2008-03-24 21:43:28 +00:00
Zoltan Varga 60eb63cb61 2008-03-24 Zoltan Varga <[email protected]>
* cpu-amd64.md (lcompare_imm): Move the _membase_imm opcodes to one place.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98916
2008-03-24 21:07:29 +00:00
Zoltan Varga f4493b5cb9 2008-03-24 Zoltan Varga <[email protected]>
* method-to-ir.c (op_to_op_src1_membase): Disable OP_X86_COMPARE_MEMBASE8_IMM on
	amd64 as well.
	(decompose_opcode): Add some missing opcodes.

	* cpu-amd64.md: Add amd64_sub_membase_imm, fix the lengths of the load_mem 
	opcodes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98915
2008-03-24 21:01:17 +00:00
Zoltan Varga b98f9a9770 2008-03-24 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Fix the amd64 build.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98905
2008-03-24 19:24:09 +00:00
Zoltan Varga bb86d1ae82 2008-03-24 Zoltan Varga <[email protected]>
* mini-<ARCH>.c (mono_arch_emit_call): Remove the unused 'is_virtual' argument.

	* mini-x86.c method-to-ir.c mini.c local-propagation.c: Fix some small bugs.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98904
2008-03-24 19:22:39 +00:00
Zoltan Varga 228b794298 2008-03-24 Zoltan Varga <[email protected]>
* mini-x86.c (mono_arch_emit_call): Fix win32 and apple support.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98872
2008-03-24 14:25:27 +00:00
Zoltan Varga 993e2006bf 2008-03-24 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_decompose_long_opts): Handle OP_LCONV_TO_OVF_U and
	OP_LCONV_TO_OVF_U_UN.

	* mini-x86.c: Fix x86 build.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98856
2008-03-24 12:16:21 +00:00
Zoltan Varga cab239fbc1 2008-03-23 Zoltan Varga <[email protected]>
* mini-s390.c (mono_arch_emit_call): Remove some dead code.

	* mini-s390x.h mini-s390x.c cpu-s390x.md: Ongoing S390x porting work.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98835
2008-03-23 18:41:06 +00:00
Zoltan Varga d3a68ca7da Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=98832
2008-03-23 15:58:06 +00:00
Zoltan Varga 6424a77dec 2008-03-22 Zoltan Varga <[email protected]>
* mini-s390.h mini-s390.c: Avoid using the same registers for local and global 
	reg allocation. Finish the S390 port.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98776
2008-03-21 23:59:58 +00:00
Zoltan Varga 078b428610 2008-03-21 Zoltan Varga <[email protected]>
* inssel.brg: Use MONO_INST_NEW in MONO_EMIT_NEW_ICONST () since that is called
	by the backends.

	* method-to-ir.c (mini_emit_inst_for_method): Fix an assert on 32 bit platforms.
	(mono_method_to_ir2): Fix the LDLOCA+INITOBJ optimization in case of primitive types.

	* mini-s390.c mini-ops.h cpu-s390.md: Ongoing S390 porting work.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98773
2008-03-21 21:27:41 +00:00
Zoltan Varga f39cfca18c 2008-03-21 Zoltan Varga <[email protected]>
* abcremoval2.c (mono_perform_abc_removal2): Fix reading of invalid memory.

	* method-to-ir.c (MONO_INST_NEW): Initialize ins->type as well.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98760
2008-03-21 18:39:50 +00:00
Zoltan Varga c84225f927 2008-03-21 Zoltan Varga <[email protected]>
* method-to-ir.c (decompose_opcode): Call an arch-specific decompose function if
	defined.
	(mono_spill_global_vars): Fix a bug when converting moves into stores.

	* mini.c (mono_op_imm_to_op): Handle LOCALLOC_IMM.

	* mini-ops.h mini-s390.h mini-s390.c cpu-s390.md: Ongoing S390 porting work.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98749
2008-03-21 17:06:59 +00:00
Zoltan Varga c466b866be Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=98673
2008-03-20 14:44:50 +00:00
Zoltan Varga 10157d6d4f 2008-03-19 Zoltan Varga <[email protected]>
* mini-x86.c: Fix the x86 port after the ins list changes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98623
2008-03-19 19:09:43 +00:00
Zoltan Varga 908338ed49 2008-03-19 Zoltan Varga <[email protected]>
* mini-amd64.c (mono_arch_peephole_pass_2): Remove some dead code.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98620
2008-03-19 18:47:46 +00:00
Zoltan Varga 8810665a8e 2008-03-19 Zoltan Varga <[email protected]>
* mini-s390.c (calculate_sizes): Rename this to get_call_info for consistency
	with the other architectures, add an 'mp' argument, fold 'sz' argument into the
	return value.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98619
2008-03-19 18:28:13 +00:00
Zoltan Varga f6c598d72a 2008-03-19 Zoltan Varga <[email protected]>
* mini-s390.c (mono_arch_peephole_pass_2): Fix this after the ins list changes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98611
2008-03-19 18:16:17 +00:00
Zoltan Varga 876ad302da 2008-03-19 Zoltan Varga <[email protected]>
* mini.c (mono_replace_ins): Fix some issues after the ins list changes.

	* regalloc2.c: Fix compilation on non-amd64 platforms.

	* mini-s390.c: Ongoing porting work.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98607
2008-03-19 16:56:32 +00:00
Zoltan Varga 5d5eb8da74 2008-03-19 Zoltan Varga <[email protected]>
* method-to-ir.c (MONO_EMIT_BOUNDS_CHECK): Decompose this early if abcrem is
	disabled to help some local optimizations.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98599
2008-03-19 14:56:57 +00:00
Zoltan Varga 481d770f90 2008-03-19 Zoltan Varga <[email protected]>
* mini-codegen.c: Remove some dead code and add micro optimizations from HEAD.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98592
2008-03-19 13:16:11 +00:00
Zoltan Varga f516f33648 2008-03-19 Zoltan Varga <[email protected]>
* local-propagation.c (mono_local_cprop2): Clean up the div/rem strength 
	reduction stuff.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98590
2008-03-19 12:38:18 +00:00
Zoltan Varga f648837255 2008-03-19 Zoltan Varga <[email protected]>
* *.h *.c: Transition to using prev-next pointers on MonoInst's using more user
	friendly APIs.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98588
2008-03-19 12:25:00 +00:00
Zoltan Varga 319b1c1f25 2008-03-17 Zoltan Varga <[email protected]>
* mini-amd64.h mini-amd64.c: Emit the IMT argument right before the call to make
	it easier for mono_arch_find_imt_method () to find it.

	* regalloc2.c: New unified local/global register allocator implementation.

	* mini.h mini.c mini-amd64.c: Changes required by the new register allocator.

	* tests.cs: Tests for the new register allocator.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98493
2008-03-17 20:56:48 +00:00
Zoltan Varga 1cc761e82d 2008-03-13 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_op_to_op_imm): Handle OP_LOCALLOC as well.
	(mono_method_to_ir2): Don't convert OP_LOCALLOC to OP_LOCALLOC_IMM here, it is
	done automatically by the constant propagation pass.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98192
2008-03-13 17:50:47 +00:00
Zoltan Varga 791a25ab22 2008-03-12 Zoltan Varga <[email protected]>
* mini-ops.h: Add OP_TAILCALL.
	
	* mini.h (MonoCallInst): Add a 'tail_call' flag.

	* mini.h (MONO_IS_CALL): Consider OP_TAILCALL as well.

	* method-to-ir.c: Handle tail calls similarly to normal calls by emitting argument
	passing code in mono_arch_emit_call (). This eliminates the need to mark arguments
	as volatile and also eliminates emit_load_volatile_arguments ().

	* mini-amd64.c cpu-amd64.md: Add support for OP_TAILCALL.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=98041
2008-03-12 12:29:33 +00:00
Zoltan Varga 8756e99a2b 2008-03-08 Zoltan Varga <[email protected]>
* local-propagation.c (mono_local_cprop2): Optimize the sext+storei1/storei2
	instruction combination.
	(mono_local_deadce): Ditto.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=97749
2008-03-08 12:18:14 +00:00
Zoltan Varga e29d2b0cb8 2008-03-07 Zoltan Varga <[email protected]>
* cpu-amd64.md: Add clob:1 to some float opcodes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=97708
2008-03-07 17:36:59 +00:00
Zoltan Varga 8f81bc5524 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=97685
2008-03-07 13:06:46 +00:00
Zoltan Varga df2f145eb7 2008-03-05 Zoltan Varga <[email protected]>
* mini-ops.h: Add some new s390 opcodes.

	* method-to-ir.c (mono_decompose_long_opts): Add a new arch-specific function to
	decompose some long opcodes.

	* mini-s390.h mini-s390.c cpu-s390.md: Ongoing s390 work.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=97418
2008-03-05 17:05:39 +00:00
Zoltan Varga deb6a69d00 2008-03-04 Zoltan Varga <[email protected]>
* mini-amd64.c mini.h mini.c: Add support for passing small valuetypes in
	registers in managed methods.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=97299
2008-03-04 13:45:04 +00:00
Zoltan Varga 2198893997 2008-03-04 Zoltan Varga <[email protected]>
* local-propagation.c (mono_local_deadce): Do reverse copyprop for OP_VMOVE as
	well.

	* mini-amd64.c (mono_arch_get_this_arg_reg): New arch-specific function used
	to return the index of the register holding the this argument for a call.

	* tramp-amd64.c (mono_arch_get_unbox_trampoline): Use mono_arch_get_this_arg_reg.

	* mini-amd64.c method-to-ir.c mini.c: Add support for returning small valuetypes 
	in registers in managed methods.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=97286
2008-03-04 11:39:13 +00:00
Zoltan Varga 327e3d216f 2008-03-04 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_print_ins_index): Add special support for a few opcodes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=97265
2008-03-04 02:09:52 +00:00
Zoltan Varga 4bda4ad9ac 2008-03-04 Zoltan Varga <[email protected]>
* local-propagation.c (mono_local_deadce): Avoid treating the inputs of
	eliminated instructions as used.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=97262
2008-03-04 00:53:55 +00:00
Zoltan Varga a67ffdfcf3 2008-03-04 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Optimize the ldloca+initobj combination.

	* generics.cs: Add a test for the ldloca+initobj optimization.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=97249
2008-03-03 22:32:03 +00:00
Zoltan Varga 8ea4979701 2008-03-03 Zoltan Varga <[email protected]>
* local-propagation.c (mono_branch_to_cmov): Fix checking of whenever negation
	of the condition is needed.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=97222
2008-03-03 19:45:46 +00:00
Zoltan Varga e4466d9011 2008-03-02 Zoltan Varga <[email protected]>
* local-propagation.c (mono_local_deadce): Avoid reverse copyprop on hard
	registers.

	* method-to-ir.c (mono_method_check_inlining): Avoid disabling inlining if the
	called methods class has no cctor.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=97140
2008-03-02 18:22:40 +00:00
Zoltan Varga c392ee6831 2008-03-02 Zoltan Varga <[email protected]>
* mini-amd64.c (mono_arch_emit_call): Emit most parameters in non-reverse order.
	(mono_arch_emit_prolog): Re-enable the first bblock optimization.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=97137
2008-03-02 17:13:04 +00:00
Zoltan Varga 9093e4963c 2008-03-02 Zoltan Varga <[email protected]>
* local-propagation.c (mono_local_deadce): Make the reverse copyprop optimization
	more generic.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=97120
2008-03-02 10:12:44 +00:00
Zoltan Varga f8fa2262b8 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=96987
2008-02-29 16:39:30 +00:00
Zoltan Varga 6bab05b864 2008-02-29 Zoltan Varga <[email protected]>
* mini-ops.h mini-s390.c inssel-s390.brg: Ongoing S390 work.

	* method-to-ir.c (mono_spill_global_vars): Fix a comment.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=96955
2008-02-29 11:56:22 +00:00
Zoltan Varga 56850a7131 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=96068
2008-02-18 16:19:48 +00:00
Zoltan Varga 236fd96e77 2008-02-16 Zoltan Varga <[email protected]>
* mini-s390.c cpu-s390.md: Ongoing s390 work.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=95899
2008-02-16 16:26:48 +00:00
Zoltan Varga ebe33a4f92 2008-02-15 Zoltan Varga <[email protected]>
* mini-s390.h mini-s390.c cpu-s390.md mini-ops.h: Ongoing s390 work.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=95758
2008-02-15 14:48:17 +00:00
Zoltan Varga aaba542d2d 2008-02-15 Zoltan Varga <[email protected]>
* exceptions-arm.c mini-arm.c cpu-arm.md: Fix arm build.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=95743
2008-02-15 12:16:38 +00:00
Zoltan Varga c5f77e70fa 2008-02-15 Zoltan Varga <[email protected]>
* method-to-ir.c (mini_emit_inst_for_method): Fix 64 bit issues in array access
	implementation.
	(mini_emit_ldelema_1_ins): Ditto.

	* mini-ia64.c cpu-ia64.md: Fix ia64 build.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=95734
2008-02-15 11:52:35 +00:00
Zoltan Varga d8968fd609 2008-02-14 Zoltan Varga <[email protected]>
* cpu-sparc.md mini-sparc.c: Fix sparc build.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=95672
2008-02-14 17:56:04 +00:00
Zoltan Varga 046ec6ac45 2008-02-14 Zoltan Varga <[email protected]>
* mini-x86.c (mono_arch_emit_outarg_vt): Pass a reasonable alignment to
	mini_emit_memcpy2 ().

svn path=/branches/vargaz/mini-linear-il/mono/; revision=95651
2008-02-14 17:02:44 +00:00
Zoltan Varga 729e6679af 2008-02-14 Zoltan Varga <[email protected]>
* cpu-x86.md mini-x86.c: Fix x86 build.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=95647
2008-02-14 16:58:38 +00:00
Zoltan Varga c86794f081 2008-02-13 Zoltan Varga <[email protected]>
* mini-amd64.c (mono_arch_emit_outarg_vt): Pass a reasonable alignment to
	mini_emit_memcpy2 ().

svn path=/branches/vargaz/mini-linear-il/mono/; revision=95596
2008-02-13 20:48:27 +00:00
Zoltan Varga 8dad606832 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=95547
2008-02-12 19:29:39 +00:00
Zoltan Varga bb2d55478f 2008-02-06 Zoltan Varga <[email protected]>
* mini-s390.c cpu-s390.md: Preliminary S390 port work.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=95056
2008-02-06 17:56:48 +00:00
Zoltan Varga 52c1e83d9b 2008-02-06 Zoltan Varga <[email protected]>
* linear-scan.c (mono_linear_scan2): Avoid using GMAXINT32 which is not
	defined in older glib versions.

	* local-propagation.c: Add a default definition for MONO_ARCH_IS_OP_MEMBASE ()
	if not defined.

	* mini-<ARCH>.h: Remove MONO_ARCH_IS_OP_MEMBASE () definition.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=95027
2008-02-06 14:44:06 +00:00
Zoltan Varga 3d64c600c8 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=95002
2008-02-06 08:50:25 +00:00
Zoltan Varga 9bf91b4feb 2008-02-06 Zoltan Varga <[email protected]>
* mini-s390.c mini-s390x.c: Get rid of CEE_ opcodes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=94970
2008-02-05 23:05:18 +00:00
Zoltan Varga 9207376076 2008-02-06 Zoltan Varga <[email protected]>
* cpu-<ARCH>.md mini-<ARCH>.c: Get rid of the unused CEE_LDIND/STIND opcodes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=94967
2008-02-05 22:48:07 +00:00
Zoltan Varga f9dbaee0fe Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=94963
2008-02-05 21:48:54 +00:00
Zoltan Varga 76a62bb09b Merge tests missed earlier.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=94961
2008-02-05 21:41:16 +00:00
Zoltan Varga bfce304e49 2008-02-05 Zoltan Varga <[email protected]>
* cpu-<ARCH>.md mini-<ARCH>.md: Get rid of CEE_ opcodes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=94960
2008-02-05 21:40:06 +00:00
Zoltan Varga d9fe12e558 2008-02-05 Zoltan Varga <[email protected]>
* cpu-amd64.md mini-amd64.c: Remove unused opcodes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=94945
2008-02-05 20:35:35 +00:00
Zoltan Varga 10eefa8410 2008-02-05 Zoltan Varga <[email protected]>
* mini.c (mono_normalize_opcodes): New pass to get rid of CEE_ opcodes.

	* mini-amd64.c mini-amd64.c: Get rid of CEE_ opcodes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=94930
2008-02-05 19:26:45 +00:00
Zoltan Varga 68aa9c4146 2008-02-05 Zoltan Varga <[email protected]>
* cpu-amd64.md: Fix x86_mul_membase.

	* inssel.brg: Pass OP_CALL to backends instead of CEE_CALL.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=94925
2008-02-05 19:10:54 +00:00
Zoltan Varga ff5bdc0608 2008-02-03 Zoltan Varga <[email protected]>
* mini-x86.c (mono_arch_emit_prolog): Add a missing assert.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=94715
2008-02-03 19:13:04 +00:00
Zoltan Varga 05f47b9cef 2008-02-03 Zoltan Varga <[email protected]>
* mini-x86.c (mono_arch_emit_prolog): Increase the prolog size.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=94714
2008-02-03 19:10:47 +00:00
Zoltan Varga 00a3294c55 2008-02-03 Zoltan Varga <[email protected]>
* local-propagation.c (mono_branch_to_cmov): Fix some asserts.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=94702
2008-02-03 17:33:27 +00:00
Zoltan Varga 21c4c05ded 2008-02-03 Zoltan Varga <[email protected]>
* mini.c (mini_method_compile): Disable extended bblocks for now.
	(mono_replace_ins): Fix unlinking of bblocks.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=94699
2008-02-03 17:03:46 +00:00
Zoltan Varga 1bfc685eac 2008-02-03 Zoltan Varga <[email protected]>
* local-propagation.c: Fix the div_imm strength reduction optimization.

	* mini-sparc.c (mono_arch_allocate_vars): Fix build.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=94698
2008-02-03 16:21:50 +00:00
Zoltan Varga d00c87d510 2008-02-03 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Merge the cctor call before alloc workaround
	from mini.c.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=94694
2008-02-03 15:27:13 +00:00
Zoltan Varga d44b3b9cc5 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=94009
2008-01-26 18:42:30 +00:00
Zoltan Varga 02f3f27e5f 2008-01-26 Zoltan Varga <[email protected]>
* mini-sparc.c mini-ia64.c: Fix build.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=94004
2008-01-26 18:20:03 +00:00
Zoltan Varga 8d0d9f49c7 2008-01-26 Zoltan Varga <[email protected]>
* *.md: Remove op_ opcode prefixes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=94000
2008-01-26 18:12:18 +00:00
Zoltan Varga 04f50be0c5 2008-01-26 Zoltan Varga <[email protected]>
* method-to-ir.c: Implement the delegate ctor optimization.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=93994
2008-01-26 16:16:10 +00:00
Zoltan Varga c1a48dc4b4 2008-01-26 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Use the mono_helper_ldstr_mscorlib opt
	in the non AOT case as well.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=93989
2008-01-26 14:58:34 +00:00
Zoltan Varga d765ba339d 2008-01-26 Zoltan Varga <[email protected]>
* mini-amd64.c (peephole_pass): Ignore NOPs in the instruction stream.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=93988
2008-01-26 14:29:39 +00:00
Zoltan Varga a44448070c 2008-01-26 Zoltan Varga <[email protected]>
* mini.h: Remove some duplicate declarations which crept in during merges.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=93986
2008-01-26 13:59:39 +00:00
Zoltan Varga 58b959e8ea 2008-01-26 Zoltan Varga <[email protected]>
* mini.h mini.c method-to-ir.c: Only run the local opts pass after 
	spill_global_vars if it is useful.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=93985
2008-01-26 13:52:37 +00:00
Zoltan Varga 606b6694e7 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=93839
2008-01-24 21:21:52 +00:00
Zoltan Varga 0c60df0482 2008-01-24 Zoltan Varga <[email protected]>
* method-to-ir.c: Remove some macros which are in mini.h.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=93806
2008-01-24 15:36:36 +00:00
Zoltan Varga 517bb1122b Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=93801
2008-01-24 15:23:25 +00:00
Zoltan Varga f66359c448 Partial merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=93796
2008-01-24 14:17:46 +00:00
Zoltan Varga e04bca4458 2008-01-02 Zoltan Varga <[email protected]>
* method-to-ir.c (MONO_EMIT_NEW_BRANCH_BLOCK): Don't start a new basic block here.
	(mono_op_to_op_imm): Add OP_AMD64_ICOMPARE_MEMBASE_IMM.

	* mini.h (MonoBasicBlock): Add an 'extended' flag to mark whenever this bblock
	is extended.

	* mini.h (MonoCompile): Add a 'disable_extended_bblocks' flag.

	* mini.c (optimize_branches): Add an optimization for merging basic blocks into
	an extended basic block.

	* local-propagation.c ssa2.c mini-codegen.c: Add support for extended basic 
	blocks.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=92117
2008-01-02 16:55:59 +00:00
Zoltan Varga 40fca8ff0c 2007-12-22 Zoltan Varga <[email protected]>
* cpu-amd64.md: Fix the size of int opcodes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91803
2007-12-22 02:07:16 +00:00
Zoltan Varga 85be7629a3 2007-12-22 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_decompose_long_opts): Fix a typo.

	* mini.c mini-ops.h inssel-long.brg inssel-long32.brg simple-mini-ops.h:
	Rename OP_LONG_SHRUN_32 to OP_LSHR_UN_32 for consistency.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91801
2007-12-22 01:58:07 +00:00
Zoltan Varga 887f84c05b 2007-12-20 Zoltan Varga <[email protected]>
* mini-amd64.c: Use OP_FMOVE instead of OP_AMD64_SET_XMMREG_R8 if possible.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91717
2007-12-20 16:35:53 +00:00
Zoltan Varga 24918e87d3 2007-12-20 Zoltan Varga <[email protected]>
* mini-amd64.c (add_outarg_reg2): Get rid of the 'arg' argument.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91669
2007-12-19 23:44:40 +00:00
Zoltan Varga 103368eca8 2007-12-19 Zoltan Varga <[email protected]>
* mini-ia64.c mini-sparc.c: Get rid of mono_arch_break (), use mono_break ()
	instead.

	* method-to-ir.c: Fix build.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91663
2007-12-19 21:34:34 +00:00
Zoltan Varga 187ec8f8cc 2007-12-19 Zoltan Varga <[email protected]>
* *: Add soft-float support.

	* driver.c: Add a new debug option --break-at-bb to insert breakpoints at a
	specified bblock.

	* helpers.c: Fix disassembly on arm.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91659
2007-12-19 21:07:05 +00:00
Zoltan Varga 6c1c2cf55c 2007-12-18 Zoltan Varga <[email protected]>
* mempool.c (mono_mempool_destroy): Remove some debug cruft.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91507
2007-12-18 01:21:27 +00:00
Zoltan Varga 4261092d46 2007-12-16 Zoltan Varga <[email protected]>
* Add preliminary ARM port.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91397
2007-12-16 20:41:17 +00:00
Zoltan Varga 7555b4156c 2007-12-15 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_handle_global_vregs): Fix crashes on 32 bit systems.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91365
2007-12-15 22:14:33 +00:00
Zoltan Varga fd8196551d 2007-12-15 Zoltan Varga <[email protected]>
* method-to-ir.c (MINI_OP): Fix	breakage.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91364
2007-12-15 20:49:37 +00:00
Zoltan Varga a5d0cc42be 2007-12-15 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_handle_global_vregs): Compress the varinfo tables as
	lots of variables might be made dead by this pass.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91359
2007-12-15 19:25:28 +00:00
Zoltan Varga d52c8e9f1f 2007-12-15 Zoltan Varga <[email protected]>
* mini.c (mini_method_compile): Move the check for too-large methods later.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91358
2007-12-15 19:19:09 +00:00
Zoltan Varga c7acca34e3 2007-12-15 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_handle_global_vregs): Optimize this a little.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91353
2007-12-15 16:44:48 +00:00
Zoltan Varga ffd2295671 2007-12-15 Zoltan Varga <[email protected]>
* liveness.c (mono_analyze_liveness): Reorganize this to improve data locality
	a bit.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91352
2007-12-15 14:55:08 +00:00
Zoltan Varga 01a610385f 2007-12-14 Zoltan Varga <[email protected]>
* mini.h (MonoInst): Reorder members so frequently used members come first.

	* method-to-ir.c mini.c: Add flags to MonoCompile and MonoBasicBlock so the
	decompose_array_access_opts () pass is only run when needed.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91329
2007-12-14 21:05:07 +00:00
Zoltan Varga 89da65fa10 2007-12-14 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_handle_global_vregs): Disable some code which slows down
	compilation too much.

	* liveness.c (mono_analyze_liveness): Disable the new liveness code as it slows
	down compilation too much.

	* mini-codegen.c (mono_regstate_assign): Remove an unnecessary memset.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91301
2007-12-14 17:32:38 +00:00
Zoltan Varga d2d097a4f4 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=91293
2007-12-14 15:32:49 +00:00
Zoltan Varga 6808cf4f0a 2007-12-14 Zoltan Varga <[email protected]>
* mini-<ARCH>.c: Add a 'src' argument to mono_arch_emit_outarg_vt () to remove
	some duplicated code.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91288
2007-12-14 14:36:35 +00:00
Zoltan Varga 565a2cd8a5 2007-12-12 Zoltan Varga <[email protected]>
* method-to-ir.c (decompose_opcode): Handle OP_FCONV_TO_R8 here.

	* mini-<ARCH>.c cpu-<ARCH>.md: Remove OP_FCONV_TO_R8.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=91159
2007-12-12 15:58:47 +00:00
Zoltan Varga b40839ac01 2007-12-04 Zoltan Varga <[email protected]>
* local-propagation.c (mono_branch_to_cmov): Only run this if MONO_ARCH_HAVE_CMOV_OPTS is defined.

	* mini-amd64.h mini-x86.h: Define the cmov define.

	* mini-ops.h: Add OP_SWITCH opcode.

	* mini.h: Move the IS_JUMP_INFO defines here from mini.c.

	* ssa2.c (visit_inst): Handle OP_SWITCH.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=90713
2007-12-04 21:06:53 +00:00
Zoltan Varga d39f7be3a6 2007-12-04 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_op_to_op_imm): Add more opcodes.
	
	* mini-amd64.c (mono_arch_lowering_pass): Use mono_op_to_op_imm () here.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=90699
2007-12-04 17:03:08 +00:00
Zoltan Varga c3ad8125e8 2007-12-04 Zoltan Varga <[email protected]>
* mini-ia64.c (mono_arch_emit_call): Move some small stuff to arch independent
	code.

	* mini-sparc.c (mono_arch_emit_call): Ditto.

	* mini-amd64.c (mono_arch_emit_call): Ditto.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=90688
2007-12-04 16:03:40 +00:00
Zoltan Varga 984d68baf7 2007-11-29 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_op_to_op_imm): Add more opcodes.

	* mini-x86.c (mono_arch_lowering_pass): Lower some div/rem opcodes here.
	(mono_arch_output_basic_block): Remove opcodes lowered earlier.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=90451
2007-11-29 18:14:16 +00:00
Zoltan Varga eb61b825f6 2007-11-28 Zoltan Varga <[email protected]>
* mini.c (mono_bblock_insert_after_ins): New helper function.

	* mini-x86.c mini-amd64.c mini-ia64.c: Use the new helper function.

	* mini-x86.c cpu-x86.md: Add cmov opcodes.

	* local-propagation.c: Add div imm optimizations from the current JIT.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=90395
2007-11-28 17:43:38 +00:00
Zoltan Varga 05a2d66932 2007-11-21 Zoltan Varga <[email protected]>
* method-to-ir.c (handle_unbox_nullable): Disable AOT here since we can't encode
	the method reference.
	(handle_box): Ditto.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=90096
2007-11-21 17:29:59 +00:00
Zoltan Varga 9b8d3cc5fd 2007-11-21 Zoltan Varga <[email protected]>
* local-propagation.c (mono_branch_to_cmov): Implement another form
	of branch->cmov conversion.

	* mini.c (mini_method_compile): Reorder order of optimizations a bit.

	* mini.c: Export some bblock related functions.

	* basic.cs: Add more branch->cmov tests.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=90092
2007-11-21 16:52:58 +00:00
Zoltan Varga df455992b7 2007-11-21 Zoltan Varga <[email protected]>
* mini-ops.h: Add CMOV opcodes.

	* cpu-amd64.md mini-amd64.c: Implement CMOV opcodes.

	* local-propagation.c: Add a branch->conditional move transformation pass.

	* driver.c: Add CMOV to default optimizations.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=90057
2007-11-21 01:52:09 +00:00
Zoltan Varga a14418ee56 2007-11-20 Zoltan Varga <[email protected]>
* mini-ops.h: Add OP_IMIN,OP_IMAX,OP_LMIN,OP_LMAX opcodes.

	* mini-amd64.c: Implement cpuid function. Implement min/max intrinsics based
	on conditional moves.

	* basic-math.cs: Add min/max tests.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=90010
2007-11-20 18:44:40 +00:00
Zoltan Varga ac8f008e4f 2007-11-19 Zoltan Varga <[email protected]>
* local-propagation.c (mono_local_cprop2): Fix detection of MONO_ARCH_USE_FPSTACK. Allow the result of a call to be copy propagated.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=89912
2007-11-19 04:37:12 +00:00
Zoltan Varga 04c7025aa6 2007-11-19 Zoltan Varga <[email protected]>
* method-to-ir.c (handle_isinst): Remove unused ip argument.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=89911
2007-11-19 00:28:21 +00:00
Zoltan Varga 713ea6f2b9 2007-11-18 Zoltan Varga <[email protected]>
* mini-ops.h: Add new opcode OP_NOT_NULL.

	* mini.h: Add MONO_CFG_HAS_CHECK_THIS cfg flag.

	* method-to-ir.c: Emit OP_NOT_NULL instructions in a few places. Set
	the CHECK_THIS flag when emitting OP_CHECK_THIS instructions.

	* abcremoval2.c (process_block): Eliminate needless OP_CHECK_THIS instructions.

	* cpu-<ARCH>.md mini-<ARCH>.c: Add support for OP_NOT_NULL instruction.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=89902
2007-11-18 20:23:12 +00:00
Zoltan Varga 8f2279a65a 2007-11-18 Zoltan Varga <[email protected]>
* abcremoval2.c (remove_abc_from_inst): Derive relations from bounds check
	instructions in order to optimize array accesses made with the same index
	variable.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=89900
2007-11-18 18:14:49 +00:00
Zoltan Varga c0327f0f50 2007-11-18 Zoltan Varga <[email protected]>
* method-to-ir.c: Merge generic sharing changes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=89880
2007-11-18 01:02:03 +00:00
Zoltan Varga ef733eeed7 2007-11-18 Zoltan Varga <[email protected]>
* mini-amd64.c mini-x86.c mini-ia64.c: Remove usage of OP_ICONV_TO_I4 which is
	never passed to the back ends.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=89879
2007-11-18 00:22:09 +00:00
Zoltan Varga 29c77cd0ff Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=89864
2007-11-17 17:13:34 +00:00
Zoltan Varga ea6af8b79a Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=89824
2007-11-17 01:13:47 +00:00
Zoltan Varga 5c1f284b62 2007-09-03 Zoltan Varga <[email protected]>
* mini-sparc.c (mono_arch_allocate_vars): Fix sparc build.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=85232
2007-09-03 14:42:19 +00:00
Zoltan Varga ddfa475f63 2007-09-03 Zoltan Varga <[email protected]>
* mini.c (mono_compile_create_var_for_vreg): Handle enums whose basetype is i8.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=85204
2007-09-02 22:05:58 +00:00
Zoltan Varga 970c942354 2007-09-03 Zoltan Varga <[email protected]>
* mini-x86.c cpu-x86.md: Fix x86 build.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=85203
2007-09-02 21:38:51 +00:00
Zoltan Varga cf28984e4f 2007-09-02 Zoltan Varga <[email protected]>
* cpu-sparc.md (endfilter): Add missing src1:i argument.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=85202
2007-09-02 20:53:40 +00:00
Zoltan Varga 484e2bec5c 2007-09-02 Zoltan Varga <[email protected]>
* mini-sparc.c (mono_arch_output_basic_block): Fix OP_IDIV_IMM.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=85200
2007-09-02 20:04:04 +00:00
Zoltan Varga 0e60bd47c0 2007-09-01 Zoltan Varga <[email protected]>
* ssa2.c (mono_ssa_compute2): Increase the stack history size.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=85177
2007-09-01 20:20:56 +00:00
Zoltan Varga 045c3aea88 2007-08-31 Zoltan Varga <[email protected]>
* method-to-ir.c: Fix the CAS functionality.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=85142
2007-08-31 16:34:22 +00:00
Zoltan Varga 831ae6261e 2007-08-30 Zoltan Varga <[email protected]>
* method-to-ir.c: Remove the can_access_ functions and use the 
	mono_method_can_access_ functions instead.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=85070
2007-08-30 19:48:20 +00:00
Zoltan Varga 2bbb6155a6 2007-08-30 Zoltan Varga <[email protected]>
* method-to-ir.c: Merge the memcpy/memset changes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=85067
2007-08-30 19:10:57 +00:00
Zoltan Varga 0af8b3422d Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=85066
2007-08-30 19:03:01 +00:00
Zoltan Varga c0759cfa4a Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=81358
2007-07-04 22:41:37 +00:00
Zoltan Varga 1d6f8750e5 2007-07-04 Zoltan Varga <[email protected]>
* method-to-ir.c: Merge r81282.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=81356
2007-07-04 21:27:09 +00:00
Zoltan Varga c2609195b3 2007-06-07 Zoltan Varga <[email protected]>
* mini-amd64.c (peephole_pass): Merge the peephole_pass () from HEAD.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=78849
2007-06-07 15:19:53 +00:00
Zoltan Varga c8092bd0c2 2007-06-07 Zoltan Varga <[email protected]>
* arrays.cs: Add new regression test.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=78841
2007-06-07 14:33:09 +00:00
Zoltan Varga e49ff0c74e 2007-06-07 Zoltan Varga <[email protected]>
* method-to-ir.c: Merge r78640.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=78840
2007-06-07 14:24:53 +00:00
Zoltan Varga d93412a781 2007-06-05 Zoltan Varga <[email protected]>
* method-to-ir.c: Remove a FIXME.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=78666
2007-06-05 19:33:48 +00:00
Zoltan Varga 3e97f03f46 2007-06-05 Zoltan Varga <[email protected]>
* method-to-ir.c: Merge 77433.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=78664
2007-06-05 19:07:50 +00:00
Zoltan Varga fe760be8a3 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=78653
2007-06-05 17:45:35 +00:00
Zoltan Varga 180674b76a 2007-05-31 Zoltan Varga <[email protected]>
* tramp-ia64.c (mono_arch_create_trampoline_code): Revert this.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=78330
2007-05-31 13:57:02 +00:00
Zoltan Varga c1ea6216d6 2007-05-31 Zoltan Varga <[email protected]>
* tramp-ia64.c (mono_arch_create_trampoline_code): Fix ia64 build.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=78329
2007-05-31 13:55:16 +00:00
Zoltan Varga 1a12c25791 2007-05-28 Zoltan Varga <[email protected]>
* mini.c (mini_select_instructions): Add MONO_INST_NEW in one place.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=78078
2007-05-28 17:08:44 +00:00
Zoltan Varga b41410c253 2007-05-28 Zoltan Varga <[email protected]>
* mini-codegen.c: Remove unused regstate2 functions.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=78072
2007-05-28 16:40:12 +00:00
Zoltan Varga 20eb9b1dfa 2007-05-28 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Fix loading of static fields of type i8.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=78068
2007-05-28 15:44:03 +00:00
Zoltan Varga 7f29417833 2007-05-27 Zoltan Varga <[email protected]>
* abcremoval2.c (mono_perform_abc_removal2): Avoid using alloca.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=78013
2007-05-27 15:30:00 +00:00
Zoltan Varga f7d71dbc54 2007-05-20 Zoltan Varga <[email protected]>
* mini-amd64.c (peephole_pass_1): Handle OP_LCOMPARE_IMM as well.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=77729
2007-05-20 19:40:01 +00:00
Zoltan Varga 781e368c6e 2007-05-19 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_local_regalloc): Fix long-shift-regalloc on amd64.
	(mono_local_regalloc): Clean up the code a bit.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=77697
2007-05-19 19:51:12 +00:00
Zoltan Varga 03199d3013 2007-05-18 Zoltan Varga <[email protected]>
* method-to-ir.c (decompose_opcode): Clean up int->long conversion a bit.

	* mini-amd64.c (mono_arch_output_basic_block): Clean up int->long conversion a bit.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=77659
2007-05-18 17:51:05 +00:00
Zoltan Varga 4aff0a311b 2007-05-14 Zoltan Varga <[email protected]>
* method-to-ir.c: Merge r72357.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=77342
2007-05-14 12:41:27 +00:00
Zoltan Varga e49e22eb09 2007-05-13 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Remove redundant setting of ins->cil_code.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=77323
2007-05-13 16:15:34 +00:00
Zoltan Varga 1ba578b77a 2007-05-13 Zoltan Varga <[email protected]>
* method-to-ir.c: Remove some fixmes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=77320
2007-05-13 16:07:40 +00:00
Zoltan Varga 0304e67009 2007-05-13 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Merge r71065 (Optimize InitArray () calls).

svn path=/branches/vargaz/mini-linear-il/mono/; revision=77313
2007-05-13 14:54:26 +00:00
Zoltan Varga 0c63d2b3c0 2007-05-12 Zoltan Varga <[email protected]>
* mini-x86.c: Remove old definition of INST_IGNORES_CFLAGS.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=77289
2007-05-12 17:44:43 +00:00
Zoltan Varga e5917b9b58 2007-05-12 Zoltan Varga <[email protected]>
* mini-x86.c: Merge apple changes missed earlier.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=77288
2007-05-12 17:41:47 +00:00
Zoltan Varga 1de430b251 2007-05-12 Zoltan Varga <[email protected]>
* mini-codegen.c: Fix x86 build.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=77283
2007-05-12 17:07:16 +00:00
Zoltan Varga 52891ff9ed 2007-05-10 Zoltan Varga <[email protected]>
* linear-scan.c (mono_linear_scan): Update mono_jit_stats.regvars.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=77139
2007-05-10 15:22:21 +00:00
Zoltan Varga 70a9bee68d 2007-05-09 Zoltan Varga <[email protected]>
* method-to-ir.c (decompose_opcode): Fix OP_ICONV_TO_I8.

	* basic-long.cs: Add new test.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=77085
2007-05-09 19:20:01 +00:00
Zoltan Varga 14ca5efab7 2007-05-09 Zoltan Varga <[email protected]>
* linear-scan.c (compare_by_interval_start_pos_func): Fix here too.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=77039
2007-05-09 17:03:54 +00:00
Zoltan Varga f31fc60903 2007-05-09 Zoltan Varga <[email protected]>
* mini.c (compare_by_interval_start_pos_func): Fix comparison of empty intervals.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=77036
2007-05-09 16:50:46 +00:00
Zoltan Varga fb86580a94 2007-05-09 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_spillvar_offset): Avoid an assert here.

	* method-to-ir.c (mono_method_to_ir2): Don't print after-method-to-ir IR in inlined
	methods.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=77027
2007-05-09 15:12:57 +00:00
Zoltan Varga cac7518cc3 2007-05-09 Zoltan Varga <[email protected]>
* mini.c (mini_method_compile): Remove unused coalesce_pass.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=77000
2007-05-09 11:46:03 +00:00
Zoltan Varga 62c9f4d928 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=76999
2007-05-09 11:44:26 +00:00
Zoltan Varga 06cdbbfecf 2007-05-09 Zoltan Varga <[email protected]>
* method-to-ir.c (emit_stobj): Get rid of ip argument.
	(mono_emit_call_args): Ditto.
	(mono_emit_calli): Ditto.
	(mono_emit_method_call_full): Ditto.
	(mono_emit_method_call): Ditto.
	(mono_emit_native_call): Ditto.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=76974
2007-05-08 22:15:43 +00:00
Zoltan Varga fa52a4fa4a 2007-05-09 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Set cfg->ip while iterating through
	the IL code. Fixes debugging support.

	* mini.h (MONO_INST_NEW): Set ins->cil_code automatically using cfg->ip.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=76973
2007-05-08 22:05:05 +00:00
Zoltan Varga 00935c4a4f Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=76949
2007-05-08 17:48:23 +00:00
Zoltan Varga 4a514c05b4 2007-05-07 Zoltan Varga <[email protected]>
* mini.c (mini_method_compile): Only decompose_array_access_opts in the new IR.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=76876
2007-05-07 21:49:14 +00:00
Zoltan Varga be57f6b5e6 2007-05-04 Zoltan Varga <[email protected]>
* abcremoval2.c (get_relation_from_ins): Handle OP_IREM_UN as in bug #71576.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=76725
2007-05-04 20:17:37 +00:00
Zoltan Varga 4cb279d5bd 2007-05-04 Zoltan Varga <[email protected]>
* mini-ops.h: Add OP_NEWARR.

	* method-to-ir.c: Decompose CEE_NEWARR after abcrem.

	* abcremoval2.c (summarize_integer_value): Handle CEE_NEWARR too.

	* abcremoval2.c (get_relations_from_previous_bb): Handle OP_ICOMPARE_IMM too.
	
	* abcremoval2.c (mono_perform_abc_removal2): Add symmetric relations.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=76723
2007-05-04 19:54:51 +00:00
Zoltan Varga b999b3dcf6 2007-05-04 Zoltan Varga <[email protected]>
* abcremoval2.c (mono_perform_abc_removal2): Compute variable_value_kind as in the
	original implementation.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=76713
2007-05-04 16:06:20 +00:00
Zoltan Varga a4bf552b52 2007-05-02 Zoltan Varga <[email protected]>
* mini-ops.h: Add OP_LDLEN and OP_BOUNDS_CHECK.

	* method-to-ir.c: Decompose ldlen and bounds checks after abcrem in a separate
	pass.

	* abcremoval2.c: Port the abcrem pass to linear IR.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=76585
2007-05-02 18:40:47 +00:00
Zoltan Varga e3b5e53232 2007-04-29 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_print_ins_index): Remove debug printf.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=76468
2007-04-29 18:32:42 +00:00
Zoltan Varga bc00904dac 2007-04-29 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_print_ins_index): Fix printing of lowered opcodes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=76467
2007-04-29 18:31:49 +00:00
Zoltan Varga c5222f9d8b Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=76260
2007-04-25 16:36:06 +00:00
Zoltan Varga 25cff7231d 2007-04-09 Zoltan Varga <[email protected]>
* method-to-ir.c (mini_emit_class_check_branch): New helper function.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=75537
2007-04-09 15:40:46 +00:00
Zoltan Varga b773326d0b Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=73554
2007-02-28 14:38:27 +00:00
Zoltan Varga 0806c840a0 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=73549
2007-02-28 14:09:09 +00:00
Zoltan Varga 61074d1708 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=73546
2007-02-28 14:03:54 +00:00
Zoltan Varga 1c0da4329d Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=72904
2007-02-15 12:10:49 +00:00
Zoltan Varga ae63739d49 2007-02-15 Zoltan Varga <[email protected]>
* mini-x86.c (emit_load_volatile_arguments): Fix another merge problem.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=72903
2007-02-15 12:04:34 +00:00
Zoltan Varga 16a46697ed 2007-02-14 Zoltan Varga <[email protected]>
* method-to-ir.c (type_to_eval_stack_type): Fix bug introduced by merge.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=72849
2007-02-14 18:00:04 +00:00
Zoltan Varga c8c3d089ff 2007-02-14 Zoltan Varga <[email protected]>
* cpu-x86.md: Resurrect x86 support.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=72848
2007-02-14 17:52:27 +00:00
Zoltan Varga 29e77c4e06 2007-02-14 Zoltan Varga <[email protected]>
* mini-x86.c local-propagation.c mini-codegen.c: Resurrect x86 support.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=72834
2007-02-14 14:50:17 +00:00
Zoltan Varga 05efe1b3bc 2007-02-09 Zoltan Varga <[email protected]>
* method-to-ir.c (mini_emit_class_check): New helper function.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=72550
2007-02-09 17:52:46 +00:00
Zoltan Varga b58f9ed7c3 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=72549
2007-02-09 17:23:03 +00:00
Zoltan Varga b1802a2da5 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=72548
2007-02-09 17:22:42 +00:00
Zoltan Varga 9b92bf15c2 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=72315
2007-02-05 17:46:57 +00:00
Zoltan Varga 55d23bf13b Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=72311
2007-02-05 17:18:25 +00:00
Zoltan Varga 18fe3ba482 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=72308
2007-02-05 17:04:53 +00:00
Zoltan Varga 6b04851f8e Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=72307
2007-02-05 16:53:26 +00:00
Zoltan Varga adad70b7d0 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=72306
2007-02-05 16:47:20 +00:00
Zoltan Varga cd824e97da Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=72218
2007-02-03 13:17:39 +00:00
Zoltan Varga a930c3118b Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=72217
2007-02-03 12:59:49 +00:00
Zoltan Varga 9b2e33f61d Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=72115
2007-02-01 17:38:31 +00:00
Zoltan Varga e69749f927 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=72114
2007-02-01 17:30:49 +00:00
Zoltan Varga e35102e995 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=72112
2007-02-01 17:07:15 +00:00
Zoltan Varga 8962ce85b9 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=66842
2006-10-20 18:01:56 +00:00
Zoltan Varga 7c530f8d05 2006-09-27 Zoltan Varga <[email protected]>
* method-to-ir.c: Add some new comments.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=65945
2006-09-27 09:04:53 +00:00
Zoltan Varga 60afe7defb 2006-09-26 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_print_ins_index): Handle OP_LADD_IMM as well.

	* method-to-ir.c: Add a FIXME.

	* local-propagation.c: Add a new rule for optimizing op_ladd_imm + load_membase.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=65922
2006-09-26 16:03:22 +00:00
Zoltan Varga 8669079ca7 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=65916
2006-09-26 12:22:02 +00:00
Zoltan Varga bc1a06afb3 2006-09-26 Zoltan Varga <[email protected]>
* mini-exceptions.c (mono_handle_exception): Special case ia64 too when determining
	whenever an exception is caught by a try block.

	* mini-ia64.c (mono_arch_allocate_vars): Fix an assert.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=65908
2006-09-26 09:13:34 +00:00
Zoltan Varga b127149ecd 2006-09-26 Zoltan Varga <[email protected]>
* interlocked-2.2.cs: Fix problem with previous change.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=65907
2006-09-26 09:08:05 +00:00
Zoltan Varga cc11906b28 Merge from HEAD. Fix up ia64 atomic ops.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=65906
2006-09-26 08:56:40 +00:00
Zoltan Varga a85aae1f0c 2006-09-26 Zoltan Varga <[email protected]>
* interlocked-2.2.cs: Fix long tests and add Interlocked.Exchange(long) test.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=65902
2006-09-26 08:47:15 +00:00
Zoltan Varga eec8890307 2006-09-26 Zoltan Varga <[email protected]>
* method-to-ir.c mini-x86.h mini-x86.c mini-amd64.h mini-amd64.c: Move the rest of
	the Interlocked instrins creation code to mini_emit_inst_for_method () as well.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=65900
2006-09-26 06:47:16 +00:00
Zoltan Varga 4b0d3705db 2006-09-26 Zoltan Varga <[email protected]>
* mini-amd64.c mini-amd64.c mini-x86.c mini-sparc.: Move check for OP_MEMORY_BARRIER
	from mini_emit_inst_for_method () to mini_emit_inst_for_method ().

svn path=/branches/vargaz/mini-linear-il/mono/; revision=65898
2006-09-26 06:27:24 +00:00
Zoltan Varga bdd27a61b1 2006-09-24 Zoltan Varga <[email protected]>
* method-to-ir.c: Add a comment.

	* mini-codegen.c (mono_local_regalloc): Remove some unused variables.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=65849
2006-09-24 13:00:39 +00:00
Zoltan Varga cbfcbd9fb0 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=65847
2006-09-24 12:20:48 +00:00
Zoltan Varga 1c780b4d1a 2006-09-22 Zoltan Varga <[email protected]>
* mini-x86.c (mono_arch_emit_inst_for_method): Add OP_MEMORY_BARRIER.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=65810
2006-09-22 10:00:58 +00:00
Zoltan Varga 8721e312a1 2006-09-22 Zoltan Varga <[email protected]>
* *.h *.c: Unify int/fp vregs in the old JIT as well. Use this to simplify and 
	speed up the local register allocator.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=65808
2006-09-22 06:38:30 +00:00
Zoltan Varga 48ca4f5393 2006-09-22 Zoltan Varga <[email protected]>
* inssel-amd64.brg (OP_OUTARG_VT): Use state->left->reg1 instead of state->left->dreg.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=65807
2006-09-22 06:20:17 +00:00
Zoltan Varga 3b1f1ce903 2006-09-22 Zoltan Varga <[email protected]>
* local-propagation.c (mono_local_cprop_bb): Fix some warnings.

	* ssa2.c (mono_ssa_rename_vars2): Fix a warning.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=65806
2006-09-22 05:52:41 +00:00
Zoltan Varga 0d2d623982 2006-09-21 Zoltan Varga <[email protected]>
* method-to-ir.c: Add some TODOs.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=65794
2006-09-21 20:06:49 +00:00
Zoltan Varga c1f22693fe 2006-09-09 Zoltan Varga <[email protected]>
* mini-amd64.c (mono_arch_lowering_pass): Handle OP_IDIV_UN_IMM/OP_IREM_UN_IMM as well.

	* *: Change bb->dominated to a GSList. Allocate the list items from the cfg mempool.
	
	* mini.c (replace_out_block_in_code): Handle the AOT case of jump tables as well.
	(mono_merge_basic_blocks): Ditto.

	* method-to-ir.c (mono_spill_global_vars): Get rid of an allocation.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=65146
2006-09-09 11:56:20 +00:00
Zoltan Varga fb996bb222 2006-09-09 Zoltan Varga <[email protected]>
* method-to-ir.c: Avoid the op->op_imm optimization for opcodes which are emulated.

	* mini-ia64.c (mono_arch_emit_call): Port the vararg changes to ia64.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=65145
2006-09-09 10:53:51 +00:00
Zoltan Varga 54cac13960 2006-09-09 Zoltan Varga <[email protected]>
* mini-sparc.c (emit_sig_cookie2): Port the vararg changes to sparc.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=65144
2006-09-09 10:20:43 +00:00
Zoltan Varga b09cf46ef1 2006-09-09 Zoltan Varga <[email protected]>
* *: More rationalizing of opcodes: Get rid of the CEE_... versions of some
	opcodes, use OP_... versions everywhere.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=65138
2006-09-08 22:52:04 +00:00
Zoltan Varga ae25d9d76d Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=65123
2006-09-08 18:23:32 +00:00
Zoltan Varga 8bb5267bc1 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=64795
2006-09-03 10:06:58 +00:00
Zoltan Varga 2c1856150b Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=63680
2006-08-13 13:33:03 +00:00
Zoltan Varga 1e1b63b161 2006-06-24 Zoltan Varga <[email protected]>
* interlocked-2.2.cs: Add Interlocked.Read (long) test.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=62023
2006-06-24 19:13:53 +00:00
Zoltan Varga 19afb00c1a 2006-06-24 Zoltan Varga <[email protected]>
* mini-<ARCH>.c (mono_arch_emit_inst_for_method): Move Thread.MemoryBarrier () and
	Interlocked.Read (long) implementation to mini_emit_inst_for_emit () since it
	is the same for all platforms.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=62022
2006-06-24 19:12:45 +00:00
Zoltan Varga 68a6211030 2006-06-24 Zoltan Varga <[email protected]>
* mini-amd64.c (mono_arch_emit_inst_for_method): Fix Interlocked.Add.

	* mini-ops.h: Fix OP_ATOMIC_ADD_NEW_I8.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=62019
2006-06-24 17:52:06 +00:00
Zoltan Varga dc440f6392 2006-06-23 Zoltan Varga <[email protected]>
* ssa.c: Revert this to the version from HEAD since all the new code is in ssa2.c.

	* *.c: Use OP_NOP everywhere instead of CEE_NOP.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=61996
2006-06-23 21:22:27 +00:00
Zoltan Varga a5542cb6af 2006-06-23 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_local_regalloc): Spill fp regs on calls even on x86.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=61984
2006-06-23 17:00:01 +00:00
Zoltan Varga 4ebd599daf 2006-06-23 Zoltan Varga <[email protected]>
* mini-x86.c (mono_arch_emit_inst_for_method): Fix Interlocked.Add.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=61983
2006-06-23 16:26:23 +00:00
Zoltan Varga e777f5a6cb Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=61921
2006-06-21 22:10:30 +00:00
Zoltan Varga 555b42294b 2006-06-21 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_op_to_op_imm): Enable div/rem -> div_imm/rem_imm conversion.

	* mini-x86.c cpu-pentium.md: Finish support for div/rem imm.

	* mini-codegen.c (mono_local_regalloc): When emitting a copy to put sreg1 in the
	proper fixed reg, update ins->sreg1 as well.

	* basic.cs: Add tests.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=61918
2006-06-21 20:58:40 +00:00
Zoltan Varga 88181bc767 2006-06-19 Zoltan Varga <[email protected]>
* local-propagation.c (mono_local_deadce): Fix a typo in reverse copyprop.

	* method-to-ir.c local-propagation.c mini-x86.c cpu-pentium.md cfold.c: Add
	beginnings of support for DIV/REM_IMM opcodes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=61842
2006-06-19 14:36:02 +00:00
Zoltan Varga 8d4f0d1a9a 2006-06-15 Zoltan Varga <[email protected]>
* linear-scan.c (compare_by_interval_start_pos_func): Fix sorting of variables.

	* liveness.c (mono_analyze_liveness): Fix an assert when COUNT=0 is used.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=61768
2006-06-15 19:22:10 +00:00
Zoltan Varga 416e7d3dab 2006-05-29 Zoltan Varga <[email protected]>
* mini.c local-propagation.c: Move local cprop/copyprop/deadce to local-propagation.c.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=61233
2006-05-29 15:05:35 +00:00
Zoltan Varga b94f833d2c Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=61214
2006-05-28 17:17:15 +00:00
Zoltan Varga 01030d3c43 2006-05-19 Zoltan Varga <[email protected]>
* linear-scan.c (mono_linear_scan2): Avoid negative 'gains'.

	* mini.h (MonoJitStats): Add a 'regvars' statistics.

	* liveness.c linear-scan.c: Improve debug output.

	* mini.c (mono_allocate_stack_slots_full2): Fix some problems with the original
	code, add comments and debug code.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=60878
2006-05-19 20:17:46 +00:00
Zoltan Varga b442ebdc98 Fix merge error.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=60869
2006-05-19 15:29:58 +00:00
Zoltan Varga b7738e7af9 2006-05-19 Zoltan Varga <[email protected]>
* mini.c (mono_allocate_stack_slots_full2): A variant of the original 
	allocate_stack_slots () function using the interval based liveness information.

	* method-to-ir.c (mono_spill_global_vars): Handle dead I8/U8 variables without
	asserting.

	* mini.h (MonoJitStats): Add a new statistics 'locals_stack_size'.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=60868
2006-05-19 15:28:44 +00:00
Zoltan Varga 67ead555a0 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=60842
2006-05-18 21:32:42 +00:00
Zoltan Varga 12777dc0ab 2006-05-13 Zoltan Varga <[email protected]>
* liveness.c (mono_analyze_liveness2): Make this work on 64 bit machines.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=60677
2006-05-13 13:57:01 +00:00
Zoltan Varga 01ca8a9870 2006-05-13 Zoltan Varga <[email protected]>
* liveness.c (mono_analyze_liveness2): Optimize this a bit.

	* linear-scan.c: Add a variant of the linear scan allocator which operates on
	liveness intervals, not ranges.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=60672
2006-05-12 23:08:53 +00:00
Zoltan Varga 8e285f653b 2006-05-10 Zoltan Varga <[email protected]>
* mini.h (MonoLiveInternal): New structure for representing liveness intervals
	by a list of liveness ranges.

	* liveness.c (mono_analyze_liveness2): A variant of the liveness computation
	algorithm which uses liveness intervals instead of just one liveness range.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=60555
2006-05-10 20:36:11 +00:00
Zoltan Varga d7d8b22c24 2006-05-07 Zoltan Varga <[email protected]>
* liveness.c (optimize_initlocals): Eliminate R8CONST as well.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=60390
2006-05-07 21:02:14 +00:00
Zoltan Varga 16aac1dcdf 2006-05-07 Zoltan Varga <[email protected]>
* liveness.c (optimize_initlocals): A new, simple optimization pass to eliminate
	some of the redundant initialization code added by 'locals init'.

	* mini-amd64.c (mono_arch_compute_omit_fp): Omit fp for vtype returns as well.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=60389
2006-05-07 20:42:47 +00:00
Zoltan Varga 1f2264e345 2006-05-04 Zoltan Varga <[email protected]>
* mini.h (MonoCompile): Add 'cil_offset_to_bb' field.

	* mini.c method-to-ir.c ssa2.c branch-opts.c: Use an array instead of a hash
	table for storing the cil offset->bblock associations.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=60259
2006-05-04 13:56:09 +00:00
Zoltan Varga 4df381a138 2006-05-03 Zoltan Varga <[email protected]>
* monobitset.c: Fix mono_bitset_sub again: Use src->size instead of dest->size.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=60237
2006-05-03 21:05:32 +00:00
Zoltan Varga ddf9d1e10e 2006-05-03 Zoltan Varga <[email protected]>
* mini.h *.c: Make cfg->vars an array of structures instead of pointers to 
	cut back on the number of indirections.

	* liveness.c dominators.: Use the new mono_bitset_<XXX>_fast functions.

	* mini.c (mono_local_cprop2): Allocate memory from the cfg mempool.

	* mini.c (mono_local_deadce): Allocate memory from the cfg mempool.	

svn path=/branches/vargaz/mini-linear-il/mono/; revision=60228
2006-05-03 16:48:13 +00:00
Zoltan Varga ea9865e9f7 2006-05-03 Zoltan Varga <[email protected]>
* monobitset.h monobitset.c: Add new macros for performing copy/union operations
	with little overhead.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=60223
2006-05-03 15:58:01 +00:00
Zoltan Varga aab000379e 2006-05-02 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_spill_global_vars): Fix printing of instruction specs.

	* mini.c (mono_local_cprop2): Fix cprop of I8CONST on 32 bit platforms.

	* mini-ops.h: Add some missing OP_L<XXX>_IMM opcodes for consistency.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=60194
2006-05-02 20:05:18 +00:00
Zoltan Varga b9a93c9402 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=60047
2006-04-28 17:53:10 +00:00
Zoltan Varga db2154869c 2006-04-24 Zoltan Varga <[email protected]>
* mini.h *.c: Convert ins_info from an array of strings to an array of characters.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59803
2006-04-24 10:00:13 +00:00
Zoltan Varga 63039e7682 2006-04-20 Zoltan Varga <[email protected]>
* mini-sparc.c (emit_pass_vtype): Fix passing of vtype addresses on the stack.

	* objects.cs: Add test for passing vtype addresses on the stack on sparc.	

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59708
2006-04-20 19:01:25 +00:00
Zoltan Varga 846a69ca81 2006-04-20 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_check_inlining): Fix warnings.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59692
2006-04-20 12:00:46 +00:00
Zoltan Varga a38f1cb11b 2006-04-19 Zoltan Varga <[email protected]>
* mini.c (mono_local_cprop2): Allow copy propagation of OP_VMOVEs across calls.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59651
2006-04-19 16:29:28 +00:00
Zoltan Varga 3a0e532091 2006-04-19 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_check_inlining): Remove some inlining restrictions.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59649
2006-04-19 16:00:46 +00:00
Zoltan Varga 6516d02466 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=59646
2006-04-19 15:24:53 +00:00
Zoltan Varga 0e314c33e3 2006-04-18 Zoltan Varga <[email protected]>
* mini.h method-to-ir.c mini-<ARCH>.c: Put back the 'is_virtual' argument to
	mono_arch_emit_call () as it is needed on x86.

	* method-to-ir.c (mono_spill_global_vars): Reenable the lvreg optimization.

	* mini-x86.c mini-x86.h: Enable the second argument of div/rem opcodes to be
	allocated to %edx, and handle this case in the opcodes themselves.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59595
2006-04-18 15:14:55 +00:00
Zoltan Varga 630fa7a498 2006-04-18 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_spill_global_vars): Disable the lvreg optimization for
	now since it leads to unsolvable situations in the local register allocator.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59590
2006-04-18 14:09:57 +00:00
Zoltan Varga f36459fbfa 2006-04-16 Zoltan Varga <[email protected]>
* mini-ops.h: Add OP_VTARG_ADDR opcode.

	* method-to-ir.c (mono_spill_global_vars): Add support for architectures where
	vtypes are passed by reference, i.e. their address is passed as a parameter.

	* mini-codegen.c (mono_local_regalloc): Clear rs->iassign[] entry for vregs clobbered
	by a call.

	* cpu-sparc.md mini-sparc.c: Sparc porting work.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59530
2006-04-16 22:06:02 +00:00
Zoltan Varga 6ff559c27a 2006-04-16 Zoltan Varga <[email protected]>
* mini-sparc.c: Sparc porting work.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59527
2006-04-16 18:08:31 +00:00
Zoltan Varga 5a655dfc01 2006-04-16 Zoltan Varga <[email protected]>
* mini-<ARCH>.c: Rename mono_arch_call_opcode2 () to mono_arch_emit_call () and simplify its signature.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59526
2006-04-16 16:50:36 +00:00
Zoltan Varga 99ca92c254 2006-04-16 Zoltan Varga <[email protected]>
* mini-ia64.c (mono_arch_call_opcode2): Simplify the code a bit.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59525
2006-04-16 16:36:22 +00:00
Zoltan Varga 281a76e668 2006-04-16 Zoltan Varga <[email protected]>
* mini-ia64.c: Remove opcode_to_type () which is now in mini-codegen.c.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59524
2006-04-16 16:11:44 +00:00
Zoltan Varga 252a0ee332 2006-04-16 Zoltan Varga <[email protected]>
* mini.c (mono_compile_create_vars): Print the definitions of the arguments etc.
	when in verbose mode.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59523
2006-04-16 16:00:39 +00:00
Zoltan Varga 7b0cb8935a 2006-04-16 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_decompose_long_opts): Add LNEG implementation for sparc.

	* cpu-sparc.md mini-sparc.h mini-sparc.c: Sparc porting work.	

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59522
2006-04-16 15:17:11 +00:00
Zoltan Varga e614a0c943 2006-04-16 Zoltan Varga <[email protected]>
* cpu-sparc.md mini-sparc.c: Sparc porting work.

	* method-to-ir.c (mono_method_to_ir2): Avoid transforming long shift to shift_imm 
	if long shifts need to be emulated.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59516
2006-04-16 01:35:41 +00:00
Zoltan Varga 957beea092 2006-04-16 Zoltan Varga <[email protected]>
* mini-ops.h: Correct metadata of OP_SETFRET.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59515
2006-04-16 00:54:52 +00:00
Zoltan Varga 04961c5299 2006-04-16 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_spill_global_vars): Fix handling of long vregs on 
	big-endian platforms.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59514
2006-04-16 00:23:28 +00:00
Zoltan Varga 995572c1b9 2006-04-16 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_opcode_to_type): New helper function.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59513
2006-04-15 22:48:48 +00:00
Zoltan Varga cf9807e75d 2006-04-15 Zoltan Varga <[email protected]>
* mini-ia64.c (mono_arch_allocate_vars): Fix the computation of some stack slots
	when fp is eliminated.

	* method-to-ir.c: Add a FIXME.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59511
2006-04-15 20:40:48 +00:00
Zoltan Varga 4ed7b6c20e 2006-04-15 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_spill_global_vars): Optimize the lvreg optimization, and fix
	some small bugs.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59509
2006-04-15 19:28:11 +00:00
Zoltan Varga 9ea44fb478 Beginnings of SPARC support.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=59505
2006-04-15 03:58:16 +00:00
Zoltan Varga 0fa8cdce35 2006-04-15 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_local_regalloc): Fix yet another bug in the handling of
	fixed sreg1.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59503
2006-04-15 02:27:28 +00:00
Zoltan Varga b89f112003 2006-04-15 Zoltan Varga <[email protected]>
* method-to-ir.c (MONO_EMIT_BOUNDS_CHECK): Add a correct amd64 version.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59502
2006-04-15 01:53:08 +00:00
Zoltan Varga 43858207cb 2006-04-15 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_spill_global_vars): Fix a bug in the lvreg optimization.

	* mini-ops.h cpu-amd64.md mini-amd64.c: Add some membase_reg/membase_imm opcodes.

	* method-to-ir.c (op_to_op_dest_membase): Add amd64 membase_reg/membase_imm rules.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59501
2006-04-15 01:26:00 +00:00
Zoltan Varga 3f7d977e2d 2006-04-15 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_local_regalloc): Fix a bug in the handling of fixed
	sreg1.

	* method-to-ir.c (mono_spill_global_vars): Disable the lvreg optimization for
	volatile variables.

	* mini-amd64.c (peephole_pass_1): Add sub_imm -> lea optimization.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59500
2006-04-14 23:51:58 +00:00
Zoltan Varga 8dbf4265d3 2006-04-15 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_spillvar_offset): Allocate separate spill offsets for
	fp and non-fp variables.

	* method-to-ir.c (mono_spill_global_vars): Implement an optimization to get rid of
	redundant loads and stores.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59499
2006-04-14 22:23:38 +00:00
Zoltan Varga ab98403bbc 2006-04-14 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_handle_global_vregs): Avoid the global->local vreg
	optimization if the liveness internal of the vreg contains a call.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59498
2006-04-14 20:04:34 +00:00
Zoltan Varga 495e4c57a6 2006-04-14 Zoltan Varga <[email protected]>
* liveness.c (analyze_liveness_bb): Increment ins_index by 2s so the destination 
	and the source operands of an instruction no longer have overlapping live ranges.

	* mini.c (mono_local_cprop2): Avoid treating the destbasereg argument of a store
	as a definition.

	* ssa2.c (mono_ssa_remove): Add back the coalescing optimization of the current
	JIT.

	* method-to-ir.c: Remove obsolete FIXMEs.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59497
2006-04-14 18:46:08 +00:00
Zoltan Varga efd55b0142 2006-04-12 Zoltan Varga <[email protected]>
* cfold.c (mono_constant_fold_ins2): Merge mono_constant_fold_new () into this
	function.

	* mini-x86.c (mono_arch_output_basic_block): Add some micro-optimizations.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59400
2006-04-12 13:33:07 +00:00
Zoltan Varga d0a4d16d31 2006-04-11 Zoltan Varga <[email protected]>
* mini-ops.h cpu-amd64.md mini-amd64.c: Add some new reg-membase rules.
	
	* method-to-ir.c (op_to_op_src2_membase): Use the new rules.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59381
2006-04-11 21:39:39 +00:00
Zoltan Varga b0725e5ec1 2006-04-11 Zoltan Varga <[email protected]>
* mini.c method-to-ir.c mini-amd64.c mini-ia64.c mini-x86.c mini-codegen.c:
	Reduce allocations and other minor JIT performance improvements.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59379
2006-04-11 21:23:39 +00:00
Zoltan Varga dfae6cb8b2 2006-04-11 Zoltan Varga <[email protected]>
* mini-ops.h cpu-pentium.md mini-x86.c: Add some new reg-membase rules.
	
	* method-to-ir.c (op_to_op_src2_membase): Use the new rules.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59369
2006-04-11 17:27:33 +00:00
Zoltan Varga fbc585311e 2006-04-10 Zoltan Varga <[email protected]>
* mini.c (mono_local_cprop2): Fix the previous change.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59297
2006-04-10 12:59:42 +00:00
Zoltan Varga 209ff21711 2006-04-10 Zoltan Varga <[email protected]>
* mini.c (mono_local_cprop2): Enable copy propagation for floats on non-x86
	platforms.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59285
2006-04-10 02:00:01 +00:00
Zoltan Varga 3acdad7208 2006-04-10 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_local_regalloc): Relax a condition which was too strict.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59284
2006-04-10 01:58:42 +00:00
Zoltan Varga 4ce608df96 2006-04-10 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_method_to_ir2): Remove the special handling of
	ia64, do it in the arch specific code instead.

	* mini-ia64.c (mono_arch_lowering_pass): Add special handling for float_setcc
	opcodes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59278
2006-04-09 23:04:02 +00:00
Zoltan Varga 95117c9823 2006-04-10 Zoltan Varga <[email protected]>
* mini.c (move_basic_block_to_end): Handle CEE_BR as well.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59277
2006-04-09 22:24:13 +00:00
Zoltan Varga 6ecb3a6dfe 2006-04-09 Zoltan Varga <[email protected]>
* mini-ia64.h mini-ia64.c cpu-ia64.md: Port the ia64 backend to the new IR.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59275
2006-04-09 21:57:16 +00:00
Zoltan Varga 0ec234e1c5 2006-04-09 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_spillvar_offset): More alignment fixes.
	(mono_local_regalloc): Only do the OP_MOVE optimization if ins->dreg is a local
	hreg, not when its !global, since on ia64, there is a third category: stacked
	registers.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59274
2006-04-09 21:49:56 +00:00
Zoltan Varga 2149a25280 2006-04-09 Zoltan Varga <[email protected]>
* method-to-ir.c (mono_op_imm_to_op): New helper function.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59273
2006-04-09 21:48:16 +00:00
Zoltan Varga 9816c6e097 2006-04-09 Zoltan Varga <[email protected]>
* mini-codegen.c: Remove mono_opcode_to_stack_type which is only used by the
	ia64 backend.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59268
2006-04-09 17:26:22 +00:00
Zoltan Varga 791a6e2044 2006-04-09 Zoltan Varga <[email protected]>
* mini-ppc.c mini-arm.c: Remove NOT_IMPLEMENTED macro which is now in mini.h.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59267
2006-04-09 17:23:40 +00:00
Zoltan Varga 583a938c94 2006-04-09 Zoltan Varga <[email protected]>
* cpu-pentium.md mini-x86.c: Update x86 backend after latest changes.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59259
2006-04-09 03:13:09 +00:00
Zoltan Varga c7b80c5d97 2006-04-09 Zoltan Varga <[email protected]>
* mini-amd64.c (mono_arch_create_vars): Remove some redundant checks.
	(mono_arch_allocate_vars): Ditto.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59258
2006-04-09 03:00:47 +00:00
Zoltan Varga 0eaa6ca2da 2006-04-09 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_opcode_to_cond): Add more opcodes.

	* mini-amd64.c (mono_arch_create_vars): Move creation of cfg->var from here...

	* mini.c (mono_compile_create_vars): To here.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59257
2006-04-09 02:38:01 +00:00
Zoltan Varga dd49e96b89 2006-04-09 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_opcode_to_cond): Add more opcodes.

	* mini-amd64.c: Use mono_opcode_to_cond to simplify the emitting of conditional
	branches.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59256
2006-04-09 02:06:38 +00:00
Zoltan Varga 462e61d3a3 2006-04-09 Zoltan Varga <[email protected]>
* mini-ops.h: Add OP_VCALL2_... opcodes.

	* mini.h (MonoCompile): Add 'vret_addr' field.

	* method-to-ir.c mini-amd64.c: Use OP_VCALL2 opcodes for the decomposed 
	valuetype calls.

	* method-to-ir.c mini-amd64.c: Make cfg->ret a 'real' variable and use the
	new 'vret_addr' variable for representing the vtype return address.

	* mini-codegen.c (mono_opcode_to_cond): New helper function, moved here from
	mini-ia64.c.

	* mini-codegen.c (mono_opcode_to_stack_type): Ditto.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59255
2006-04-09 01:38:54 +00:00
Zoltan Varga ba02c83d6a 2006-04-09 Zoltan Varga <[email protected]>
* mini-*.c: Move definition of NOT_IMPLEMENTED to mini.h.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59254
2006-04-09 01:35:23 +00:00
Zoltan Varga eb004ccc21 2006-04-08 Zoltan Varga <[email protected]>
* mini.c (mini_init): Add missing opcode emulations.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59248
2006-04-08 18:06:14 +00:00
Zoltan Varga ba49ee774c 2006-04-08 Zoltan Varga <[email protected]>
* mini.h: Add a few new opcode classification macros.
	
	* mini-codegen.c (mono_spillvar_offset): Fix alignment issues.
	(mono_print_ins_index): Fix compilation on non-x86 platforms.

	* method-to-ir.c: Add a few FIXMEs.

	* method-to-ir.c: Fix compilation on non-x86 platforms.

	* method-to-ir.c (mono_method_to_ir2): Add support for architectures where
	fceq and its friends need an fcompare.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59247
2006-04-08 18:03:24 +00:00
Zoltan Varga ed163ea7f9 2006-04-07 Zoltan Varga <[email protected]>
* method-to-ir.c (decompose_opcode): Fix OP_LCONV_TO_OVF_I4_UN.

	* iltests.il: Delete a test which only worked on 32 bit machines.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59165
2006-04-07 00:14:12 +00:00
Zoltan Varga 65dad6f715 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=59161
2006-04-06 23:42:09 +00:00
Zoltan Varga f3f86debeb 2006-04-07 Zoltan Varga <[email protected]>
* ssa2.c (evaluate_ins): Fix the computation of the new variable state.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59159
2006-04-06 23:41:01 +00:00
Zoltan Varga d83f24a4f3 2006-04-07 Zoltan Varga <[email protected]>
* method-to-ir.c (decompose_opcode): Add some missing opcodes.

	* cpu-pentium.md: Add missing op_call opcode.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59154
2006-04-06 23:00:22 +00:00
Zoltan Varga 6e8b92ba33 2006-04-06 Zoltan Varga <[email protected]>
* mini.c (mono_local_deadce): Add some support for eliminating dead assignments
	to global vregs as well.

	* ssa2.c (mono_ssa_compute2): Use pruned SSA.

	* method-to-ir.c (mono_handle_global_vregs): Add ceq + store -> setcc-membase
	rules.

	* mini.c (mono_method_to_ir): Replace an OP_CALL with CEE_CALL which was missed
	earlier.

	* exceptions.cs: Add a test for the inline+throw problem.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59131
2006-04-06 17:58:49 +00:00
Zoltan Varga 27a4bde81a 2006-04-06 Zoltan Varga <[email protected]>
* mini-codegen.c (mono_local_regalloc): Don't set dreg_mask based on
	dest_dreg since the former is mandatory, while the later is not.

	* mini-codegen.c (mono_local_regalloc): Set preferred_mask with the result of
	MONO_ARCH_INST_FIXED_MASK too.

	* method-to-ir.c (mono_decompose_long_opts): Add missing long->u conversion.

	* iltests.il: Add new test for long->u conversion.

	* mini.h (MonoCompile): Add new 'ret_var_set' flag.
	
	* method-to-ir.c (inline_method): Handle the case when the inlined method
	doesn't set the return var.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=59115
2006-04-06 14:47:15 +00:00
Zoltan Varga 6d6de8f13c Revert to using CEE_CALL instead of OP_CALL in the old JIT.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=59101
2006-04-05 18:32:12 +00:00
Zoltan Varga 3bf547de0b Fix some branch optimizations. Remove reduntant printing of method names from some optimizations. Declare all new SSA variables as OP_LOCAL, since OP_ARG is ignored by optimizations.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58921
2006-04-02 20:59:27 +00:00
Zoltan Varga e444c648aa Fix a bug
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58827
2006-03-31 00:40:41 +00:00
Zoltan Varga cf75e7833c AMD64 optimizations.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58826
2006-03-31 00:21:06 +00:00
Zoltan Varga 8a6946b4f5 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58822
2006-03-30 21:31:32 +00:00
Zoltan Varga 944fbc010d Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58820
2006-03-30 21:15:17 +00:00
Zoltan Varga e60388aac2 Remove a FIXME
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58782
2006-03-30 14:33:48 +00:00
Zoltan Varga 4976c58126 General cleanup + implement SSA over valuetypes.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58780
2006-03-30 14:21:52 +00:00
Zoltan Varga 53fd5306f9 Part III of the valuetype reorganization: use vtype opcodes when passing/receiving vtypes in calls, and decompose them later. enable local copyprop/deadce for valuetypes.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58767
2006-03-29 22:56:12 +00:00
Zoltan Varga 6885553439 Ongoing work.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58681
2006-03-28 22:10:37 +00:00
Zoltan Varga 6052ef7187 Ongoing work.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58654
2006-03-28 14:40:27 +00:00
Zoltan Varga a4bf9168a3 Fix some bugs and FIXMEs.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58653
2006-03-28 13:36:24 +00:00
Zoltan Varga 30c510fa48 Fix some performance regression wrt the old JIT. Fix some FIXMEs.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58623
2006-03-27 22:06:13 +00:00
Zoltan Varga e3bac4d0b2 Remove some fp rules not needed by the new regalloc
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58556
2006-03-26 23:34:30 +00:00
Zoltan Varga bf9b06af8c Rewrite the handling of the fp stack within the local register allocator to
enable it to handle the code produced by the new JIT.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=58554
2006-03-26 22:59:44 +00:00
Zoltan Varga 07653b02de Cleanup the fp spill code a bit. Add OP_X86_FXCH. Fix fp stack leakage in CKFINITE
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58543
2006-03-26 13:36:20 +00:00
Zoltan Varga a5e0c55f99 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58484
2006-03-24 20:10:23 +00:00
Zoltan Varga 8419e52906 Some amd64 updates
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58481
2006-03-24 19:38:09 +00:00
Zoltan Varga ed591d9434 Merge from HEAD.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58240
2006-03-21 19:06:21 +00:00
Zoltan Varga 5801dc6493 Ongoing work.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58230
2006-03-21 17:14:04 +00:00
Zoltan Varga a40b1ad699 More vtype fixes/optimizations && amd64 fixes.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58222
2006-03-21 15:22:37 +00:00
Zoltan Varga 227b7078d5 Small vtype optimizations.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58208
2006-03-21 00:21:41 +00:00
Zoltan Varga a9d3290aba Beginnings of vtype optimizations.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58191
2006-03-20 17:21:56 +00:00
Zoltan Varga 001c19d6ad Part 2 of the vtype reorganization: remove code which is no longer needed.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58189
2006-03-20 16:01:06 +00:00
Zoltan Varga ff13dfd58f First part of the Big Valuetype Reorganization: Make vtypes first class
entities in the IR and decompose them later in a separate pass.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=58116
2006-03-17 18:49:00 +00:00
Zoltan Varga 6ba13ff395 2006-03-15 Zoltan Varga <[email protected]>
* mini-amd64.c (peephole_pass): Use OP_LXOR instead of CEE_XOR.

	* method-to-ir.c (mono_method_to_ir2): Fix a verification error with
	mkrefany.

	* ssa2.c (mono_ssa_compute2): Optimize the lvreg_stack stuff.

svn path=/branches/vargaz/mini-linear-il/mono/; revision=58014
2006-03-15 13:47:20 +00:00
Zoltan Varga e618fc272c Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=58009
2006-03-15 12:09:24 +00:00
Zoltan Varga 7c98a03bd1 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57918
2006-03-13 22:41:40 +00:00
Zoltan Varga b24f42f144 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57787
2006-03-10 19:11:42 +00:00
Zoltan Varga 61a04dda5f Small fix
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57706
2006-03-08 19:16:18 +00:00
Zoltan Varga db5bdd0dd6 Fix some bugs
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57692
2006-03-08 15:00:15 +00:00
Zoltan Varga 0b07e9c6c6 Fix some bugs
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57681
2006-03-08 01:25:05 +00:00
Zoltan Varga f3b5cfcdb9 Implement long_beq/bne without branches
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57677
2006-03-07 23:15:30 +00:00
Zoltan Varga c1080fdc53 Finish SSA consprop support
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57675
2006-03-07 22:36:47 +00:00
Zoltan Varga 85d8c2db9a x86 updates
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57614
2006-03-06 15:28:57 +00:00
Zoltan Varga 31dc821a50 Preliminary SSA constant propagation support
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57602
2006-03-05 22:33:53 +00:00
Zoltan Varga f5edc77d43 Small fixes
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57601
2006-03-05 18:52:31 +00:00
Zoltan Varga 2b2975c755 More perf improvements
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57600
2006-03-05 17:54:50 +00:00
Zoltan Varga 45a37da259 Perform another set of local optimizations after SSA
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57585
2006-03-04 19:40:26 +00:00
Zoltan Varga 97eff27fc4 Small perf improvements
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57561
2006-03-03 23:52:10 +00:00
Zoltan Varga 707b46648c Optimize mempool_alloc/alloc0 a bit
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57560
2006-03-03 23:49:30 +00:00
Zoltan Varga 4fb392ae7b Optimize floats on non-x86 platforms
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57528
2006-03-03 02:00:57 +00:00
Zoltan Varga 4034421a5f Simplify handle_global_vregs () and generalize local cprop and deadce to non-int types
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57526
2006-03-02 23:00:58 +00:00
Zoltan Varga 2abc877b89 Remove some dead code
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57524
2006-03-02 21:14:11 +00:00
Zoltan Varga 1f72b4d82a fix some FIXMEs and add support for SSA on floats
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57523
2006-03-02 21:09:54 +00:00
Zoltan Varga 4214aa6705 Fix a FIXME
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57512
2006-03-02 18:40:39 +00:00
Zoltan Varga 51feb3940f Add mono_bitset_get_fast () macro
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57500
2006-03-02 12:24:50 +00:00
Zoltan Varga 3ef00627a7 Optimize SSA construction some more + various other stuff
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57492
2006-03-02 00:05:21 +00:00
Zoltan Varga ef653fb04c Cleanup handling of CEE_SWITCH
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57471
2006-03-01 19:06:34 +00:00
Zoltan Varga 915eb474e7 Remove the compile_iterated_dfrontier2 function as it is no longer needed
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57458
2006-03-01 10:31:13 +00:00
Zoltan Varga 373821b1ec Small optimizations
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57456
2006-03-01 01:01:56 +00:00
Zoltan Varga 53f61023bd Add amd64 optimizations
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57455
2006-03-01 01:01:25 +00:00
Zoltan Varga 27b1f76522 Some minor optimizations
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57451
2006-02-28 23:25:51 +00:00
Zoltan Varga 2e24a939ed Optimize SSA construction a bit
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57444
2006-02-28 23:02:30 +00:00
Zoltan Varga 258edeed0e Optimize some perf critical functions
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57443
2006-02-28 23:01:26 +00:00
Zoltan Varga 12ea0ba6e0 Move SSA support for the new IR into a new file ssa2.c
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57294
2006-02-25 19:52:42 +00:00
Zoltan Varga 9eaed98931 Move SSA support for the new IR into a new file ssa2.c
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57293
2006-02-25 19:52:06 +00:00
Zoltan Varga 3259b60ab6 Remove SSA restrictions
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57279
2006-02-25 15:27:06 +00:00
Zoltan Varga e1d305621a Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57276
2006-02-25 14:41:43 +00:00
Zoltan Varga 6d6453173b amd64 updates
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57269
2006-02-25 02:35:35 +00:00
Zoltan Varga 162b1c133a Store vregs inside phi nodes instead of indexes. Implement SSA deadce
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57263
2006-02-24 22:17:56 +00:00
Zoltan Varga 3a6961242d Optimize branch optimizations
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57240
2006-02-24 17:00:07 +00:00
Zoltan Varga 7f998d0fa0 Various optimizations
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57219
2006-02-23 22:14:39 +00:00
Zoltan Varga 92cdf5a2e2 Finish conversion to-and-from SSA form
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57215
2006-02-23 20:55:18 +00:00
Zoltan Varga d0eed5a776 More SSA work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57211
2006-02-23 18:17:29 +00:00
Zoltan Varga e055e6022a Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57186
2006-02-22 23:46:54 +00:00
Zoltan Varga 9d794fd553 Ongoing work. Place locals into cfg->locals
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57180
2006-02-22 22:35:54 +00:00
Zoltan Varga f370fee9cd Fix a merge problem
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57059
2006-02-19 22:44:43 +00:00
Zoltan Varga e392ac4a1a Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57057
2006-02-19 22:07:50 +00:00
Zoltan Varga 99a407b03b Use printf instead of g_print as its faster. Also speed up disassembly a bit.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57055
2006-02-19 19:37:36 +00:00
Zoltan Varga e7d434fd2e Get rid of the aliasing between the two vregs used to implement longs on 32 bit machines, and the original long vreg. Simplify vreg_to_inst () as a result
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57054
2006-02-19 18:12:49 +00:00
Zoltan Varga 17c8ec4c44 Fix a FIXME
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57024
2006-02-17 22:42:20 +00:00
Zoltan Varga ec0d52819b Fix some amd64 issues
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57021
2006-02-17 22:31:13 +00:00
Zoltan Varga 882577dc26 Partly merge vfregs and viregs
svn path=/branches/vargaz/mini-linear-il/mono/; revision=57019
2006-02-17 21:06:43 +00:00
Zoltan Varga 13c1cce325 Add some todos
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56996
2006-02-17 17:47:36 +00:00
Zoltan Varga a550d3af3a Preliminary SSA work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56994
2006-02-17 17:44:55 +00:00
Zoltan Varga 17cf4b8d7a Lazily compile icall wrappers
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56895
2006-02-15 18:29:17 +00:00
Zoltan Varga a517aa1ff2 Add a trampoline field to MonoJitICallInfo and initi it
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56894
2006-02-15 17:59:01 +00:00
Zoltan Varga e812606938 Implement the box+brtrue optimization
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56833
2006-02-13 15:34:47 +00:00
Zoltan Varga 1e21bb2dba amd64 updates
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56783
2006-02-11 02:42:47 +00:00
Zoltan Varga 9d32028420 Merge OP_STR_CHAR_ADDR optimization
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56777
2006-02-10 21:29:39 +00:00
Zoltan Varga 950176f7c4 Merge OP_STR_CHAR_ADDR optimization
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56776
2006-02-10 20:55:13 +00:00
Zoltan Varga f8b3efbcfe Kill some FIXMEs
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56773
2006-02-10 20:34:03 +00:00
Zoltan Varga 20711c0bf8 Add LOCALLOC_IMM optimization
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56765
2006-02-10 17:41:55 +00:00
Zoltan Varga 433e6b437e Kill all NOT_IMPLEMENTEDs
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56761
2006-02-10 16:34:20 +00:00
Zoltan Varga a010e9b91c Clean up aot code
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56758
2006-02-10 15:24:31 +00:00
Zoltan Varga c92f81de9e Implement AOT support
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56734
2006-02-09 23:25:43 +00:00
Zoltan Varga e42bef2476 Rename generics.2.cs to generics.cs
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56711
2006-02-09 15:43:40 +00:00
Zoltan Varga d24c3db73f Handle nullable types in UNBOX
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56710
2006-02-09 15:43:07 +00:00
Zoltan Varga fa951d47a5 Fix some FIXMEs and bugs
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56656
2006-02-07 23:32:54 +00:00
Zoltan Varga 7affefe26e Fix a few FIXMEs
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56625
2006-02-07 17:30:18 +00:00
Zoltan Varga ff24fa07b2 Add this to the branch as well
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56623
2006-02-07 16:54:21 +00:00
Zoltan Varga 12b962ecc5 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56618
2006-02-07 15:52:48 +00:00
Zoltan Varga 0350a9428a More small x86 optimizations
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56617
2006-02-07 14:56:08 +00:00
Zoltan Varga 855e02e38a Add x86 optimizations
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56615
2006-02-07 13:47:00 +00:00
Zoltan Varga 37dbbd9774 Add small amd64 optimizations
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56602
2006-02-06 23:02:43 +00:00
Zoltan Varga 092531e45a Optimize local cprop a bit
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56574
2006-02-05 18:41:47 +00:00
Zoltan Varga a9be514615 Merge handle_local_vregs () into handle_global_vregs () so it is done earlier.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56566
2006-02-04 18:43:02 +00:00
Zoltan Varga e8cbf83e7b Add a small optimization
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56565
2006-02-04 17:45:04 +00:00
Zoltan Varga 7d9c6eb659 Remove some debugging output
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56547
2006-02-03 22:13:46 +00:00
Zoltan Varga f637e5cacb Rewrite the local deadce pass and add other optimizations
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56546
2006-02-03 22:11:38 +00:00
Zoltan Varga 904b878c73 Implement constant folding
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56543
2006-02-03 20:38:04 +00:00
Zoltan Varga cdc2720f40 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56253
2006-01-30 14:47:50 +00:00
Zoltan Varga 1b58cc0d09 Completely replace the dominator algorithms with faster ones from a paper
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56212
2006-01-29 01:01:35 +00:00
Zoltan Varga 6303fc4e92 Optimize local regalloc a bit more
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56205
2006-01-28 15:45:51 +00:00
Zoltan Varga 439c1f4dc8 Optimize amd64 generated code
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56197
2006-01-27 23:06:44 +00:00
Zoltan Varga 6c4d4ac83c Optimize compute_natural_loops
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56173
2006-01-27 17:58:19 +00:00
Zoltan Varga 62509cf04e Perform the local optimizations before ssa and its friends
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56123
2006-01-26 21:59:45 +00:00
Zoltan Varga 68340b5735 Avoid large log files when using -v -v
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56115
2006-01-26 18:33:10 +00:00
Zoltan Varga 0b11fbd50d Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56051
2006-01-25 17:42:48 +00:00
Zoltan Varga 5ce4233c8e Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56050
2006-01-25 17:29:30 +00:00
Zoltan Varga dd853d17a1 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56044
2006-01-25 14:59:28 +00:00
Zoltan Varga 2df32d8d41 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56016
2006-01-24 23:43:50 +00:00
Zoltan Varga bb1911d488 Cleanup inlining code
svn path=/branches/vargaz/mini-linear-il/mono/; revision=56012
2006-01-24 22:16:43 +00:00
Zoltan Varga d1624d62f9 Add a global->local vreg optimization and turn on inlining
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55994
2006-01-24 17:29:54 +00:00
Zoltan Varga ae02604918 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55963
2006-01-23 22:23:22 +00:00
Zoltan Varga 695a6bd995 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55961
2006-01-23 21:24:00 +00:00
Zoltan Varga 19fe2573df Optimize optimize_branches a bit
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55955
2006-01-23 18:22:52 +00:00
Zoltan Varga 5b4bfc60a2 Get rid of NOPs during the local copyprop deadce passes
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55954
2006-01-23 17:53:22 +00:00
Zoltan Varga 5644fa9955 Optimize local regalloc a bit
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55953
2006-01-23 17:52:31 +00:00
Zoltan Varga 899fa2669c Optimize local regalloc a bit
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55952
2006-01-23 17:52:07 +00:00
Zoltan Varga 9737c80b42 Optimize liveness analysis
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55919
2006-01-23 00:38:15 +00:00
Zoltan Varga 85fe62e973 Optimize liveness analysis and dominator computation
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55893
2006-01-21 20:55:29 +00:00
Zoltan Varga 44f0ed5a50 Optimize monobitset a bit
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55892
2006-01-21 20:54:42 +00:00
Zoltan Varga 1bef46492e Update the amd64 port
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55868
2006-01-21 00:33:33 +00:00
Zoltan Varga 56101869f0 Optimize this a bit more
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55867
2006-01-21 00:32:48 +00:00
Zoltan Varga e226c1a8c3 Optimize things a bit more
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55864
2006-01-20 22:45:46 +00:00
Zoltan Varga 5fdeca75f7 Get rid of usage of CEE_NOP too
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55853
2006-01-20 18:15:25 +00:00
Zoltan Varga 3743980735 Get rid of CEE_BR too
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55852
2006-01-20 17:32:19 +00:00
Zoltan Varga c1f7232151 Get rid of usage of most of the CEE_ opcodes in the IR
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55849
2006-01-20 17:18:25 +00:00
Zoltan Varga 988f9ad089 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55848
2006-01-20 17:17:25 +00:00
Zoltan Varga 7e23372a06 Optimize local deadce a bit more
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55839
2006-01-20 16:35:59 +00:00
Zoltan Varga 3d6b93833c Optimize local copyprop+deadce
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55800
2006-01-19 22:25:21 +00:00
Zoltan Varga 7e5809aba1 Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55798
2006-01-19 19:49:51 +00:00
Zoltan Varga f7cbb88ddc Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55797
2006-01-19 18:46:34 +00:00
Zoltan Varga f3f0dc371e Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55784
2006-01-19 14:55:02 +00:00
Zoltan Varga 115baa2b1d Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55763
2006-01-18 22:48:37 +00:00
Zoltan Varga d42553c15b Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55759
2006-01-18 22:22:59 +00:00
Zoltan Varga 94b9a85de1 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55757
2006-01-18 21:18:15 +00:00
Zoltan Varga 631e7539e0 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55744
2006-01-18 17:45:35 +00:00
Zoltan Varga f67c64bb11 Improve copyprop && add constant propagation
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55743
2006-01-18 17:44:59 +00:00
Zoltan Varga 3f7c39c54a Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55692
2006-01-17 20:48:25 +00:00
Zoltan Varga 26fac782bf Fix some FIXMEs
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55682
2006-01-17 17:14:01 +00:00
Zoltan Varga c712855c41 Implement copy propagation
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55657
2006-01-16 21:43:55 +00:00
Zoltan Varga 3bb25fca02 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55637
2006-01-16 16:42:12 +00:00
Zoltan Varga 41bd9eb16c Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55611
2006-01-15 23:28:02 +00:00
Zoltan Varga 96c31ae231 Optimize things a bit
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55589
2006-01-15 01:21:30 +00:00
Zoltan Varga ad6fea93e0 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55587
2006-01-14 21:07:59 +00:00
Zoltan Varga 5481fe1ee1 Comment out unused fields to reduce the table size
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55586
2006-01-14 21:07:45 +00:00
Zoltan Varga 024b8c2cbb Use memset instead of a loop
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55585
2006-01-14 21:07:04 +00:00
Zoltan Varga d8c0b4b97d Implement liveness analysis
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55576
2006-01-14 17:47:06 +00:00
Zoltan Varga 60f418fff3 Get rid of compute_vreg_to_inst
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55561
2006-01-13 23:19:20 +00:00
Zoltan Varga c90b0902ad Infrastructure work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55552
2006-01-13 21:53:42 +00:00
Zoltan Varga 7f2d795efc svn path=/branches/vargaz/mini-linear-il/mono/; revision=55457 2006-01-12 20:47:04 +00:00
Zoltan Varga 23b3b56992 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55358
2006-01-11 00:38:24 +00:00
Zoltan Varga 00f762f331 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55347
2006-01-10 22:14:25 +00:00
Zoltan Varga 62f095256c Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55343
2006-01-10 21:20:32 +00:00
Zoltan Varga a362db55a5 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55339
2006-01-10 20:13:23 +00:00
Zoltan Varga b212ee1f99 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55265
2006-01-09 22:01:29 +00:00
Zoltan Varga 358bdb0888 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55263
2006-01-09 21:38:48 +00:00
Zoltan Varga 5fc4cabfe2 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55241
2006-01-09 16:22:54 +00:00
Zoltan Varga efb9d4fc30 Finish getting rid of labels and branches inside bbs
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55237
2006-01-09 16:08:10 +00:00
Zoltan Varga 303cffc993 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55229
2006-01-09 15:25:35 +00:00
Zoltan Varga 5a4d2928af Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55180
2006-01-06 22:23:46 +00:00
Zoltan Varga a7fd6b118c Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55179
2006-01-06 22:13:42 +00:00
Zoltan Varga 237d2effae Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55174
2006-01-06 20:32:56 +00:00
Zoltan Varga 79fbd4c77b Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55123
2006-01-05 22:51:35 +00:00
Zoltan Varga 75f26d45ff Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=55087
2006-01-04 23:05:17 +00:00
Zoltan Varga d9adc60235 More infrastructure work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54665
2005-12-20 20:40:19 +00:00
Zoltan Varga 035586f107 Infrastructure work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54661
2005-12-20 17:30:20 +00:00
Zoltan Varga 8307f7acf8 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54603
2005-12-19 14:52:37 +00:00
Zoltan Varga 4b95721a6b Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54602
2005-12-19 14:39:44 +00:00
Zoltan Varga c33a123ad3 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54582
2005-12-18 18:44:06 +00:00
Zoltan Varga 0d86be7c88 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54581
2005-12-18 17:21:28 +00:00
Zoltan Varga 064b186e7c Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54565
2005-12-17 15:07:47 +00:00
Zoltan Varga 1ddd37b999 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54556
2005-12-16 23:11:17 +00:00
Zoltan Varga 11e45e33c1 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54553
2005-12-16 22:41:00 +00:00
Zoltan Varga 6a3727bb9d Implemented missing opcodes. Fixed lots of bugs. Cleaned up lots of stuff.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54504
2005-12-15 23:59:18 +00:00
Zoltan Varga d49a37b18e Implement more opcodes, do some cleanups
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54492
2005-12-15 19:51:36 +00:00
Zoltan Varga a2ceb306e8 Remove unused stuff
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54412
2005-12-14 21:23:40 +00:00
Zoltan Varga af0aba2d25 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54267
2005-12-12 23:55:20 +00:00
Zoltan Varga 308745461f Ongoing work.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54258
2005-12-12 20:37:07 +00:00
Zoltan Varga cb40d42334 Ongoing work.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54248
2005-12-12 17:15:02 +00:00
Zoltan Varga 6d778c41d7 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54241
2005-12-12 14:59:38 +00:00
Zoltan Varga a680c04509 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54215
2005-12-11 20:50:24 +00:00
Zoltan Varga 0626309f27 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54211
2005-12-11 15:40:28 +00:00
Zoltan Varga caa8eb7d0a Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54208
2005-12-11 01:16:32 +00:00
Zoltan Varga a824b417ec Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54191
2005-12-10 13:16:05 +00:00
Zoltan Varga 4db90a3595 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54182
2005-12-10 00:09:28 +00:00
Zoltan Varga 550da36b9b Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54173
2005-12-09 22:41:10 +00:00
Zoltan Varga 25a0ba4d73 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54162
2005-12-09 13:16:11 +00:00
Zoltan Varga 6338bebce6 Continue adding support for object model opcodes
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54119
2005-12-08 20:40:11 +00:00
Zoltan Varga 33040218af Merge from HEAD
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54110
2005-12-08 12:32:18 +00:00
Zoltan Varga 0a80220cb1 svn path=/branches/vargaz/mini-linear-il/mono/; revision=54060 2005-12-07 20:23:57 +00:00
Zoltan Varga 8705f0bd29 Finish array support
svn path=/branches/vargaz/mini-linear-il/mono/; revision=54051
2005-12-07 17:11:33 +00:00
Zoltan Varga 0bcca4d1b0 svn path=/branches/vargaz/mini-linear-il/mono/; revision=53960 2005-12-06 00:20:40 +00:00
Zoltan Varga a314febfc7 Add array support.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53958
2005-12-05 23:17:30 +00:00
Zoltan Varga d331a12820 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53907
2005-12-04 20:04:20 +00:00
Zoltan Varga 705d7806d7 Ongoing work.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53895
2005-12-04 01:46:37 +00:00
Zoltan Varga ed602a754b svn path=/branches/vargaz/mini-linear-il/mono/; revision=53894 2005-12-03 20:55:21 +00:00
Zoltan Varga 1499b1a04c Cleanups
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53877
2005-12-03 03:02:50 +00:00
Zoltan Varga 3f315b1480 Beginnings of object model support
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53856
2005-12-02 22:56:45 +00:00
Zoltan Varga 206efef4bd Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53793
2005-12-01 20:18:38 +00:00
Zoltan Varga ba6633eb73 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53732
2005-12-01 00:47:21 +00:00
Zoltan Varga ad33d3f04b Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53726
2005-11-30 23:44:43 +00:00
Zoltan Varga 1130600b0e Ongoing work.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53692
2005-11-30 15:45:45 +00:00
Zoltan Varga f84b903428 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53648
2005-11-29 23:46:28 +00:00
Zoltan Varga 62d2ba6b0b Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53646
2005-11-29 22:29:40 +00:00
Zoltan Varga 2b6e7aa111 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53636
2005-11-29 15:33:16 +00:00
Zoltan Varga 14b825cc91 Ongoing work.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53531
2005-11-27 21:59:45 +00:00
Zoltan Varga f87fee9d53 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53528
2005-11-27 19:17:17 +00:00
Zoltan Varga 4e411aaf74 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53521
2005-11-27 01:43:47 +00:00
Zoltan Varga 7902069c2b svn path=/branches/vargaz/mini-linear-il/mono/; revision=53499 2005-11-26 03:00:27 +00:00
Zoltan Varga 1547bf0247 svn path=/branches/vargaz/mini-linear-il/mono/; revision=53488 2005-11-25 23:30:19 +00:00
Zoltan Varga 727a9f12e2 Ongoing work
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53486
2005-11-25 23:00:25 +00:00
Zoltan Varga 7ba47cce99 Ongoing work.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53485
2005-11-25 21:27:38 +00:00
Zoltan Varga bfb14aa07b Ongoing work.
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53482
2005-11-25 15:54:08 +00:00
Zoltan Varga c0fee57975 svn path=/branches/vargaz/mini-linear-il/mono/; revision=53464 2005-11-24 22:26:48 +00:00
Zoltan Varga c54945dd66 svn path=/branches/vargaz/mini-linear-il/mono/; revision=53462 2005-11-24 20:28:16 +00:00
Zoltan Varga 39d0bf75dd Refactor method_to_ir into a separate file
svn path=/branches/vargaz/mini-linear-il/mono/; revision=53330
2005-11-21 22:54:07 +00:00
19082 changed files with 765958 additions and 1910658 deletions

No files matched your search

-182
View File
@@ -1,182 +0,0 @@
-*- outline -*-
Generic code sharing
====================
* Porting
** Generic class init trampoline
The generic class init trampoline is very similar to the class init
trampoline, with the exception that the VTable of the class to be
inited is passed in a register, MONO_ARCH_VTABLE_REG. That can be the
same as the IMT register.
The call to the generic class init trampoline is never patched because
the VTable is not constant - it depends on the type arguments of the
class/method doing the call to the trampoline. For that reason, the
trampoline needs a fast path for the case that the class is already
inited. See tramp-x86.c for how to portably figure out the number of
the bit in the bit-field that needs to be checked.
** RGCTX register
Generic shared code needs access to type information. This
information is contained in a RGCTX for non-generic methods and in an
MRGCTX for generic methods. It is passed in one of several ways,
depending on the type of the called method:
1. Non-generic non-static methods of reference types have access to
the RGCTX via the "this" argument (this->vtable->rgctx).
2. Non-generic static methods of reference types and non-generic
methods of value types need to be passed a pointer to the
caller's class's VTable in the MONO_ARCH_RGCTX_REG register.
3. Generic methods need to be passed a pointer to the MRGCTX in the
MONO_ARCH_RGCTX_REG register.
The MONO_ARCH_RGCTX_REG must not be clobbered by trampolines.
MONO_ARCH_RGCTX_REG can be the same as the IMT register for now, but
this might change in the future when we implement virtual generic
method calls (more) efficiently.
** Dealing with types
Types passed to arch functions might be type parameters
(MONO_TYPE_(M)VAR) if the MonoGenericSharingContext* argument is
non-NULL. For example, an argument or return type in a method passed
to mono_arch_find_this_argument() could be a MONO_TYPE_VAR. To guard
for that case use mini_get_basic_type_from_generic() on the type. See
get_call_info() in mini-x86.c, for example.
** (M)RGCTX lazy fetch trampoline
The purpose of the lazy fetch trampoline is to fetch a slot from an
(M)RGCTX which might not be inited, yet. In the latter case, it needs
to go make a transition to unmanaged code to fill the slot. This is
the layout of a RGCTX:
+---------------------------------+
| next | slot 0 | slot 1 | slot 2 |
+--|------------------------------+
|
+-----+
| +---------------------------------
+->| next | slot 3 | slot 4 | slot 5 ....
+--|------------------------------
|
+-----+
| +------------------------------------
+->| next | slot 10 | slot 11 | slot 12 ....
+--|---------------------------------
.
.
.
For fetching a slot from a RGCTX the trampoline is passed a pointer to
the VTable. From there it has to fetch the pointer to the RGCTX,
which might be null. Then it has to traverse the correct number of
"next" links, each of which might be NULL. Arriving at the right
array it needs to fetch the slot, which might also be NULL. If any of
the NULL cases, the trampoline must transition to unmanaged code to
potentially setup the RGCTX and fill the slot. Here is pseudo-code
for fetching slot 11:
; vtable ptr in r1
; fetch RGCTX array 0
r2 = *(r1 + offsetof(MonoVTable, runtime_generic_context))
if r2 == NULL goto unmanaged
; fetch RGCTX array 1
r2 = *r2
if r2 == NULL goto unmanaged
; fetch RGCTX array 2
r2 = *r2
if r2 == NULL goto unmanaged
; fetch slot 11
r2 = *(r2 + 2 * sizeof (gpointer))
if r2 == NULL goto unmanaged
return r2
unmanaged:
jump unmanaged_fetch_code
The number of slots in the arrays must be obtained from the function
mono_class_rgctx_get_array_size().
The MRGCTX case is different in two aspects. First, the trampoline is
not passed a pointer to a VTable, but a pointer directly to the
MRGCTX, which is guaranteed not to be NULL (any of the next pointers
and any of the slots can be NULL, though). Second, the layout of the
first array is slightly different, in that the first two slots are
occupied by a pointers to the class's VTable and to the method's
method_inst. The next pointer is in the third slot and the first
actual slot, "slot 0", in the fourth:
+--------------------------------------------------------+
| vtable | method_inst | next | slot 0 | slot 1 | slot 2 |
+-------------------------|------------------------------+
.
.
All other arrays have the same layout as the RGCTX ones, except
possibly for their length.
The function to create the trampoline,
mono_arch_create_rgctx_lazy_fetch_trampoline(), gets passed an encoded
slot number. Use the macro MONO_RGCTX_SLOT_IS_MRGCTX to query whether
a trampoline for an MRGCTX is needed, as opposed to one for a RGCTX.
Use MONO_RGCTX_SLOT_INDEX to get the index of the slot (like 2 for
"slot 2" as above).
* Getting generics information about a stack frame
If a method is compiled with generic sharing, its MonoJitInfo has
has_generic_jit_info set. In that case, the MonoJitInfo is followed
(after the MonoJitExceptionInfo array) by a MonoGenericJitInfo.
The MonoGenericJitInfo contains information about the location of the
this/vtable/MRGCTX variable, if the has_this flag is set. If that is
the case, there are two possibilities:
1. this_in_reg is set. this_reg is the number of the register where
the variable is stored.
2. this_in_reg is not set. The variable is stored at offset
this_offset from the address in the register with number
this_reg.
The variable can either point to the "this" object, to a vtable or to
an MRGCTX:
1. If the method is a non-generic non-static method of a reference
type, the variable points to the "this" object.
2. If the method is a non-generic static method or a non-generic
method of a value type, the variable points to the vtable of the
class.
3. If the method is a generic method, the variable points to the
MRGCTX of the method.
* Layout of the MRGCTX
The MRGCTX is a structure that starts with
MonoMethodRuntimeGenericContext, which contains a pointer to the
vtable of the class and a pointer to the MonoGenericInst with the type
arguments for the method.
* Blog posts about generic code sharing
http://schani.wordpress.com/2007/09/22/generics-sharing-in-mono/
http://schani.wordpress.com/2007/10/12/the-trouble-with-shared-generics/
http://schani.wordpress.com/2007/10/15/a-quick-generics-sharing-update/
http://schani.wordpress.com/2008/01/29/other-types/
http://schani.wordpress.com/2008/02/25/generic-types-are-lazy/
http://schani.wordpress.com/2008/03/10/sharing-static-methods/
http://schani.wordpress.com/2008/04/22/sharing-everything-and-saving-memory/
http://schani.wordpress.com/2008/06/02/sharing-generic-methods/
http://schani.wordpress.com/2008/06/27/another-generic-sharing-update/
-64
View File
@@ -1,64 +0,0 @@
#include <config.h>
#include <glib.h>
#include <gmodule.h>
#include <string.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "test.h"
#if defined (G_OS_WIN32)
#define EXTERNAL_SYMBOL "GetProcAddress"
#else
#define EXTERNAL_SYMBOL "system"
#endif
void G_MODULE_EXPORT
dummy_test_export ()
{
}
/* test for g_module_open (NULL, ...) */
RESULT
test_module_symbol_null ()
{
gpointer proc = GINT_TO_POINTER (42);
GModule *m = g_module_open (NULL, G_MODULE_BIND_LAZY);
if (m == NULL)
return FAILED ("bind to main module failed. #0");
if (g_module_symbol (m, "__unlikely_\nexistent__", &proc))
return FAILED ("non-existent symbol lookup failed. #1");
if (proc)
return FAILED ("non-existent symbol lookup failed. #2");
if (!g_module_symbol (m, EXTERNAL_SYMBOL, &proc))
return FAILED ("external lookup failed. #3");
if (!proc)
return FAILED ("external lookup failed. #4");
if (!g_module_symbol (m, "dummy_test_export", &proc))
return FAILED ("in-proc lookup failed. #5");
if (!proc)
return FAILED ("in-proc lookup failed. #6");
if (!g_module_close (m))
return FAILED ("close failed. #7");
return OK;
}
static Test module_tests [] = {
{"g_module_symbol_null", test_module_symbol_null},
{NULL, NULL}
};
DEFINE_TEST_GROUP_INIT(module_tests_init, module_tests)
-84
View File
@@ -1,87 +1,3 @@
2008-05-14 Marek Safar <[email protected]>
* Makefile: Enabled more tests.
2008-02-18 Raja R Harinath <[email protected]>
* Makefile (net_2_0_centum_tests): Add System.Xml.Linq here.
2008-02-17 Raja R Harinath <[email protected]>
* Makefile (_boot_): Orchestrate the net_2_1 bootstrap.
(net_2_1_bootstrap_SUBDIRS, net_2_1_raw_SUBDIRS): New.
2008-02-06 Zoltan Varga <[email protected]>
* Makefile (dir-check): Hopefully fix make dist.
2008-02-05 Zoltan Varga <[email protected]>
* Makefile: Abort with an error message if make is typed directly in this
directory, instead from the 'mono' directory.
2007-12-06 Atsushi Enomoto <[email protected]>
* Makefile: currently Sys.Web.Extensions is not ready for
centum_tests.
2007-12-04 Marek Safar <[email protected]>
* Makefile: Added more tests.
2007-12-03 Marek Safar <[email protected]>
* Makefile: Added 3.5 profile, it probably not used here.
2007-11-28 Raja R Harinath <[email protected]>
* Makefile (_boot_): Incorporate 'net_2_1' into the bootstrap
process -- it depends on 'net_2_0' profile being built.
2007-07-27 Marek Safar <[email protected]>
* Makefile: Removed gmcs and smcs, removed DIST_ONLY_SUBDIRS.
2007-07-27 Jb Evain <[email protected]>
* Makefile: integrate the tuner in the build.
2007-07-26 Jb Evain <[email protected]>
* smcs: add a project of its own for the 2.1 compiler.
2007-07-11 Jb Evain <[email protected]>
* Makefile: work on the 2.1 profile.
2007-05-11 Raja R Harinath <[email protected]>
* Makefile (net_2_0_bootstrap_SUBDIRS): Add 'mcs'.
2007-04-18 Marek Habersack <[email protected]>
* Makefile (SUBDIRS): removed tools/culevel, it is now built in
the 1.1 bootstrap phase.
2007-04-17 Marek Habersack <[email protected]>
* Makefile (thisdir): added tools/culevel to the list of
subdirectories - it must be compiled before compiling the classes
since System.Web depends on it.
2007-04-06 Wade Berrier <[email protected]>
* Makefile: use bzip2 instead of gzip for 'make dist'
(even though it's not used here anymore)
2006-08-18 Raja R Harinath <[email protected]>
* Makefile (net_2_0_bootstrap_SUBDIRS): Add 'tools'.
2006-04-11 Raja R Harinath <[email protected]>
* Makefile (SUBDIRS): Remove tools/resgen.
2005-11-21 Raja R Harinath <[email protected]>
* Makefile (net_2_0_bootstrap_SUBDIRS): Add ilasm.
+2 -51
View File
@@ -25,16 +25,12 @@
please use the attribute [MonoTODO]. This attribute can be used
to programatically generate our status web pages:
[MonoTODO("My Function is not available on Mono")]
[MonoTODO]
int MyFunction ()
{
throw new NotImplementedException ();
}
Ideally, write a human description of the reason why there is
a MonoTODO, this will be useful in the future for our
automated tools that can assist in developers porting their code.
* Supporting .NET 1.2, .NET 1.1 and .NET 1.0 builds
The defines NET_1_1 and NET_2_0 are used to include
@@ -408,11 +404,6 @@
From that point on a list of changes in a file-by-file basis,
describing what changes were done.
This information must be cut and pasted into your commit
message, so the information ends up in two places: in the
subversion repository metadata and also on the source code
distirbution (which does not have the Subversion metadata).
* Warnings
@@ -473,44 +464,4 @@ class X : Y {
}
}
}
* Conditional compilation
Ideally we would not need conditional compilation, and the use
of #ifdef is strongly discouraged. But due to our support for
old C# 1.0 compilers we have to use it in a few places.
Try to avoid negative tests that have an else clause, for
example:
#if !NET_2_0
CODE_FOR_1_0
#else
CODE_FOR_2_0
#endif
Instead use:
#if NET_2_0
CODE_FOR_2_0
#else
CODE_FOR_1_0
#endif
When a major feature differs across compilation targets, try
to factor out the code into a separate class, a helper class
or a separate file, and include that in your profile while
surrounding that helper file/class with the ifdefs to reduce
the amount of ifdefs in the code.
For instance, this is used for some parts of Grasshopper where
the code is ifdefed out, when large parts of a file would have
been ifdefed out, we moved the code into a MyOtherFile.jvm.cs
For 2.0 classes, this is even simpler as code can be trivially
factored out into
MyHelperClass.cli.cs
MyHelperClass.jvm.cs
By using partial classes.
+3 -4
View File
@@ -1,6 +1,5 @@
The Mono code under the mcs/ directory is licensed under various
different licenses:
The Mono code is licensed under various different licenses.
GNU GPL: details avaliable in the file LICENSE.GPL
GNU LGPL: details available in the file LICENSE.LGPL
@@ -21,14 +20,14 @@ different licenses:
applications with them).
Third party libraries include: ByteFX.Data,
ICSharpCode.SharpZipLib, Npgsql, MicrosoftAjaxLibrary.
ICSharpCode.SharpZipLib, Npgsql.
The Microsoft.JScript assembly is covered by the
MIT X11 and the Mozilla MPL license as it contains
ported pieces of code from Rhino, the Mozilla JavaScript
implementations
* Mono C# compiler: Dual licensed MIT X11 and GNU GPL.
* Mono C# compiler: GNU GPL
* Mono Basic compiler: GNU GPL.
-31
View File
@@ -1,31 +0,0 @@
// Copyright 2006 James Newton-King
// http://www.newtonsoft.com
//
// This work is licensed under the Creative Commons Attribution 2.5 License
// http://creativecommons.org/licenses/by/2.5/
//
// You are free:
// * to copy, distribute, display, and perform the work
// * to make derivative works
// * to make commercial use of the work
//
// Under the following conditions:
// * For any reuse or distribution, you must make clear to others the license terms of this work.
// * Any of these conditions can be waived if you get permission from the copyright holder.
From: james.newtonking@gmail.com [mailto:james.newtonking@gmail.com] On Behalf Of James Newton-King
Sent: Tuesday, June 05, 2007 6:36 AM
To: Konstantin Triger
Subject: Re: Support request by Konstantin Triger for Json.NET
Hey Kosta
I think it would be awesome to use Json.NET in Mono for System.Web.Extensions.
The CC license has the following clause: Any of the above conditions can be waived if you get permission from the copyright holder.
I can waive that statement for you and Mono. Would that be acceptable?
Regards,
James
-27
View File
@@ -1,27 +0,0 @@
Microsoft Permissive License (Ms-PL)
This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.
1. Definitions
The terms “reproduce,” “reproduction,” “derivative works,” and “distribution” have the same meaning here as under U.S. copyright law.
A “contribution” is the original software, or any additions or changes to the software.
A “contributor” is any person that distributes its contribution under this license.
“Licensed patents” are a contributor’s patent claims that read directly on its contribution.
2. Grant of Rights
(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
3. Conditions and Limitations
(A) No Trademark License- This license does not grant you rights to use any contributors’ name, logo, or trademarks.
(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
(E) The software is licensed “as-is.” You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
(F) If you distribute the software or derivative works with programs you develop, you agree to indemnify, defend, and hold harmless all contributors from any claims, including attorneys’ fees, related to the distribution or use of your programs. For clarity, you have no such obligations to a contributor for any claims based solely on the unmodified contributions of that contributor.
(G) If you make any additions or changes to the original software, you may only distribute them under a new namespace. In addition, you will clearly identify your changes or additions as your own.
+29 -61
View File
@@ -1,61 +1,37 @@
thisdir := .
SUBDIRS := build jay mcs class nunit20 ilasm tools tests errors docs
SUBDIRS := build jay mcs tools/resgen class mbas nunit20 ilasm tools tests errors docs
DIST_ONLY_SUBDIRS := gmcs
basic_SUBDIRS := build jay mcs class
net_1_1_bootstrap_SUBDIRS := build jay mcs class ilasm tools
net_2_0_bootstrap_SUBDIRS := build jay mcs class ilasm tools
net_2_0_SUBDIRS := build jay mcs class nunit20 ilasm tools tests errors
net_2_1_bootstrap_SUBDIRS := build mcs class
net_2_1_raw_SUBDIRS := build mcs class tools
net_2_1_SUBDIRS := tools tests errors
net_3_5_SUBDIRS := build class
net_2_0_bootstrap_SUBDIRS := build class ilasm
net_2_0_SUBDIRS := build jay gmcs class nunit20 ilasm tests errors tools
# List of test subdirs that should pass 100%
centum_tests := \
class/corlib \
class/System \
class/System.XML \
class/Commons.Xml.Relaxng \
class/Cscompmgd \
class/Microsoft.JScript \
class/Mono.Posix \
class/Mono.Security \
class/System.Design \
class/System.DirectoryServices \
class/System.Drawing \
class/System.Messaging \
class/System.Runtime.Remoting \
class/System.Runtime.Serialization.Formatters.Soap \
class/System.Security \
class/System.ServiceProcess \
class/System.Web \
class/System.Web.Services \
tests \
class/corlib \
class/System \
class/Commons.Xml.Relaxng \
class/Cscompmgd \
class/Microsoft.JScript \
class/Mono.Posix \
class/Mono.Security \
class/System.Messaging \
class/System.Runtime.Remoting \
class/System.Runtime.Serialization.Formatters.Soap \
class/System.Security \
class/System.ServiceProcess \
class/System.Web.Services \
tests \
errors
default_centum_tests := \
default_centum_tests := \
$(centum_tests) \
class/System.XML \
class/System.Data
net_2_0_centum_tests := \
$(centum_tests) \
class/System.Core \
class/System.Configuration \
class/System.Data.DataSetExtensions \
class/System.Xml.Linq \
class/System.Transactions \
class/Microsoft.Build.Framework \
class/Microsoft.Build.Utilities \
class/Microsoft.Build.Engine \
class/Mono.C5
# class/System.Web.Extensions
# class/Microsoft.Build.Tasks
# note that System.Xml.Linq is here to prevent this from being empty
net_3_5_centum_tests := \
class/System.Xml.Linq
net_2_0_centum_tests := $(centum_tests) class/Mono.C5
ifdef ONLY_CENTUM_TESTS
TEST_SUBDIRS := $($(PROFILE)_centum_tests)
@@ -67,18 +43,15 @@ endif
include build/rules.make
all-recursive $(STD_TARGETS:=-recursive): dir-check platform-check profile-check
all-recursive $(STD_TARGETS:=-recursive): platform-check profile-check
.PHONY: all-local $(STD_TARGETS:=-local)
all-local $(STD_TARGETS:=-local):
@:
dir-check:
@if [ "$(NO_DIR_CHECK)" = "" -a "$(PROFILE)" != "basic" ]; then echo "Running make from the mcs directory is not supported. Run make from the parent directory (if using a tarball), or from the directory where the runtime is checked out (if using an SVN checkout)."; exit 1; fi
# fun specialty targets
PROFILES = default net_2_0 net_3_5
PROFILES = default net_2_0
.PHONY: all-profiles $(STD_TARGETS:=-profiles)
all-profiles $(STD_TARGETS:=-profiles): %-profiles: profiles-do--%
@@ -97,10 +70,6 @@ profiles-do--run-test:
# Orchestrate the bootstrap here.
_boot_ = all clean install
$(_boot_:%=profile-do--net_3_5--%): profile-do--net_3_5--%: profile-do--net_2_0--%
$(_boot_:%=profile-do--net_2_1--%): profile-do--net_2_1--%: profile-do--net_2_1_raw--%
$(_boot_:%=profile-do--net_2_1_raw--%): profile-do--net_2_1_raw--%: profile-do--net_2_1_bootstrap--%
$(_boot_:%=profile-do--net_2_1_bootstrap--%): profile-do--net_2_1_bootstrap--%: profile-do--net_2_0--%
$(_boot_:%=profile-do--net_2_0--%): profile-do--net_2_0--%: profile-do--net_2_0_bootstrap--%
$(_boot_:%=profile-do--net_2_0_bootstrap--%): profile-do--net_2_0_bootstrap--%: profile-do--default--%
$(_boot_:%=profile-do--default--%): profile-do--default--%: profile-do--net_1_1_bootstrap--%
@@ -127,7 +96,6 @@ DISTFILES = \
LICENSE \
LICENSE.GPL \
LICENSE.LGPL \
LICENSE.MPL \
Makefile \
mkinstalldirs \
MIT.X11 \
@@ -145,7 +113,7 @@ dist-pre:
dist-tarball: dist-pre
$(MAKE) distdir='$(package)' dist-recursive
tar cvjf $(package).tar.bz2 $(package)
tar cvzf $(package).tar.gz $(package)
dist: dist-tarball
rm -rf $(package)
@@ -166,9 +134,9 @@ distcheck: dist-tarball
$(MAKE) prefix=$(prefix) && $(MAKE) test && $(MAKE) install DESTDIR="$$destdir" && \
$(MAKE) clean && $(MAKE) dist || exit 1) || exit 1 ; \
mv Distcheck-MCS $(package) ; \
tar tjf $(package)/$(package).tar.bz2 |sed -e 's,/$$,,' |sort >distdist.list ; \
rm $(package)/$(package).tar.bz2 ; \
tar tjf $(package).tar.bz2 |sed -e 's,/$$,,' |sort >before.list ; \
tar tzf $(package)/$(package).tar.gz |sed -e 's,/$$,,' |sort >distdist.list ; \
rm $(package)/$(package).tar.gz ; \
tar tzf $(package).tar.gz |sed -e 's,/$$,,' |sort >before.list ; \
find $(package) |egrep -v '(makefrag|response)' |sed -e 's,/$$,,' |sort >after.list ; \
cmp before.list after.list || exit 1 ; \
cmp before.list distdist.list || exit 1 ; \
@@ -180,7 +148,7 @@ monocharge:
mkdir "$$chargedir" ; \
DESTDIR=`cd "$$chargedir" && pwd` ; \
$(MAKE) install DESTDIR="$$DESTDIR" || exit 1 ; \
tar cvjf "$$chargedir".tar.bz2 "$$chargedir" ; \
tar cvzf "$$chargedir".tgz "$$chargedir" ; \
rm -rf "$$chargedir"
# A bare-bones monocharge.
@@ -194,5 +162,5 @@ monocharge-lite:
$(MAKE) -C class/System install DESTDIR="$$DESTDIR" || exit 1; \
$(MAKE) -C class/System.XML install DESTDIR="$$DESTDIR" || exit 1; \
$(MAKE) -C class/Mono.CSharp.Debugger install DESTDIR="$$DESTDIR" || exit 1; \
tar cvjf "$$chargedir".tar.bz2 "$$chargedir" ; \
tar cvzf "$$chargedir".tgz "$$chargedir" ; \
rm -rf "$$chargedir"
+3 -13
View File
@@ -12,6 +12,9 @@ package module which drives the compilation of this directory.
* Layout
========
bmcs/
New experimental Basic compiler.
build/
Rules, configuration and makefile components to build
this module.
@@ -65,19 +68,6 @@ And to install:
make PROFILE=net_2_0 install
* Running Unit tests
====================
You can run unit tests in individual components by running the command
"make run-test". If you want to run tests for a different profile (say
'net_2_0')
make run-test PROFILE=net_2_0
If you want to only run the tests in a single fixture (say
'MonoTests.System.TypeTest'), you can use
make run-test TEST_HARNESS_FLAGS=/fixture:MonoTests.System.TypeTest
* Acknowledgements
==================
+8
View File
@@ -0,0 +1,8 @@
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyVersion(Consts.MonoVersion)]
[assembly: AssemblyTitle ("Mono VB.NET Compiler")]
[assembly: AssemblyDescription ("Mono VB.NET Compiler with Generics")]
[assembly: AssemblyCopyright ("2001, 2002, 2003 Ximian, Inc.")]
[assembly: AssemblyCompany ("Ximian, Inc.")]
+20333
View File
File diff suppressed because it is too large. Load diff
+406
View File
@@ -0,0 +1,406 @@
//
// CryptoConvert.cs - Crypto Convertion Routines
//
// Author:
// Sebastien Pouliot <[email protected]>
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
// (C) 2004 Novell (http://www.novell.com)
//
using System;
using System.Globalization;
using System.Security.Cryptography;
using System.Text;
namespace Mono.Security.Cryptography {
#if INSIDE_CORLIB
internal
#else
public
#endif
sealed class CryptoConvert {
private CryptoConvert ()
{
}
static private int ToInt32LE (byte [] bytes, int offset)
{
return (bytes [offset+3] << 24) | (bytes [offset+2] << 16) | (bytes [offset+1] << 8) | bytes [offset];
}
static private uint ToUInt32LE (byte [] bytes, int offset)
{
return (uint)((bytes [offset+3] << 24) | (bytes [offset+2] << 16) | (bytes [offset+1] << 8) | bytes [offset]);
}
static private byte [] GetBytesLE (int val)
{
return new byte [] {
(byte) (val & 0xff),
(byte) ((val >> 8) & 0xff),
(byte) ((val >> 16) & 0xff),
(byte) ((val >> 24) & 0xff)
};
}
static private byte[] Trim (byte[] array)
{
for (int i=0; i < array.Length; i++) {
if (array [i] != 0x00) {
byte[] result = new byte [array.Length - i];
Buffer.BlockCopy (array, i, result, 0, result.Length);
return result;
}
}
return null;
}
// convert the key from PRIVATEKEYBLOB to RSA
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/Security/private_key_blobs.asp
// e.g. SNK files, PVK files
static public RSA FromCapiPrivateKeyBlob (byte[] blob)
{
return FromCapiPrivateKeyBlob (blob, 0);
}
static public RSA FromCapiPrivateKeyBlob (byte[] blob, int offset)
{
if (blob == null)
throw new ArgumentNullException ("blob");
if (offset >= blob.Length)
throw new ArgumentException ("blob is too small.");
try {
if ((blob [offset] != 0x07) || // PRIVATEKEYBLOB (0x07)
(blob [offset+1] != 0x02) || // Version (0x02)
(blob [offset+2] != 0x00) || // Reserved (word)
(blob [offset+3] != 0x00) ||
(ToUInt32LE (blob, offset+8) != 0x32415352)) // DWORD magic = RSA2
throw new CryptographicException ("Invalid blob header");
// ALGID (CALG_RSA_SIGN, CALG_RSA_KEYX, ...)
// int algId = ToInt32LE (blob, offset+4);
// DWORD bitlen
int bitLen = ToInt32LE (blob, offset+12);
// DWORD public exponent
RSAParameters rsap = new RSAParameters ();
byte[] exp = new byte [4];
Buffer.BlockCopy (blob, offset+16, exp, 0, 4);
Array.Reverse (exp);
rsap.Exponent = Trim (exp);
int pos = offset+20;
// BYTE modulus[rsapubkey.bitlen/8];
int byteLen = (bitLen >> 3);
rsap.Modulus = new byte [byteLen];
Buffer.BlockCopy (blob, pos, rsap.Modulus, 0, byteLen);
Array.Reverse (rsap.Modulus);
pos += byteLen;
// BYTE prime1[rsapubkey.bitlen/16];
int byteHalfLen = (byteLen >> 1);
rsap.P = new byte [byteHalfLen];
Buffer.BlockCopy (blob, pos, rsap.P, 0, byteHalfLen);
Array.Reverse (rsap.P);
pos += byteHalfLen;
// BYTE prime2[rsapubkey.bitlen/16];
rsap.Q = new byte [byteHalfLen];
Buffer.BlockCopy (blob, pos, rsap.Q, 0, byteHalfLen);
Array.Reverse (rsap.Q);
pos += byteHalfLen;
// BYTE exponent1[rsapubkey.bitlen/16];
rsap.DP = new byte [byteHalfLen];
Buffer.BlockCopy (blob, pos, rsap.DP, 0, byteHalfLen);
Array.Reverse (rsap.DP);
pos += byteHalfLen;
// BYTE exponent2[rsapubkey.bitlen/16];
rsap.DQ = new byte [byteHalfLen];
Buffer.BlockCopy (blob, pos, rsap.DQ, 0, byteHalfLen);
Array.Reverse (rsap.DQ);
pos += byteHalfLen;
// BYTE coefficient[rsapubkey.bitlen/16];
rsap.InverseQ = new byte [byteHalfLen];
Buffer.BlockCopy (blob, pos, rsap.InverseQ, 0, byteHalfLen);
Array.Reverse (rsap.InverseQ);
pos += byteHalfLen;
// ok, this is hackish but CryptoAPI support it so...
// note: only works because CRT is used by default
// http://bugzilla.ximian.com/show_bug.cgi?id=57941
rsap.D = new byte [byteLen]; // must be allocated
if (pos + byteLen + offset <= blob.Length) {
// BYTE privateExponent[rsapubkey.bitlen/8];
Buffer.BlockCopy (blob, pos, rsap.D, 0, byteLen);
Array.Reverse (rsap.D);
}
RSA rsa = (RSA)RSA.Create ();
rsa.ImportParameters (rsap);
return rsa;
}
catch (Exception e) {
throw new CryptographicException ("Invalid blob.", e);
}
}
static public byte[] ToCapiPrivateKeyBlob (RSA rsa)
{
RSAParameters p = rsa.ExportParameters (true);
int keyLength = p.Modulus.Length; // in bytes
byte[] blob = new byte [20 + (keyLength << 2) + (keyLength >> 1)];
blob [0] = 0x07; // Type - PRIVATEKEYBLOB (0x07)
blob [1] = 0x02; // Version - Always CUR_BLOB_VERSION (0x02)
// [2], [3] // RESERVED - Always 0
blob [5] = 0x24; // ALGID - Always 00 24 00 00 (for CALG_RSA_SIGN)
blob [8] = 0x52; // Magic - RSA2 (ASCII in hex)
blob [9] = 0x53;
blob [10] = 0x41;
blob [11] = 0x32;
byte[] bitlen = GetBytesLE (keyLength << 3);
blob [12] = bitlen [0]; // bitlen
blob [13] = bitlen [1];
blob [14] = bitlen [2];
blob [15] = bitlen [3];
// public exponent (DWORD)
int pos = 16;
int n = p.Exponent.Length;
while (n > 0)
blob [pos++] = p.Exponent [--n];
// modulus
pos = 20;
byte[] part = p.Modulus;
int len = part.Length;
Array.Reverse (part, 0, len);
Buffer.BlockCopy (part, 0, blob, pos, len);
pos += len;
// private key
part = p.P;
len = part.Length;
Array.Reverse (part, 0, len);
Buffer.BlockCopy (part, 0, blob, pos, len);
pos += len;
part = p.Q;
len = part.Length;
Array.Reverse (part, 0, len);
Buffer.BlockCopy (part, 0, blob, pos, len);
pos += len;
part = p.DP;
len = part.Length;
Array.Reverse (part, 0, len);
Buffer.BlockCopy (part, 0, blob, pos, len);
pos += len;
part = p.DQ;
len = part.Length;
Array.Reverse (part, 0, len);
Buffer.BlockCopy (part, 0, blob, pos, len);
pos += len;
part = p.InverseQ;
len = part.Length;
Array.Reverse (part, 0, len);
Buffer.BlockCopy (part, 0, blob, pos, len);
pos += len;
part = p.D;
len = part.Length;
Array.Reverse (part, 0, len);
Buffer.BlockCopy (part, 0, blob, pos, len);
return blob;
}
static public RSA FromCapiPublicKeyBlob (byte[] blob)
{
return FromCapiPublicKeyBlob (blob, 0);
}
static public RSA FromCapiPublicKeyBlob (byte[] blob, int offset)
{
if (blob == null)
throw new ArgumentNullException ("blob");
if (offset >= blob.Length)
throw new ArgumentException ("blob is too small.");
try {
if ((blob [offset] != 0x06) || // PUBLICKEYBLOB (0x06)
(blob [offset+1] != 0x02) || // Version (0x02)
(blob [offset+2] != 0x00) || // Reserved (word)
(blob [offset+3] != 0x00) ||
(ToUInt32LE (blob, offset+8) != 0x31415352)) // DWORD magic = RSA1
throw new CryptographicException ("Invalid blob header");
// ALGID (CALG_RSA_SIGN, CALG_RSA_KEYX, ...)
// int algId = ToInt32LE (blob, offset+4);
// DWORD bitlen
int bitLen = ToInt32LE (blob, offset+12);
// DWORD public exponent
RSAParameters rsap = new RSAParameters ();
rsap.Exponent = new byte [3];
rsap.Exponent [0] = blob [offset+18];
rsap.Exponent [1] = blob [offset+17];
rsap.Exponent [2] = blob [offset+16];
int pos = offset+20;
// BYTE modulus[rsapubkey.bitlen/8];
int byteLen = (bitLen >> 3);
rsap.Modulus = new byte [byteLen];
Buffer.BlockCopy (blob, pos, rsap.Modulus, 0, byteLen);
Array.Reverse (rsap.Modulus);
RSA rsa = (RSA)RSA.Create ();
rsa.ImportParameters (rsap);
return rsa;
}
catch (Exception e) {
throw new CryptographicException ("Invalid blob.", e);
}
}
static public byte[] ToCapiPublicKeyBlob (RSA rsa)
{
RSAParameters p = rsa.ExportParameters (false);
int keyLength = p.Modulus.Length; // in bytes
byte[] blob = new byte [20 + keyLength];
blob [0] = 0x06; // Type - PUBLICKEYBLOB (0x06)
blob [1] = 0x02; // Version - Always CUR_BLOB_VERSION (0x02)
// [2], [3] // RESERVED - Always 0
blob [5] = 0x24; // ALGID - Always 00 24 00 00 (for CALG_RSA_SIGN)
blob [8] = 0x52; // Magic - RSA1 (ASCII in hex)
blob [9] = 0x53;
blob [10] = 0x41;
blob [11] = 0x31;
byte[] bitlen = GetBytesLE (keyLength << 3);
blob [12] = bitlen [0]; // bitlen
blob [13] = bitlen [1];
blob [14] = bitlen [2];
blob [15] = bitlen [3];
// public exponent (DWORD)
int pos = 16;
int n = p.Exponent.Length;
while (n > 0)
blob [pos++] = p.Exponent [--n];
// modulus
pos = 20;
byte[] part = p.Modulus;
int len = part.Length;
Array.Reverse (part, 0, len);
Buffer.BlockCopy (part, 0, blob, pos, len);
pos += len;
return blob;
}
// PRIVATEKEYBLOB
// PUBLICKEYBLOB
static public RSA FromCapiKeyBlob (byte[] blob)
{
return FromCapiKeyBlob (blob, 0);
}
static public RSA FromCapiKeyBlob (byte[] blob, int offset)
{
if (blob == null)
throw new ArgumentNullException ("blob");
if (offset >= blob.Length)
throw new ArgumentException ("blob is too small.");
switch (blob [offset]) {
case 0x00:
// this could be a public key inside an header
// like "sn -e" would produce
if (blob [offset + 12] == 0x06) {
return FromCapiPublicKeyBlob (blob, offset + 12);
}
break;
case 0x06:
return FromCapiPublicKeyBlob (blob, offset);
case 0x07:
return FromCapiPrivateKeyBlob (blob, offset);
}
throw new CryptographicException ("Unknown blob format.");
}
static public byte[] ToCapiKeyBlob (AsymmetricAlgorithm keypair, bool includePrivateKey)
{
if (keypair == null)
throw new ArgumentNullException ("keypair");
// check between RSA and DSA (and potentially others like DH)
if (keypair is RSA)
return ToCapiKeyBlob ((RSA)keypair, includePrivateKey);
else
return null; // TODO
}
static public byte[] ToCapiKeyBlob (RSA rsa, bool includePrivateKey)
{
if (rsa == null)
throw new ArgumentNullException ("rsa");
rsa.ExportParameters (includePrivateKey);
if (includePrivateKey)
return ToCapiPrivateKeyBlob (rsa);
else
return ToCapiPublicKeyBlob (rsa);
}
static public string ToHex (byte[] input)
{
if (input == null)
return null;
StringBuilder sb = new StringBuilder (input.Length * 2);
foreach (byte b in input) {
sb.Append (b.ToString ("X2", CultureInfo.InvariantCulture));
}
return sb.ToString ();
}
static private byte FromHexChar (char c)
{
if ((c >= 'a') && (c <= 'f'))
return (byte) (c - 'a' + 10);
if ((c >= 'A') && (c <= 'F'))
return (byte) (c - 'A' + 10);
if ((c >= '0') && (c <= '9'))
return (byte) (c - '0');
throw new ArgumentException ("invalid hex char");
}
static public byte[] FromHex (string hex)
{
if (hex == null)
return null;
if ((hex.Length & 0x1) == 0x1)
throw new ArgumentException ("Length must be a multiple of 2");
byte[] result = new byte [hex.Length >> 1];
int n = 0;
int i = 0;
while (n < result.Length) {
result [n] = (byte) (FromHexChar (hex [i++]) << 4);
result [n++] += FromHexChar (hex [i++]);
}
return result;
}
}
}
+37
View File
@@ -0,0 +1,37 @@
#
# This makefile needs work, currently we overwrite the value of `bmcs.exe',
# the reason is that we need this to be compiled with gmcs, so it uses the
# .NET 2.0 profile.
#
thisdir := bmcs
SUBDIRS :=
include ../build/rules.make
#uncomment to enable some debug stuff
#DEBUG_FLAGS=/define:MCS_DEBUG
BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/net_2_0_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/net_2_0_bootstrap/mcs.exe $(DEBUG_FLAGS)
BUILT_SOURCES = mb-parser.cs
EXTRA_DISTFILES = mb-parser.jay
PROGRAM_COMPILE = $(BOOT_COMPILE)
CLEAN_FILES = y.output
PROGRAM = bmcs.exe
mb-parser.cs: mb-parser.jay $(topdir)/jay/skeleton.cs
$(topdir)/jay/jay -ctv < $(topdir)/jay/skeleton.cs $< > jay-tmp.out && mv jay-tmp.out $@
include ../build/executable.make
bmcs.exe: mb-parser.cs
gmcs -d:NET_1_1 -d:ONLY_1_1 -debug /target:exe /out:bmcs.exe /r:Microsoft.VisualBasic.dll mb-parser.cs @bmcs.exe.sources -nowarn:219 -nowarn:162
winstall: all
cp bmcs.exe $(prefix)/lib/mono/2.0/
diffus:
diff --exclude='.svn' --exclude='*-parser.*' --exclude='*-tokenizer.cs' -ruN ../gmcs ../bmcs
+22
View File
@@ -0,0 +1,22 @@
* This is BMCS
Last merge to GMCS: 42056
BMCS is a new fork of the generics compiler from revision
38733 (11th of January 2005).
This new compiler is based on the changes that Jambunathan did
to mcs from November 30th, 2004 to integrate the existing mbas
compiler with a more recent mcs.
We have ported those changes to use `gmcs' so that we get
support for generics into our VB compiler eventually.
Work toward integrating the improvements from mbas will go here.
* LICENSING
Notice that the compiler might eventually need to go into the
class libraries. We request that contributors grant us permission
to relicense the code under the MIT X11 license if we have to.
File diff suppressed because it is too large. Load diff
+632
View File
@@ -0,0 +1,632 @@
//
// assign.cs: Assignments.
//
// Author:
// Miguel de Icaza ([email protected])
// Martin Baulig ([email protected])
//
// (C) 2001, 2002, 2003 Ximian, Inc.
// (C) 2004 Novell, Inc
//
using System;
using System.Reflection;
using System.Reflection.Emit;
namespace Mono.CSharp {
/// <summary>
/// This interface is implemented by expressions that can be assigned to.
/// </summary>
/// <remarks>
/// This interface is implemented by Expressions whose values can not
/// store the result on the top of the stack.
///
/// Expressions implementing this (Properties, Indexers and Arrays) would
/// perform an assignment of the Expression "source" into its final
/// location.
///
/// No values on the top of the stack are expected to be left by
/// invoking this method.
/// </remarks>
public interface IAssignMethod {
//
// This is an extra version of Emit. If leave_copy is `true'
// A copy of the expression will be left on the stack at the
// end of the code generated for EmitAssign
//
void Emit (EmitContext ec, bool leave_copy);
//
// This method does the assignment
// `source' will be stored into the location specified by `this'
// if `leave_copy' is true, a copy of `source' will be left on the stack
// if `prepare_for_load' is true, when `source' is emitted, there will
// be data on the stack that it can use to compuatate its value. This is
// for expressions like a [f ()] ++, where you can't call `f ()' twice.
//
void EmitAssign (EmitContext ec, Expression source, bool leave_copy, bool prepare_for_load);
/*
For simple assignments, this interface is very simple, EmitAssign is called with source
as the source expression and leave_copy and prepare_for_load false.
For compound assignments it gets complicated.
EmitAssign will be called as before, however, prepare_for_load will be
true. The @source expression will contain an expression
which calls Emit. So, the calls look like:
this.EmitAssign (ec, source, false, true) ->
source.Emit (ec); ->
[...] ->
this.Emit (ec, false); ->
end this.Emit (ec, false); ->
end [...]
end source.Emit (ec);
end this.EmitAssign (ec, source, false, true)
When prepare_for_load is true, EmitAssign emits a `token' on the stack that
Emit will use for its state.
Let's take FieldExpr as an example. assume we are emitting f ().y += 1;
Here is the call tree again. This time, each call is annotated with the IL
it produces:
this.EmitAssign (ec, source, false, true)
call f
dup
Binary.Emit ()
this.Emit (ec, false);
ldfld y
end this.Emit (ec, false);
IntConstant.Emit ()
ldc.i4.1
end IntConstant.Emit
add
end Binary.Emit ()
stfld
end this.EmitAssign (ec, source, false, true)
Observe two things:
1) EmitAssign left a token on the stack. It was the result of f ().
2) This token was used by Emit
leave_copy (in both EmitAssign and Emit) tells the compiler to leave a copy
of the expression at that point in evaluation. This is used for pre/post inc/dec
and for a = x += y. Let's do the above example with leave_copy true in EmitAssign
this.EmitAssign (ec, source, true, true)
call f
dup
Binary.Emit ()
this.Emit (ec, false);
ldfld y
end this.Emit (ec, false);
IntConstant.Emit ()
ldc.i4.1
end IntConstant.Emit
add
end Binary.Emit ()
dup
stloc temp
stfld
ldloc temp
end this.EmitAssign (ec, source, true, true)
And with it true in Emit
this.EmitAssign (ec, source, false, true)
call f
dup
Binary.Emit ()
this.Emit (ec, true);
ldfld y
dup
stloc temp
end this.Emit (ec, true);
IntConstant.Emit ()
ldc.i4.1
end IntConstant.Emit
add
end Binary.Emit ()
stfld
ldloc temp
end this.EmitAssign (ec, source, false, true)
Note that these two examples are what happens for ++x and x++, respectively.
*/
}
/// <summary>
/// An Expression to hold a temporary value.
/// </summary>
/// <remarks>
/// The LocalTemporary class is used to hold temporary values of a given
/// type to "simulate" the expression semantics on property and indexer
/// access whose return values are void.
///
/// The local temporary is used to alter the normal flow of code generation
/// basically it creates a local variable, and its emit instruction generates
/// code to access this value, return its address or save its value.
///
/// If `is_address' is true, then the value that we store is the address to the
/// real value, and not the value itself.
///
/// This is needed for a value type, because otherwise you just end up making a
/// copy of the value on the stack and modifying it. You really need a pointer
/// to the origional value so that you can modify it in that location. This
/// Does not happen with a class because a class is a pointer -- so you always
/// get the indirection.
///
/// The `is_address' stuff is really just a hack. We need to come up with a better
/// way to handle it.
/// </remarks>
public class LocalTemporary : Expression, IMemoryLocation {
LocalBuilder builder;
bool is_address;
public LocalTemporary (EmitContext ec, Type t) : this (ec, t, false) {}
public LocalTemporary (EmitContext ec, Type t, bool is_address)
{
type = t;
eclass = ExprClass.Value;
loc = Location.Null;
builder = ec.GetTemporaryLocal (is_address ? TypeManager.GetReferenceType (t): t);
this.is_address = is_address;
}
public LocalTemporary (LocalBuilder b, Type t)
{
type = t;
eclass = ExprClass.Value;
loc = Location.Null;
builder = b;
}
public void Release (EmitContext ec)
{
ec.FreeTemporaryLocal (builder, type);
builder = null;
}
public override Expression DoResolve (EmitContext ec)
{
return this;
}
public override void Emit (EmitContext ec)
{
ILGenerator ig = ec.ig;
ig.Emit (OpCodes.Ldloc, builder);
// we need to copy from the pointer
if (is_address)
LoadFromPtr (ig, type);
}
// NB: if you have `is_address' on the stack there must
// be a managed pointer. Otherwise, it is the type from
// the ctor.
public void Store (EmitContext ec)
{
ILGenerator ig = ec.ig;
ig.Emit (OpCodes.Stloc, builder);
}
public void AddressOf (EmitContext ec, AddressOp mode)
{
// if is_address, than this is just the address anyways,
// so we just return this.
ILGenerator ig = ec.ig;
if (is_address)
ig.Emit (OpCodes.Ldloc, builder);
else
ig.Emit (OpCodes.Ldloca, builder);
}
public bool PointsToAddress {
get {
return is_address;
}
}
}
/// <summary>
/// The Assign node takes care of assigning the value of source into
/// the expression represented by target.
/// </summary>
public class Assign : ExpressionStatement {
protected Expression target, source, real_source;
protected LocalTemporary temp = null, real_temp = null;
protected Assign embedded = null;
protected bool is_embedded = false;
protected bool must_free_temp = false;
public Assign (Expression target, Expression source, Location l)
{
this.target = target;
this.source = this.real_source = source;
this.loc = l;
}
protected Assign (Assign embedded, Location l)
: this (embedded.target, embedded.source, l)
{
this.is_embedded = true;
}
protected virtual Assign GetEmbeddedAssign (Location loc)
{
return new Assign (this, loc);
}
public Expression Target {
get {
return target;
}
set {
target = value;
}
}
public Expression Source {
get {
return source;
}
set {
source = value;
}
}
public static void error70 (EventInfo ei, Location l)
{
Report.Error (70, l, "The event '" + ei.Name +
"' can only appear on the left-side of a += or -= (except when" +
" used from within the type '" + ei.DeclaringType + "')");
}
//
// Will return either `this' or an instance of `New'.
//
public override Expression DoResolve (EmitContext ec)
{
// Create an embedded assignment if our source is an assignment.
if (source is Assign)
source = embedded = ((Assign) source).GetEmbeddedAssign (loc);
real_source = source = source.Resolve (ec);
if (source == null)
return null;
//
// This is used in an embedded assignment.
// As an example, consider the statement "A = X = Y = Z".
//
if (is_embedded && !(source is Constant)) {
// If this is the innermost assignment (the "Y = Z" in our example),
// create a new temporary local, otherwise inherit that variable
// from our child (the "X = (Y = Z)" inherits the local from the
// "Y = Z" assignment).
if (embedded == null) {
if (this is CompoundAssign)
real_temp = temp = new LocalTemporary (ec, target.Type);
else
real_temp = temp = new LocalTemporary (ec, source.Type);
} else
temp = embedded.temp;
// Set the source to the new temporary variable.
// This means that the following target.ResolveLValue () will tell
// the target to read it's source value from that variable.
source = temp;
}
// If we have an embedded assignment, use the embedded assignment's temporary
// local variable as source.
if (embedded != null)
source = (embedded.temp != null) ? embedded.temp : embedded.source;
target = target.ResolveLValue (ec, source);
if (target == null)
return null;
Type target_type = target.Type;
Type source_type = real_source.Type;
// If we're an embedded assignment, our parent will reuse our source as its
// source, it won't read from our target.
if (is_embedded)
type = source_type;
else
type = target_type;
eclass = ExprClass.Value;
if (target is EventExpr) {
EventInfo ei = ((EventExpr) target).EventInfo;
Expression ml = MemberLookup (
ec, ec.ContainerType, ei.Name,
MemberTypes.Event, AllBindingFlags | BindingFlags.DeclaredOnly, loc);
if (ml == null) {
//
// If this is the case, then the Event does not belong
// to this Type and so, according to the spec
// is allowed to only appear on the left hand of
// the += and -= operators
//
// Note that target will not appear as an EventExpr
// in the case it is being referenced within the same type container;
// it will appear as a FieldExpr in that case.
//
if (!(source is BinaryDelegate)) {
error70 (ei, loc);
return null;
}
}
}
FieldExpr field_exp = target as FieldExpr;
if (field_exp != null && field_exp.DeclaringType.IsValueType && !ec.IsConstructor && !ec.IsFieldInitializer) {
field_exp = field_exp.InstanceExpression as FieldExpr;
if (field_exp != null && field_exp.FieldInfo.IsInitOnly) {
if (field_exp.IsStatic) {
Report.Error (1650, loc, "Members of static readonly field '{0}' cannot be assigned to " +
"(except in a static constructor or a variable initializer)", TypeManager.GetFullNameSignature (field_exp.FieldInfo));
} else {
Report.Error (1648, loc, "Members of readonly field '{0}' cannot be assigned to " +
"(except in a constructor or a variable initializer)", TypeManager.GetFullNameSignature (field_exp.FieldInfo));
}
return null;
}
}
if (!(target is IAssignMethod) && (target.eclass != ExprClass.EventAccess)) {
Report.Error (131, loc,
"Left hand of an assignment must be a variable, " +
"a property or an indexer");
return null;
}
if ((source.eclass == ExprClass.Type) && (source is TypeExpr)) {
source.Error_UnexpectedKind ("variable or value", loc);
return null;
} else if ((RootContext.Version == LanguageVersion.ISO_1) &&
(source is MethodGroupExpr)){
((MethodGroupExpr) source).ReportUsageError ();
return null;
}
if (target_type == source_type){
if (source is New && target_type.IsValueType &&
(target.eclass != ExprClass.IndexerAccess) && (target.eclass != ExprClass.PropertyAccess)){
New n = (New) source;
if (n.SetValueTypeVariable (target))
return n;
else
return null;
}
return this;
}
//
// If this assignemnt/operator was part of a compound binary
// operator, then we allow an explicit conversion, as detailed
// in the spec.
//
if (this is CompoundAssign){
CompoundAssign a = (CompoundAssign) this;
Binary b = source as Binary;
if (b != null){
//
// 1. if the source is explicitly convertible to the
// target_type
//
source = Convert.WideningAndNarrowingConversion (ec, source, target_type, loc);
if (source == null){
Convert.Error_CannotWideningConversion (loc, source_type, target_type);
return null;
}
//
// 2. and the original right side is implicitly convertible to
// the type of target
//
if (Convert.WideningStandardConversionExists (ec, a.original_source, target_type))
return this;
//
// In the spec 2.4 they added: or if type of the target is int
// and the operator is a shift operator...
//
if (source_type == TypeManager.int32_type &&
(b.Oper == Binary.Operator.LeftShift || b.Oper == Binary.Operator.RightShift))
return this;
Convert.Error_CannotWideningConversion (loc, a.original_source.Type, target_type);
return null;
}
}
source = Convert.ImplicitVBConversionRequired (ec, source, target_type, loc);
if (source == null)
return null;
// If we're an embedded assignment, we need to create a new temporary variable
// for the converted value. Our parent will use this new variable as its source.
// The same applies when we have an embedded assignment - in this case, we need
// to convert our embedded assignment's temporary local variable to the correct
// type and store it in a new temporary local.
if (is_embedded || embedded != null) {
type = target_type;
temp = new LocalTemporary (ec, type);
must_free_temp = true;
}
return this;
}
Expression EmitEmbedded (EmitContext ec)
{
// Emit an embedded assignment.
if (real_temp != null) {
// If we're the innermost assignment, `real_source' is the right-hand
// expression which gets assigned to all the variables left of it.
// Emit this expression and store its result in real_temp.
real_source.Emit (ec);
real_temp.Store (ec);
}
if (embedded != null)
embedded.EmitEmbedded (ec);
// This happens when we've done a type conversion, in this case source will be
// the expression which does the type conversion from real_temp.
// So emit it and store the result in temp; this is the var which will be read
// by our parent.
if (temp != real_temp) {
source.Emit (ec);
temp.Store (ec);
}
Expression temp_source = (temp != null) ? temp : source;
((IAssignMethod) target).EmitAssign (ec, temp_source, false, false);
return temp_source;
}
void ReleaseEmbedded (EmitContext ec)
{
if (embedded != null)
embedded.ReleaseEmbedded (ec);
if (real_temp != null)
real_temp.Release (ec);
if (must_free_temp)
temp.Release (ec);
}
void Emit (EmitContext ec, bool is_statement)
{
if (target is EventExpr) {
((EventExpr) target).EmitAddOrRemove (ec, source);
return;
}
IAssignMethod am = (IAssignMethod) target;
Expression temp_source;
if (embedded != null) {
temp_source = embedded.EmitEmbedded (ec);
if (temp != null) {
source.Emit (ec);
temp.Store (ec);
temp_source = temp;
}
} else
temp_source = source;
am.EmitAssign (ec, temp_source, !is_statement, this is CompoundAssign);
if (embedded != null) {
if (temp != null)
temp.Release (ec);
embedded.ReleaseEmbedded (ec);
}
}
public override void Emit (EmitContext ec)
{
Emit (ec, false);
}
public override void EmitStatement (EmitContext ec)
{
Emit (ec, true);
}
}
//
// This class is used for compound assignments.
//
class CompoundAssign : Assign {
Binary.Operator op;
public Expression original_source;
public CompoundAssign (Binary.Operator op, Expression target, Expression source, Location l)
: base (target, source, l)
{
original_source = source;
this.op = op;
}
protected CompoundAssign (CompoundAssign embedded, Location l)
: this (embedded.op, embedded.target, embedded.source, l)
{
this.is_embedded = true;
}
protected override Assign GetEmbeddedAssign (Location loc)
{
return new CompoundAssign (this, loc);
}
public Expression ResolveSource (EmitContext ec)
{
return original_source.Resolve (ec);
}
public override Expression DoResolve (EmitContext ec)
{
original_source = original_source.Resolve (ec);
if (original_source == null)
return null;
target = target.Resolve (ec);
if (target == null)
return null;
//
// Only now we can decouple the original source/target
// into a tree, to guarantee that we do not have side
// effects.
//
source = new Binary (op, target, original_source, loc);
return base.DoResolve (ec);
}
}
}
File diff suppressed because it is too large. Load diff
File renamed without changes.
+40
View File
@@ -0,0 +1,40 @@
AssemblyInfo.cs
anonymous.cs
assign.cs
attribute.cs
driver.cs
mb-tokenizer.cs
cfold.cs
class.cs
codegen.cs
const.cs
constant.cs
convert.cs
decl.cs
delegate.cs
doc.cs
enum.cs
ecore.cs
expression.cs
flowanalysis.cs
generic.cs
iterators.cs
literal.cs
location.cs
modifiers.cs
namespace.cs
parameter.cs
pending.cs
report.cs
rootcontext.cs
statement.cs
support.cs
typemanager.cs
symbolwriter.cs
tree.cs
module.cs
../class/corlib/Mono.Security.Cryptography/CryptoConvert.cs
../class/Mono.CompilerServices.SymbolWriter/MonoSymbolFile.cs
../class/Mono.CompilerServices.SymbolWriter/MonoSymbolTable.cs
../class/Mono.CompilerServices.SymbolWriter/MonoSymbolWriter.cs
../build/common/Consts.cs
+1246
View File
File diff suppressed because it is too large. Load diff
+8091
View File
File diff suppressed because it is too large. Load diff
+1377
View File
File diff suppressed because it is too large. Load diff
+321
View File
@@ -0,0 +1,321 @@
//
// const.cs: Constant declarations.
//
// Author:
// Miguel de Icaza ([email protected])
// Marek Safar ([email protected])
//
// (C) 2001 Ximian, Inc.
//
//
//
// This is needed because the following situation arises:
//
// The FieldBuilder is declared with the real type for an enumeration
//
// When we attempt to set the value for the constant, the FieldBuilder.SetConstant
// function aborts because it requires its argument to be of the same type
//
namespace Mono.CSharp {
using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Collections;
public class Const : FieldMember {
public Expression Expr;
EmitContext const_ec;
bool resolved = false;
object ConstantValue = null;
bool in_transit = false;
public const int AllowedModifiers =
Modifiers.NEW |
Modifiers.PUBLIC |
Modifiers.PROTECTED |
Modifiers.INTERNAL |
Modifiers.PRIVATE;
public Const (TypeContainer parent, Expression constant_type, string name,
Expression expr, int mod_flags, Attributes attrs, Location loc)
: base (parent, constant_type, mod_flags, AllowedModifiers,
new MemberName (name), null, attrs, loc)
{
Expr = expr;
ModFlags |= Modifiers.STATIC;
}
#if DEBUG
void dump_tree (Type t)
{
Console.WriteLine ("Dumping hierarchy");
while (t != null){
Console.WriteLine (" " + t.FullName + " " +
(t.GetType ().IsEnum ? "yes" : "no"));
t = t.BaseType;
}
}
#endif
protected override bool CheckBase ()
{
// Constant.Define can be called when the parent type hasn't yet been populated
// and it's base types need not have been populated. So, we defer this check
// to the second time Define () is called on this member.
if (Parent.BaseCache == null)
return true;
return base.CheckBase ();
}
/// <summary>
/// Defines the constant in the @parent
/// </summary>
public override bool Define ()
{
// Make Define () idempotent, but ensure that the error check happens.
if (FieldBuilder != null)
return base.CheckBase ();
if (!base.Define ())
return false;
const_ec = new EmitContext (Parent, Location, null, MemberType, ModFlags);
Type ttype = MemberType;
while (ttype.IsArray)
ttype = TypeManager.GetElementType (ttype);
if (!TypeManager.IsBuiltinType(ttype) && (!ttype.IsSubclassOf(TypeManager.enum_type)) && !(Expr is NullLiteral)){
Report.Error (
-3, Location,
"Constant type is not valid (only system types are allowed)");
return false;
}
FieldAttributes field_attr = FieldAttributes.Static | Modifiers.FieldAttr (ModFlags);
// I don't know why but they emit decimal constant as InitOnly
if (ttype == TypeManager.decimal_type) {
field_attr |= FieldAttributes.InitOnly;
}
else {
field_attr |= FieldAttributes.Literal;
}
FieldBuilder = Parent.TypeBuilder.DefineField (Name, MemberType, field_attr);
TypeManager.RegisterConstant (FieldBuilder, this);
return true;
}
//
// Changes the type of the constant expression `expr' to the Type `type'
// Returns null on failure.
//
public static Constant ChangeType (Location loc, Constant expr, Type type)
{
if (type == TypeManager.object_type)
return expr;
bool fail;
// from the null type to any reference-type.
if (expr.Type == TypeManager.null_type && !type.IsValueType && !TypeManager.IsEnumType (type))
return NullLiteral.Null;
if (!Convert.WideningStandardConversionExists (Convert.ConstantEC, expr, type)){
Convert.Error_CannotWideningConversion (loc, expr.Type, type);
return null;
}
// Special-case: The 0 literal can be converted to an enum value,
// and WideningStandardConversionExists will return true in that case.
if (expr.Type == TypeManager.int32_type && TypeManager.IsEnumType (type)){
if (expr is IntLiteral && ((IntLiteral) expr).Value == 0)
return new EnumConstant (expr, type);
}
object constant_value = TypeManager.ChangeType (expr.GetValue (), type, out fail);
if (fail){
Convert.Error_CannotWideningConversion (loc, expr.Type, type);
//
// We should always catch the error before this is ever
// reached, by calling Convert.WideningStandardConversionExists
//
throw new Exception (
String.Format ("LookupConstantValue: This should never be reached {0} {1}", expr.Type, type));
}
Constant retval;
if (type == TypeManager.int32_type)
retval = new IntConstant ((int) constant_value);
else if (type == TypeManager.uint32_type)
retval = new UIntConstant ((uint) constant_value);
else if (type == TypeManager.int64_type)
retval = new LongConstant ((long) constant_value);
else if (type == TypeManager.uint64_type)
retval = new ULongConstant ((ulong) constant_value);
else if (type == TypeManager.float_type)
retval = new FloatConstant ((float) constant_value);
else if (type == TypeManager.double_type)
retval = new DoubleConstant ((double) constant_value);
else if (type == TypeManager.string_type)
retval = new StringConstant ((string) constant_value);
else if (type == TypeManager.short_type)
retval = new ShortConstant ((short) constant_value);
else if (type == TypeManager.ushort_type)
retval = new UShortConstant ((ushort) constant_value);
else if (type == TypeManager.sbyte_type)
retval = new SByteConstant ((sbyte) constant_value);
else if (type == TypeManager.byte_type)
retval = new ByteConstant ((byte) constant_value);
else if (type == TypeManager.char_type)
retval = new CharConstant ((char) constant_value);
else if (type == TypeManager.bool_type)
retval = new BoolConstant ((bool) constant_value);
else if (type == TypeManager.decimal_type)
retval = new DecimalConstant ((decimal) constant_value);
else
throw new Exception ("LookupConstantValue: Unhandled constant type: " + type);
return retval;
}
/// <summary>
/// Looks up the value of a constant field. Defines it if it hasn't
/// already been. Similar to LookupEnumValue in spirit.
/// </summary>
public bool LookupConstantValue (out object value)
{
if (resolved) {
value = ConstantValue;
return true;
}
if (in_transit) {
Report.Error (110, Location,
"The evaluation of the constant value for `" +
Name + "' involves a circular definition.");
value = null;
return false;
}
in_transit = true;
int errors = Report.Errors;
//
// We might have cleared Expr ourselves in a recursive definition
//
if (Expr == null){
value = null;
return false;
}
Expr = Expr.Resolve (const_ec);
in_transit = false;
if (Expr == null) {
if (errors == Report.Errors)
Report.Error (150, Location, "A constant value is expected");
value = null;
return false;
}
Expression real_expr = Expr;
Constant ce = Expr as Constant;
if (ce == null){
UnCheckedExpr un_expr = Expr as UnCheckedExpr;
CheckedExpr ch_expr = Expr as CheckedExpr;
EmptyCast ec_expr = Expr as EmptyCast;
if ((un_expr != null) && (un_expr.Expr is Constant))
Expr = un_expr.Expr;
else if ((ch_expr != null) && (ch_expr.Expr is Constant))
Expr = ch_expr.Expr;
else if ((ec_expr != null) && (ec_expr.Child is Constant))
Expr = ec_expr.Child;
else if (Expr is ArrayCreation){
Report.Error (133, Location, "Arrays can not be constant");
} else {
if (errors == Report.Errors)
Report.Error (150, Location, "A constant value is expected");
value = null;
return false;
}
ce = Expr as Constant;
}
if (MemberType != real_expr.Type) {
ce = ChangeType (Location, ce, MemberType);
if (ce == null){
value = null;
return false;
}
Expr = ce;
}
if (ce != null)
ConstantValue = ce.GetValue ();
if (MemberType.IsEnum){
//
// This sadly does not work for our user-defined enumerations types ;-(
//
try {
ConstantValue = System.Enum.ToObject (
MemberType, ConstantValue);
} catch (ArgumentException){
Report.Error (
-16, Location,
".NET SDK 1.0 does not permit to create the constant "+
" field from a user-defined enumeration");
}
}
if (ce is DecimalConstant) {
Decimal d = ((DecimalConstant)ce).Value;
int[] bits = Decimal.GetBits (d);
object[] args = new object[] { (byte)(bits [3] >> 16), (byte)(bits [3] >> 31), (uint)bits [2], (uint)bits [1], (uint)bits [0] };
CustomAttributeBuilder cab = new CustomAttributeBuilder (TypeManager.decimal_constant_attribute_ctor, args);
FieldBuilder.SetCustomAttribute (cab);
}
else{
FieldBuilder.SetConstant (ConstantValue);
}
if (!TypeManager.RegisterFieldValue (FieldBuilder, ConstantValue))
throw new Exception ("Cannot register const value");
value = ConstantValue;
resolved = true;
return true;
}
/// <summary>
/// Emits the field value by evaluating the expression
/// </summary>
public override void Emit ()
{
object value;
LookupConstantValue (out value);
if (OptAttributes != null) {
OptAttributes.Emit (const_ec, this);
}
base.Emit ();
}
}
}
+1540
View File
File diff suppressed because it is too large. Load diff
+2480
View File
File diff suppressed because it is too large. Load diff
+2477
View File
File diff suppressed because it is too large. Load diff
+1064
View File
File diff suppressed because it is too large. Load diff
+819
View File
@@ -0,0 +1,819 @@
//
// doc.cs: Support for XML documentation comment.
//
// Author:
// Atsushi Enomoto <[email protected]>
//
// Licensed under the terms of the GNU GPL
//
// (C) 2004 Novell, Inc.
//
//
using System;
using System.Collections;
using System.Collections.Specialized;
using System.IO;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Xml;
using Mono.CompilerServices.SymbolWriter;
namespace Mono.CSharp {
//
// Support class for XML documentation.
//
public static class DocUtil
{
// TypeContainer
//
// Generates xml doc comments (if any), and if required,
// handle warning report.
//
internal static void GenerateTypeDocComment (TypeContainer t,
DeclSpace ds)
{
GenerateDocComment (t, ds);
if (t.DefaultStaticConstructor != null)
t.DefaultStaticConstructor.GenerateDocComment (t);
if (t.InstanceConstructors != null)
foreach (Constructor c in t.InstanceConstructors)
c.GenerateDocComment (t);
if (t.Types != null)
foreach (TypeContainer tc in t.Types)
tc.GenerateDocComment (t);
if (t.Parts != null) {
IDictionary comments = RootContext.Documentation.PartialComments;
foreach (ClassPart cp in t.Parts) {
if (cp.DocComment == null)
continue;
comments [cp] = cp;
}
}
if (t.Enums != null)
foreach (Enum en in t.Enums)
en.GenerateDocComment (t);
if (t.Constants != null)
foreach (Const c in t.Constants)
c.GenerateDocComment (t);
if (t.Fields != null)
foreach (Field f in t.Fields)
f.GenerateDocComment (t);
if (t.Events != null)
foreach (Event e in t.Events)
e.GenerateDocComment (t);
if (t.Indexers != null)
foreach (Indexer ix in t.Indexers)
ix.GenerateDocComment (t);
if (t.Properties != null)
foreach (Property p in t.Properties)
p.GenerateDocComment (t);
if (t.Methods != null)
foreach (Method m in t.Methods)
m.GenerateDocComment (t);
if (t.Operators != null)
foreach (Operator o in t.Operators)
o.GenerateDocComment (t);
}
// MemberCore
private static readonly string lineHead =
Environment.NewLine + " ";
private static XmlNode GetDocCommentNode (MemberCore mc,
string name)
{
// FIXME: It could be even optimizable as not
// to use XmlDocument. But anyways the nodes
// are not kept in memory.
XmlDocument doc = RootContext.Documentation.XmlDocumentation;
try {
XmlElement el = doc.CreateElement ("member");
el.SetAttribute ("name", name);
string normalized = mc.DocComment;
el.InnerXml = normalized;
// csc keeps lines as written in the sources
// and inserts formatting indentation (which
// is different from XmlTextWriter.Formatting
// one), but when a start tag contains an
// endline, it joins the next line. We don't
// have to follow such a hacky behavior.
string [] split =
normalized.Split ('\n');
int j = 0;
for (int i = 0; i < split.Length; i++) {
string s = split [i].TrimEnd ();
if (s.Length > 0)
split [j++] = s;
}
el.InnerXml = lineHead + String.Join (
lineHead, split, 0, j);
return el;
} catch (XmlException ex) {
Report.Warning (1570, 1, mc.Location, "XML comment on '{0}' has non-well-formed XML ({1}).", name, ex.Message);
XmlComment com = doc.CreateComment (String.Format ("FIXME: Invalid documentation markup was found for member {0}", name));
return com;
}
}
//
// Generates xml doc comments (if any), and if required,
// handle warning report.
//
internal static void GenerateDocComment (MemberCore mc,
DeclSpace ds)
{
if (mc.DocComment != null) {
string name = mc.GetDocCommentName (ds);
XmlNode n = GetDocCommentNode (mc, name);
XmlElement el = n as XmlElement;
if (el != null) {
mc.OnGenerateDocComment (ds, el);
// FIXME: it could be done with XmlReader
foreach (XmlElement inc in n.SelectNodes (".//include"))
HandleInclude (mc, inc);
// FIXME: it could be done with XmlReader
DeclSpace dsTarget = mc as DeclSpace;
if (dsTarget == null)
dsTarget = ds;
foreach (XmlElement see in n.SelectNodes (".//see"))
HandleSee (mc, dsTarget, see);
foreach (XmlElement seealso in n.SelectNodes (".//seealso"))
HandleSeeAlso (mc, dsTarget, seealso);
foreach (XmlElement see in n.SelectNodes (".//exception"))
HandleException (mc, dsTarget, see);
}
n.WriteTo (RootContext.Documentation.XmlCommentOutput);
}
else if (mc.IsExposedFromAssembly (ds)) {
Constructor c = mc as Constructor;
if (c == null || !c.IsDefault ())
Report.Warning (1591, 4, mc.Location,
"Missing XML comment for publicly visible type or member '{0}'", mc.GetSignatureForError ());
}
}
//
// Processes "include" element. Check included file and
// embed the document content inside this documentation node.
//
private static void HandleInclude (MemberCore mc, XmlElement el)
{
string file = el.GetAttribute ("file");
string path = el.GetAttribute ("path");
if (file == "") {
Report.Warning (1590, 1, mc.Location, "Invalid XML 'include' element; Missing 'file' attribute.");
el.ParentNode.InsertBefore (el.OwnerDocument.CreateComment (" Include tag is invalid "), el);
}
else if (path == "") {
Report.Warning (1590, 1, mc.Location, "Invalid XML 'include' element; Missing 'path' attribute.");
el.ParentNode.InsertBefore (el.OwnerDocument.CreateComment (" Include tag is invalid "), el);
}
else {
XmlDocument doc = RootContext.Documentation.StoredDocuments [file] as XmlDocument;
if (doc == null) {
try {
doc = new XmlDocument ();
doc.Load (file);
RootContext.Documentation.StoredDocuments.Add (file, doc);
} catch (Exception) {
el.ParentNode.InsertBefore (el.OwnerDocument.CreateComment (String.Format (" Badly formed XML in at comment file '{0}': cannot be included ", file)), el);
Report.Warning (1592, 1, mc.Location, "Badly formed XML in included comments file -- '{0}'", file);
}
}
bool keepIncludeNode = false;
if (doc != null) {
try {
XmlNodeList nl = doc.SelectNodes (path);
if (nl.Count == 0) {
el.ParentNode.InsertBefore (el.OwnerDocument.CreateComment (" No matching elements were found for the include tag embedded here. "), el);
keepIncludeNode = true;
}
foreach (XmlNode n in nl)
el.ParentNode.InsertBefore (el.OwnerDocument.ImportNode (n, true), el);
} catch (Exception ex) {
el.ParentNode.InsertBefore (el.OwnerDocument.CreateComment (" Failed to insert some or all of included XML "), el);
Report.Warning (1589, 1, mc.Location, "Unable to include XML fragment '{0}' of file {1} -- {2}.", path, file, ex.Message);
}
}
if (!keepIncludeNode)
el.ParentNode.RemoveChild (el);
}
}
//
// Handles <see> elements.
//
private static void HandleSee (MemberCore mc,
DeclSpace ds, XmlElement see)
{
HandleXrefCommon (mc, ds, see);
}
//
// Handles <seealso> elements.
//
private static void HandleSeeAlso (MemberCore mc,
DeclSpace ds, XmlElement seealso)
{
HandleXrefCommon (mc, ds, seealso);
}
//
// Handles <exception> elements.
//
private static void HandleException (MemberCore mc,
DeclSpace ds, XmlElement seealso)
{
HandleXrefCommon (mc, ds, seealso);
}
static readonly char [] wsChars =
new char [] {' ', '\t', '\n', '\r'};
//
// returns a full runtime type name from a name which might
// be C# specific type name.
//
private static Type FindDocumentedType (MemberCore mc, string name, DeclSpace ds, string cref)
{
bool isArray = false;
string identifier = name;
if (name [name.Length - 1] == ']') {
string tmp = name.Substring (0, name.Length - 1).Trim (wsChars);
if (tmp [tmp.Length - 1] == '[') {
identifier = tmp.Substring (0, tmp.Length - 1).Trim (wsChars);
isArray = true;
}
}
Type t = FindDocumentedTypeNonArray (mc, identifier, ds, cref);
if (t != null && isArray)
t = Array.CreateInstance (t, 0).GetType ();
return t;
}
private static Type FindDocumentedTypeNonArray (MemberCore mc,
string identifier, DeclSpace ds, string cref)
{
switch (identifier) {
case "int":
return typeof (int);
case "uint":
return typeof (uint);
case "short":
return typeof (short);
case "ushort":
return typeof (ushort);
case "long":
return typeof (long);
case "ulong":
return typeof (ulong);
case "float":
return typeof (float);
case "double":
return typeof (double);
case "char":
return typeof (char);
case "decimal":
return typeof (decimal);
case "byte":
return typeof (byte);
case "sbyte":
return typeof (sbyte);
case "object":
return typeof (object);
case "bool":
return typeof (bool);
case "string":
return typeof (string);
case "void":
return typeof (void);
}
FullNamedExpression e = ds.FindType (mc.Location, identifier);
if (e != null) {
if (!(e is TypeExpr))
return null;
return ((TypeExpr) e).ResolveType (ds.EmitContext);
}
int index = identifier.LastIndexOf ('.');
if (index < 0)
return null;
int warn;
Type parent = FindDocumentedType (mc, identifier.Substring (0, index), ds, cref);
if (parent == null)
return null;
return FindDocumentedMember (mc, parent,
identifier.Substring (index + 1),
Type.EmptyTypes,
ds, out warn, cref) as Type;
}
//
// Returns a MemberInfo that is referenced in XML documentation
// (by "see" or "seealso" elements).
//
private static MemberInfo FindDocumentedMember (MemberCore mc,
Type type, string memberName, Type [] paramList,
DeclSpace ds, out int warningType, string cref)
{
warningType = 0;
MethodSignature msig = new MethodSignature (memberName, null, paramList);
MemberInfo [] mis = type.FindMembers (
MemberTypes.All,
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance,
MethodSignature.method_signature_filter,
msig);
if (mis.Length > 0)
return mis [0];
if (paramList.Length == 0) {
// search for fields/events etc.
mis = type.FindMembers (
MemberTypes.All,
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance,
Type.FilterName,
memberName);
return (mis.Length > 0) ? mis [0] : null;
}
// search for operators (whose parameters exactly
// matches with the list) and possibly report CS1581.
string oper = null;
string returnTypeName = null;
if (memberName.StartsWith ("implicit operator ")) {
oper = "op_Implicit";
returnTypeName = memberName.Substring (18).Trim (wsChars);
}
else if (memberName.StartsWith ("explicit operator ")) {
oper = "op_Explicit";
returnTypeName = memberName.Substring (18).Trim (wsChars);
}
else if (memberName.StartsWith ("operator ")) {
oper = memberName.Substring (9).Trim (wsChars);
switch (oper) {
// either unary or binary
case "+":
oper = paramList.Length == 2 ?
Binary.oper_names [(int) Binary.Operator.Addition] :
Unary.oper_names [(int) Unary.Operator.UnaryPlus];
break;
case "-":
oper = paramList.Length == 2 ?
Binary.oper_names [(int) Binary.Operator.Subtraction] :
Unary.oper_names [(int) Unary.Operator.UnaryNegation];
break;
// unary
case "!":
oper = Unary.oper_names [(int) Unary.Operator.LogicalNot]; break;
case "~":
oper = Unary.oper_names [(int) Unary.Operator.OnesComplement]; break;
case "++":
oper = "op_Increment"; break;
case "--":
oper = "op_Decrement"; break;
case "true":
oper = "op_True"; break;
case "false":
oper = "op_False"; break;
// binary
case "*":
oper = Binary.oper_names [(int) Binary.Operator.Multiply]; break;
case "/":
oper = Binary.oper_names [(int) Binary.Operator.Division]; break;
case "%":
oper = Binary.oper_names [(int) Binary.Operator.Modulus]; break;
case "&":
oper = Binary.oper_names [(int) Binary.Operator.BitwiseAnd]; break;
case "|":
oper = Binary.oper_names [(int) Binary.Operator.BitwiseOr]; break;
case "^":
oper = Binary.oper_names [(int) Binary.Operator.ExclusiveOr]; break;
case "<<":
oper = Binary.oper_names [(int) Binary.Operator.LeftShift]; break;
case ">>":
oper = Binary.oper_names [(int) Binary.Operator.RightShift]; break;
case "==":
oper = Binary.oper_names [(int) Binary.Operator.Equality]; break;
case "!=":
oper = Binary.oper_names [(int) Binary.Operator.Inequality]; break;
case "<":
oper = Binary.oper_names [(int) Binary.Operator.LessThan]; break;
case ">":
oper = Binary.oper_names [(int) Binary.Operator.GreaterThan]; break;
case "<=":
oper = Binary.oper_names [(int) Binary.Operator.LessThanOrEqual]; break;
case ">=":
oper = Binary.oper_names [(int) Binary.Operator.GreaterThanOrEqual]; break;
default:
warningType = 1584;
Report.Warning (1020, 1, mc.Location, "Overloadable {0} operator is expected", paramList.Length == 2 ? "binary" : "unary");
Report.Warning (1584, 1, mc.Location, "XML comment on '{0}' has syntactically incorrect attribute '{1}'", mc.GetSignatureForError (), cref);
return null;
}
}
// here we still does not consider return type (to
// detect CS1581 or CS1002+CS1584).
msig = new MethodSignature (oper, null, paramList);
mis = type.FindMembers (
MemberTypes.Method,
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static,
MethodSignature.method_signature_filter,
msig);
if (mis.Length == 0)
return null; // CS1574
MemberInfo mi = mis [0];
Type expected = mi is MethodInfo ?
((MethodInfo) mi).ReturnType :
mi is PropertyInfo ?
((PropertyInfo) mi).PropertyType :
null;
if (returnTypeName != null) {
Type returnType = FindDocumentedType (mc, returnTypeName, ds, cref);
if (returnType == null || returnType != expected) {
warningType = 1581;
Report.Warning (1581, 1, mc.Location, "Invalid return type in XML comment cref attribute '{0}'", cref);
return null;
}
}
return mis [0];
}
//
// Processes "see" or "seealso" elements.
// Checks cref attribute.
//
private static void HandleXrefCommon (MemberCore mc,
DeclSpace ds, XmlElement xref)
{
string cref = xref.GetAttribute ("cref").Trim (wsChars);
// when, XmlReader, "if (cref == null)"
if (!xref.HasAttribute ("cref"))
return;
if (cref.Length == 0)
Report.Warning (1001, 1, mc.Location, "Identifier expected");
// ... and continue until CS1584.
string signature; // "x:" are stripped
string name; // method invokation "(...)" are removed
string parameters; // method parameter list
// strip 'T:' 'M:' 'F:' 'P:' 'E:' etc.
// Here, MS ignores its member kind. No idea why.
if (cref.Length > 2 && cref [1] == ':')
signature = cref.Substring (2).Trim (wsChars);
else
signature = cref;
int parensPos = signature.IndexOf ('(');
if (parensPos > 0 && signature [signature.Length - 1] == ')') {
name = signature.Substring (0, parensPos).Trim (wsChars);
parameters = signature.Substring (parensPos + 1, signature.Length - parensPos - 2);
}
else {
name = signature;
parameters = String.Empty;
}
string identifier = name;
if (name.Length > 0 && name [name.Length - 1] == ']') {
string tmp = name.Substring (0, name.Length - 1).Trim (wsChars);
if (tmp [tmp.Length - 1] == '[')
identifier = tmp.Substring (0, tmp.Length - 1).Trim (wsChars);
}
// Check if identifier is valid.
// This check is not necessary to mark as error, but
// csc specially reports CS1584 for wrong identifiers.
foreach (string nameElem in identifier.Split ('.')) {
if (!Tokenizer.IsValidIdentifier (nameElem)
&& nameElem.IndexOf ("operator") < 0) {
if (nameElem.EndsWith ("[]") &&
Tokenizer.IsValidIdentifier (
nameElem.Substring (
0, nameElem.Length - 2)))
continue;
Report.Warning (1584, 1, mc.Location, "XML comment on '{0}' has syntactically incorrect attribute '{1}'", mc.GetSignatureForError (), cref);
xref.SetAttribute ("cref", "!:" + signature);
return;
}
}
// check if parameters are valid
Type [] parameterTypes = Type.EmptyTypes;
if (parameters.Length > 0) {
string [] paramList = parameters.Split (',');
ArrayList plist = new ArrayList ();
for (int i = 0; i < paramList.Length; i++) {
string paramTypeName = paramList [i].Trim (wsChars);
Type paramType = FindDocumentedType (mc, paramTypeName, ds, cref);
if (paramType == null) {
Report.Warning (1580, 1, mc.Location, "Invalid type for parameter '{0}' in XML comment cref attribute '{1}'", i + 1, cref);
return;
}
plist.Add (paramType);
}
parameterTypes = plist.ToArray (typeof (Type)) as Type [];
StringBuilder sb = new StringBuilder ();
sb.Append ('(');
for (int i = 0; i < parameterTypes.Length; i++) {
Type t = parameterTypes [i];
if (sb.Length > 1)
sb.Append (',');
sb.Append (t.FullName.Replace ('+', '.'));
}
sb.Append (')');
parameters = sb.ToString ();
}
Type type = FindDocumentedType (mc, name, ds, cref);
if (type != null) {
xref.SetAttribute ("cref", "T:" + type.FullName.Replace ("+", "."));
return; // a type
}
// don't use identifier here. System[] is not alloed.
if (Namespace.IsNamespace (name)) {
xref.SetAttribute ("cref", "N:" + name);
return; // a namespace
}
int period = name.LastIndexOf ('.');
if (period > 0) {
string typeName = name.Substring (0, period);
string memberName = name.Substring (period + 1);
type = FindDocumentedType (mc, typeName, ds, cref);
int warnResult;
if (type != null) {
MemberInfo mi = FindDocumentedMember (mc, type, memberName, parameterTypes, ds, out warnResult, cref);
if (warnResult > 0)
return;
if (mi != null) {
xref.SetAttribute ("cref", GetMemberDocHead (mi.MemberType) + type.FullName.Replace ("+", ".") + "." + memberName + parameters);
return; // a member of a type
}
}
}
else {
int warnResult;
MemberInfo mi = FindDocumentedMember (mc, ds.TypeBuilder, name, parameterTypes, ds, out warnResult, cref);
if (warnResult > 0)
return;
if (mi != null) {
xref.SetAttribute ("cref", GetMemberDocHead (mi.MemberType) + ds.TypeBuilder.FullName.Replace ("+", ".") + "." + name);
return; // local member name
}
}
Report.Warning (1574, 1, mc.Location, "XML comment on '{0}' has cref attribute '{1}' that could not be resolved in '{2}'.", mc.GetSignatureForError (), cref, ds.GetSignatureForError ());
xref.SetAttribute ("cref", "!:" + name);
}
//
// Get a prefix from member type for XML documentation (used
// to formalize cref target name).
//
static string GetMemberDocHead (MemberTypes type)
{
switch (type) {
case MemberTypes.Constructor:
case MemberTypes.Method:
return "M:";
case MemberTypes.Event:
return "E:";
case MemberTypes.Field:
return "F:";
case MemberTypes.NestedType:
case MemberTypes.TypeInfo:
return "T:";
case MemberTypes.Property:
return "P:";
}
return "!:";
}
// MethodCore
//
// Returns a string that represents the signature for this
// member which should be used in XML documentation.
//
public static string GetMethodDocCommentName (MethodCore mc, DeclSpace ds)
{
Parameter [] plist = mc.Parameters.FixedParameters;
Parameter parr = mc.Parameters.ArrayParameter;
string paramSpec = String.Empty;
if (plist != null) {
StringBuilder psb = new StringBuilder ();
foreach (Parameter p in plist) {
psb.Append (psb.Length != 0 ? "," : "(");
psb.Append (p.ParameterType.FullName.Replace ("+", "."));
}
paramSpec = psb.ToString ();
}
if (parr != null)
paramSpec += String.Concat (
paramSpec == String.Empty ? "(" : ",",
parr.ParameterType.FullName.Replace ("+", "."));
if (paramSpec.Length > 0)
paramSpec += ")";
string name = mc is Constructor ? "#ctor" : mc.Name;
string suffix = String.Empty;
Operator op = mc as Operator;
if (op != null) {
switch (op.OperatorType) {
case Operator.OpType.Implicit:
case Operator.OpType.Explicit:
suffix = "~" + op.OperatorMethodBuilder.ReturnType.FullName.Replace ('+', '.');
break;
}
}
return String.Concat (mc.DocCommentHeader, ds.Name, ".", name, paramSpec, suffix);
}
//
// Raised (and passed an XmlElement that contains the comment)
// when GenerateDocComment is writing documentation expectedly.
//
// FIXME: with a few effort, it could be done with XmlReader,
// that means removal of DOM use.
//
internal static void OnMethodGenerateDocComment (
MethodCore mc, DeclSpace ds, XmlElement el)
{
Hashtable paramTags = new Hashtable ();
foreach (XmlElement pelem in el.SelectNodes ("param")) {
int i;
string xname = pelem.GetAttribute ("name");
if (xname == "")
continue; // really? but MS looks doing so
if (xname != "" && mc.Parameters.GetParameterByName (xname, out i) == null)
Report.Warning (1572, 2, mc.Location, "XML comment on '{0}' has a 'param' tag for '{1}', but there is no such parameter.", mc.Name, xname);
else if (paramTags [xname] != null)
Report.Warning (1571, 2, mc.Location, "XML comment on '{0}' has a duplicate param tag for '{1}'", mc.Name, xname);
paramTags [xname] = xname;
}
Parameter [] plist = mc.Parameters.FixedParameters;
if (plist != null) {
foreach (Parameter p in plist) {
if (paramTags.Count > 0 && paramTags [p.Name] == null)
Report.Warning (1573, 4, mc.Location, "Parameter '{0}' has no matching param tag in the XML comment for '{1}' (but other parameters do)", mc.Name, p.Name);
}
}
}
// Enum
public static void GenerateEnumDocComment (Enum e, DeclSpace ds)
{
GenerateDocComment (e, ds);
foreach (string name in e.ordered_enums) {
MemberCore mc = e.GetDefinition (name);
GenerateDocComment (mc, e);
}
}
}
//
// Implements XML documentation generation.
//
public class Documentation
{
public Documentation (string xml_output_filename)
{
docfilename = xml_output_filename;
XmlDocumentation = new XmlDocument ();
XmlDocumentation.PreserveWhitespace = false;
}
private string docfilename;
//
// Used to create element which helps well-formedness checking.
//
public XmlDocument XmlDocumentation;
//
// The output for XML documentation.
//
public XmlWriter XmlCommentOutput;
//
// Stores XmlDocuments that are included in XML documentation.
// Keys are included filenames, values are XmlDocuments.
//
public Hashtable StoredDocuments = new Hashtable ();
//
// Stores comments on partial types (should handle uniquely).
// Keys are PartialContainers, values are comment strings
// (didn't use StringBuilder; usually we have just 2 or more).
//
public IDictionary PartialComments = new ListDictionary ();
//
// Outputs XML documentation comment from tokenized comments.
//
public bool OutputDocComment (string asmfilename)
{
XmlTextWriter w = null;
try {
w = new XmlTextWriter (docfilename, null);
w.Indentation = 4;
w.Formatting = Formatting.Indented;
w.WriteStartDocument ();
w.WriteStartElement ("doc");
w.WriteStartElement ("assembly");
w.WriteStartElement ("name");
w.WriteString (Path.ChangeExtension (asmfilename, null));
w.WriteEndElement (); // name
w.WriteEndElement (); // assembly
w.WriteStartElement ("members");
XmlCommentOutput = w;
GenerateDocComment ();
w.WriteFullEndElement (); // members
w.WriteEndElement ();
w.WriteWhitespace (Environment.NewLine);
w.WriteEndDocument ();
return true;
} catch (Exception ex) {
Report.Error (1569, "Error generating XML documentation file '{0}' ('{1}')", docfilename, ex.Message);
return false;
} finally {
if (w != null)
w.Close ();
}
}
//
// Fixes full type name of each documented types/members up.
//
public void GenerateDocComment ()
{
TypeContainer root = RootContext.Tree.Types;
if (root.Interfaces != null)
foreach (Interface i in root.Interfaces)
DocUtil.GenerateTypeDocComment (i, null);
if (root.Types != null)
foreach (TypeContainer tc in root.Types)
DocUtil.GenerateTypeDocComment (tc, null);
if (root.Parts != null) {
IDictionary comments = PartialComments;
foreach (ClassPart cp in root.Parts) {
if (cp.DocComment == null)
continue;
comments [cp] = cp;
}
}
if (root.Delegates != null)
foreach (Delegate d in root.Delegates)
DocUtil.GenerateDocComment (d, null);
if (root.Enums != null)
foreach (Enum e in root.Enums)
DocUtil.GenerateEnumDocComment (e, null);
IDictionary table = new ListDictionary ();
foreach (ClassPart cp in PartialComments.Keys) {
table [cp.PartialContainer] += cp.DocComment;
}
foreach (PartialContainer pc in table.Keys) {
pc.DocComment = table [pc] as string;
DocUtil.GenerateDocComment (pc, null);
}
}
}
}
+1863
View File
File diff suppressed because it is too large. Load diff
+3918
View File
File diff suppressed because it is too large. Load diff
+811
View File
@@ -0,0 +1,811 @@
//
// enum.cs: Enum handling.
//
// Author: Miguel de Icaza ([email protected])
// Ravi Pratap ([email protected])
//
// Licensed under the terms of the GNU GPL
//
// (C) 2001 Ximian, Inc (http://www.ximian.com)
//
using System;
using System.Collections;
using System.Reflection;
using System.Reflection.Emit;
using System.Globalization;
using System.Xml;
namespace Mono.CSharp {
class EnumMember: MemberCore {
static string[] attribute_targets = new string [] { "field" };
Enum parent_enum;
public FieldBuilder builder;
internal readonly Expression Type;
public EnumMember (Enum parent_enum, Expression expr, string name,
Location loc, Attributes attrs):
base (null, new MemberName (name), attrs, loc)
{
this.parent_enum = parent_enum;
this.ModFlags = parent_enum.ModFlags;
this.Type = expr;
}
public override void ApplyAttributeBuilder(Attribute a, CustomAttributeBuilder cb)
{
if (a.Type == TypeManager.marshal_as_attr_type) {
UnmanagedMarshal marshal = a.GetMarshal (this);
if (marshal != null) {
builder.SetMarshal (marshal);
}
return;
}
if (a.Type.IsSubclassOf (TypeManager.security_attr_type)) {
a.Error_InvalidSecurityParent ();
return;
}
builder.SetCustomAttribute (cb);
}
public override AttributeTargets AttributeTargets {
get {
return AttributeTargets.Field;
}
}
public void DefineMember (TypeBuilder tb)
{
FieldAttributes attr = FieldAttributes.Public | FieldAttributes.Static
| FieldAttributes.Literal;
builder = tb.DefineField (Name, tb, attr);
}
public override bool Define ()
{
throw new NotImplementedException ();
}
public void Emit (EmitContext ec)
{
if (OptAttributes != null)
OptAttributes.Emit (ec, this);
Emit ();
}
public override string GetSignatureForError()
{
return String.Concat (parent_enum.GetSignatureForError (), '.', base.GetSignatureForError ());
}
public override string[] ValidAttributeTargets {
get {
return attribute_targets;
}
}
protected override bool VerifyClsCompliance(DeclSpace ds)
{
// Because parent is TypeContainer and we have only DeclSpace parent.
// Parameter replacing is required
return base.VerifyClsCompliance (parent_enum);
}
// There is no base type
protected override void VerifyObsoleteAttribute()
{
}
public override string DocCommentHeader {
get { return "F:"; }
}
}
/// <summary>
/// Enumeration container
/// </summary>
public class Enum : DeclSpace {
public ArrayList ordered_enums;
public Expression BaseType;
public Type UnderlyingType;
Hashtable member_to_location;
//
// This is for members that have been defined
//
Hashtable member_to_value;
//
// This is used to mark members we're currently defining
//
Hashtable in_transit;
ArrayList field_builders;
public const int AllowedModifiers =
Modifiers.NEW |
Modifiers.PUBLIC |
Modifiers.PROTECTED |
Modifiers.INTERNAL |
Modifiers.PRIVATE;
public Enum (NamespaceEntry ns, TypeContainer parent, Expression type,
int mod_flags, MemberName name, Attributes attrs, Location l)
: base (ns, parent, name, attrs, l)
{
this.BaseType = type;
ModFlags = Modifiers.Check (AllowedModifiers, mod_flags,
IsTopLevel ? Modifiers.INTERNAL : Modifiers.PRIVATE, l);
ordered_enums = new ArrayList ();
member_to_location = new Hashtable ();
member_to_value = new Hashtable ();
in_transit = new Hashtable ();
field_builders = new ArrayList ();
}
/// <summary>
/// Adds @name to the enumeration space, with @expr
/// being its definition.
/// </summary>
public void AddEnumMember (string name, Expression expr, Location loc, Attributes opt_attrs, string documentation)
{
if (name == "value__") {
Report.Error (76, loc, "An item in an enumeration can't have an identifier `value__'");
return;
}
EnumMember em = new EnumMember (this, expr, name, loc, opt_attrs);
em.DocComment = documentation;
if (!AddToContainer (em, name, ""))
return;
// TODO: can be almost deleted
ordered_enums.Add (name);
member_to_location.Add (name, loc);
}
//
// This is used by corlib compilation: we map from our
// type to a type that is consumable by the DefineField
//
Type MapToInternalType (Type t)
{
if (t == TypeManager.int32_type)
return typeof (int);
if (t == TypeManager.int64_type)
return typeof (long);
if (t == TypeManager.uint32_type)
return typeof (uint);
if (t == TypeManager.uint64_type)
return typeof (ulong);
if (t == TypeManager.float_type)
return typeof (float);
if (t == TypeManager.double_type)
return typeof (double);
if (t == TypeManager.byte_type)
return typeof (byte);
if (t == TypeManager.sbyte_type)
return typeof (sbyte);
if (t == TypeManager.char_type)
return typeof (char);
if (t == TypeManager.short_type)
return typeof (short);
if (t == TypeManager.ushort_type)
return typeof (ushort);
throw new Exception ();
}
public override TypeBuilder DefineType ()
{
if (TypeBuilder != null)
return TypeBuilder;
TypeAttributes attr = Modifiers.TypeAttr (ModFlags, IsTopLevel);
ec = new EmitContext (this, this, Location, null, null, ModFlags, false);
attr |= TypeAttributes.Class | TypeAttributes.Sealed;
if (!(BaseType is TypeLookupExpression)) {
Report.Error (1008, Location,
"Type byte, sbyte, short, ushort, int, uint, " +
"long, or ulong expected (got: `{0}')", BaseType);
return null;
}
TypeExpr ute = ResolveBaseTypeExpr (BaseType, false, Location);
if (ute == null)
return null;
UnderlyingType = ute.Type;
if (UnderlyingType != TypeManager.int32_type &&
UnderlyingType != TypeManager.uint32_type &&
UnderlyingType != TypeManager.int64_type &&
UnderlyingType != TypeManager.uint64_type &&
UnderlyingType != TypeManager.short_type &&
UnderlyingType != TypeManager.ushort_type &&
UnderlyingType != TypeManager.byte_type &&
UnderlyingType != TypeManager.sbyte_type) {
Report.Error (1008, Location,
"Type byte, sbyte, short, ushort, int, uint, " +
"long, or ulong expected (got: " +
TypeManager.CSharpName (UnderlyingType) + ")");
return null;
}
if (IsTopLevel) {
if (TypeManager.NamespaceClash (Name, Location))
return null;
ModuleBuilder builder = CodeGen.Module.Builder;
TypeBuilder = builder.DefineType (Name, attr, TypeManager.enum_type);
} else {
TypeBuilder builder = Parent.TypeBuilder;
TypeBuilder = builder.DefineNestedType (
Basename, attr, TypeManager.enum_type);
}
//
// Call MapToInternalType for corlib
//
TypeBuilder.DefineField ("value__", UnderlyingType,
FieldAttributes.Public | FieldAttributes.SpecialName
| FieldAttributes.RTSpecialName);
TypeManager.AddEnumType (Name, TypeBuilder, this);
return TypeBuilder;
}
bool IsValidEnumConstant (Expression e)
{
if (!(e is Constant))
return false;
if (e is IntConstant || e is UIntConstant || e is LongConstant ||
e is ByteConstant || e is SByteConstant || e is ShortConstant ||
e is UShortConstant || e is ULongConstant || e is EnumConstant ||
e is CharConstant)
return true;
else
return false;
}
object GetNextDefaultValue (object default_value)
{
if (UnderlyingType == TypeManager.int32_type) {
int i = (int) default_value;
if (i < System.Int32.MaxValue)
return ++i;
else
return null;
} else if (UnderlyingType == TypeManager.uint32_type) {
uint i = (uint) default_value;
if (i < System.UInt32.MaxValue)
return ++i;
else
return null;
} else if (UnderlyingType == TypeManager.int64_type) {
long i = (long) default_value;
if (i < System.Int64.MaxValue)
return ++i;
else
return null;
} else if (UnderlyingType == TypeManager.uint64_type) {
ulong i = (ulong) default_value;
if (i < System.UInt64.MaxValue)
return ++i;
else
return null;
} else if (UnderlyingType == TypeManager.short_type) {
short i = (short) default_value;
if (i < System.Int16.MaxValue)
return ++i;
else
return null;
} else if (UnderlyingType == TypeManager.ushort_type) {
ushort i = (ushort) default_value;
if (i < System.UInt16.MaxValue)
return ++i;
else
return null;
} else if (UnderlyingType == TypeManager.byte_type) {
byte i = (byte) default_value;
if (i < System.Byte.MaxValue)
return ++i;
else
return null;
} else if (UnderlyingType == TypeManager.sbyte_type) {
sbyte i = (sbyte) default_value;
if (i < System.SByte.MaxValue)
return ++i;
else
return null;
}
return null;
}
void Error_ConstantValueCannotBeConverted (object val, Location loc)
{
if (val is Constant)
Report.Error (31, loc, "Constant value '" + ((Constant) val).AsString () +
"' cannot be converted" +
" to a " + TypeManager.CSharpName (UnderlyingType));
else
Report.Error (31, loc, "Constant value '" + val +
"' cannot be converted" +
" to a " + TypeManager.CSharpName (UnderlyingType));
return;
}
/// <summary>
/// Determines if a standard implicit conversion exists from
/// expr_type to target_type
/// </summary>
public static bool WideningConversionExists (Type expr_type, Type target_type)
{
expr_type = TypeManager.TypeToCoreType (expr_type);
if (expr_type == TypeManager.void_type)
return false;
if (expr_type == target_type)
return true;
// First numeric conversions
if (expr_type == TypeManager.sbyte_type){
//
// From sbyte to short, int, long, float, double.
//
if ((target_type == TypeManager.int32_type) ||
(target_type == TypeManager.int64_type) ||
(target_type == TypeManager.double_type) ||
(target_type == TypeManager.float_type) ||
(target_type == TypeManager.short_type) ||
(target_type == TypeManager.decimal_type))
return true;
} else if (expr_type == TypeManager.byte_type){
//
// From byte to short, ushort, int, uint, long, ulong, float, double
//
if ((target_type == TypeManager.short_type) ||
(target_type == TypeManager.ushort_type) ||
(target_type == TypeManager.int32_type) ||
(target_type == TypeManager.uint32_type) ||
(target_type == TypeManager.uint64_type) ||
(target_type == TypeManager.int64_type) ||
(target_type == TypeManager.float_type) ||
(target_type == TypeManager.double_type) ||
(target_type == TypeManager.decimal_type))
return true;
} else if (expr_type == TypeManager.short_type){
//
// From short to int, long, float, double
//
if ((target_type == TypeManager.int32_type) ||
(target_type == TypeManager.int64_type) ||
(target_type == TypeManager.double_type) ||
(target_type == TypeManager.float_type) ||
(target_type == TypeManager.decimal_type))
return true;
} else if (expr_type == TypeManager.ushort_type){
//
// From ushort to int, uint, long, ulong, float, double
//
if ((target_type == TypeManager.uint32_type) ||
(target_type == TypeManager.uint64_type) ||
(target_type == TypeManager.int32_type) ||
(target_type == TypeManager.int64_type) ||
(target_type == TypeManager.double_type) ||
(target_type == TypeManager.float_type) ||
(target_type == TypeManager.decimal_type))
return true;
} else if (expr_type == TypeManager.int32_type){
//
// From int to long, float, double
//
if ((target_type == TypeManager.int64_type) ||
(target_type == TypeManager.double_type) ||
(target_type == TypeManager.float_type) ||
(target_type == TypeManager.decimal_type))
return true;
} else if (expr_type == TypeManager.uint32_type){
//
// From uint to long, ulong, float, double
//
if ((target_type == TypeManager.int64_type) ||
(target_type == TypeManager.uint64_type) ||
(target_type == TypeManager.double_type) ||
(target_type == TypeManager.float_type) ||
(target_type == TypeManager.decimal_type))
return true;
} else if ((expr_type == TypeManager.uint64_type) ||
(expr_type == TypeManager.int64_type)) {
//
// From long/ulong to float, double
//
if ((target_type == TypeManager.double_type) ||
(target_type == TypeManager.float_type) ||
(target_type == TypeManager.decimal_type))
return true;
} else if (expr_type == TypeManager.char_type){
//
// From char to ushort, int, uint, long, ulong, float, double
//
if ((target_type == TypeManager.ushort_type) ||
(target_type == TypeManager.int32_type) ||
(target_type == TypeManager.uint32_type) ||
(target_type == TypeManager.uint64_type) ||
(target_type == TypeManager.int64_type) ||
(target_type == TypeManager.float_type) ||
(target_type == TypeManager.double_type) ||
(target_type == TypeManager.decimal_type))
return true;
} else if (expr_type == TypeManager.float_type){
//
// float to double
//
if (target_type == TypeManager.double_type)
return true;
}
return false;
}
//
// Horrible, horrible. But there is no other way we can pass the EmitContext
// to the recursive definition triggered by the evaluation of a forward
// expression
//
static EmitContext current_ec = null;
/// <summary>
/// This is used to lookup the value of an enum member. If the member is undefined,
/// it attempts to define it and return its value
/// </summary>
public object LookupEnumValue (EmitContext ec, string name, Location loc)
{
object default_value = null;
Constant c = null;
default_value = member_to_value [name];
if (default_value != null)
return default_value;
//
// This may happen if we're calling a method in System.Enum, for instance
// Enum.IsDefined().
//
if (!defined_names.Contains (name))
return null;
if (in_transit.Contains (name)) {
Report.Error (110, loc, "The evaluation of the constant value for `" +
Name + "." + name + "' involves a circular definition.");
return null;
}
//
// So if the above doesn't happen, we have a member that is undefined
// We now proceed to define it
//
Expression val = this [name];
if (val == null) {
int idx = ordered_enums.IndexOf (name);
if (idx == 0)
default_value = 0;
else {
for (int i = 0; i < idx; ++i) {
string n = (string) ordered_enums [i];
Location m_loc = (Mono.CSharp.Location)
member_to_location [n];
in_transit.Add (name, true);
EmitContext old_ec = current_ec;
current_ec = ec;
default_value = LookupEnumValue (ec, n, m_loc);
current_ec = old_ec;
in_transit.Remove (name);
if (default_value == null)
return null;
}
default_value = GetNextDefaultValue (default_value);
}
} else {
bool old = ec.InEnumContext;
ec.InEnumContext = true;
in_transit.Add (name, true);
EmitContext old_ec = current_ec;
current_ec = ec;
val = val.Resolve (ec);
current_ec = old_ec;
in_transit.Remove (name);
ec.InEnumContext = old;
if (val == null)
return null;
if (!IsValidEnumConstant (val)) {
Report.Error (
1008, loc,
"Type byte, sbyte, short, ushort, int, uint, long, or " +
"ulong expected (have: " + val + ")");
return null;
}
c = (Constant) val;
default_value = c.GetValue ();
if (default_value == null) {
Error_ConstantValueCannotBeConverted (c, loc);
return null;
}
if (val is EnumConstant){
Type etype = TypeManager.EnumToUnderlying (c.Type);
if (!WideningConversionExists (etype, UnderlyingType)){
Convert.Error_CannotWideningConversion (
loc, c.Type, UnderlyingType);
return null;
}
}
}
EnumMember em = (EnumMember) defined_names [name];
em.DefineMember (TypeBuilder);
bool fail;
default_value = TypeManager.ChangeType (default_value, UnderlyingType, out fail);
if (fail){
Error_ConstantValueCannotBeConverted (c, loc);
return null;
}
em.builder.SetConstant (default_value);
field_builders.Add (em.builder);
member_to_value [name] = default_value;
if (!TypeManager.RegisterFieldValue (em.builder, default_value))
return null;
return default_value;
}
public override bool DefineMembers (TypeContainer parent)
{
return true;
}
public override bool Define ()
{
//
// If there was an error during DefineEnum, return
//
if (TypeBuilder == null)
return false;
ec = new EmitContext (this, this, Location, null, UnderlyingType, ModFlags, false);
object default_value = 0;
foreach (string name in ordered_enums) {
//
// Have we already been defined, thanks to some cross-referencing ?
//
if (member_to_value.Contains (name))
continue;
Location loc = (Mono.CSharp.Location) member_to_location [name];
if (this [name] != null) {
default_value = LookupEnumValue (ec, name, loc);
if (default_value == null)
return true;
} else {
if (name == "value__"){
Report.Error (76, loc, "The name `value__' is reserved for enumerations");
return false;
}
EnumMember em = (EnumMember) defined_names [name];
em.DefineMember (TypeBuilder);
FieldBuilder fb = em.builder;
if (default_value == null) {
Report.Error (543, loc, "Enumerator value for '" + name + "' is too large to " +
"fit in its type");
return false;
}
bool fail;
default_value = TypeManager.ChangeType (default_value, UnderlyingType, out fail);
if (fail){
Error_ConstantValueCannotBeConverted (default_value, loc);
return false;
}
fb.SetConstant (default_value);
field_builders.Add (fb);
member_to_value [name] = default_value;
if (!TypeManager.RegisterFieldValue (fb, default_value))
return false;
}
default_value = GetNextDefaultValue (default_value);
}
return true;
}
public override void Emit ()
{
if (OptAttributes != null) {
OptAttributes.Emit (ec, this);
}
foreach (EnumMember em in defined_names.Values) {
em.Emit (ec);
}
base.Emit ();
}
void VerifyClsName ()
{
Hashtable ht = new Hashtable ();
foreach (string name in ordered_enums) {
string locase = name.ToLower (System.Globalization.CultureInfo.InvariantCulture);
if (!ht.Contains (locase)) {
ht.Add (locase, defined_names [name]);
continue;
}
MemberCore conflict = (MemberCore)ht [locase];
Report.SymbolRelatedToPreviousError (conflict);
conflict = GetDefinition (name);
Report.Error (3005, conflict.Location, "Identifier '{0}' differing only in case is not CLS-compliant", conflict.GetSignatureForError ());
}
}
protected override bool VerifyClsCompliance (DeclSpace ds)
{
if (!base.VerifyClsCompliance (ds))
return false;
VerifyClsName ();
if (!AttributeTester.IsClsCompliant (UnderlyingType)) {
Report.Error (3009, Location, "'{0}': base type '{1}' is not CLS-compliant", GetSignatureForError (), TypeManager.CSharpName (UnderlyingType));
}
return true;
}
/// <summary>
/// Returns full enum name.
/// </summary>
string GetEnumeratorName (string valueName)
{
return String.Concat (Name, ".", valueName);
}
//
// IMemberFinder
//
public override MemberList FindMembers (MemberTypes mt, BindingFlags bf,
MemberFilter filter, object criteria)
{
ArrayList members = new ArrayList ();
if ((mt & MemberTypes.Field) != 0) {
if (criteria is string){
if (member_to_value [criteria] == null && current_ec != null){
LookupEnumValue (current_ec, (string) criteria, Location.Null);
}
}
foreach (FieldBuilder fb in field_builders)
if (filter (fb, criteria) == true)
members.Add (fb);
}
return new MemberList (members);
}
public override MemberCache MemberCache {
get {
return null;
}
}
public ArrayList ValueNames {
get {
return ordered_enums;
}
}
// indexer
public Expression this [string name] {
get {
return ((EnumMember) defined_names [name]).Type;
}
}
public override AttributeTargets AttributeTargets {
get {
return AttributeTargets.Enum;
}
}
protected override void VerifyObsoleteAttribute()
{
// UnderlyingType is never obsolete
}
//
// Generates xml doc comments (if any), and if required,
// handle warning report.
//
internal override void GenerateDocComment (DeclSpace ds)
{
DocUtil.GenerateEnumDocComment (this, ds);
}
//
// Represents header string for documentation comment.
//
public override string DocCommentHeader {
get { return "T:"; }
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+100
View File
@@ -0,0 +1,100 @@
// gen-il.cs: Generates MSIL code from the CIR.Tree
//
// Author: Miguel de Icaza ([email protected])
//
// Licensed under the terms of the GNU GPL
//
// (C) 2001 Ximian, Inc. (http://www.ximian.com)
//
using System;
using System.IO;
using System.Collections;
using CIR;
namespace MSIL {
public class Generator : CIR.ITreeDump {
StreamWriter o;
int indent = 0;
void output (string s)
{
Console.Write (s);
o.Write (s);
}
void space ()
{
output (new String (' ', indent * 2));
}
void ioutput (string s)
{
space ();
output (s);
}
void ioutputl (string s)
{
ioutput (s + "\n");
}
string ClassAttributes (Class c)
{
// FIXME
return "";
}
string ILName (string name)
{
return name;
}
string ClassExtends (Class c)
{
return "";
}
void GenerateFromClass (Class c)
{
ioutputl (".class " + ClassAttributes (c) + " " + ILName (c.Name));
ioutputl (ClassExtends (c));
ioutputl ("{");
indent++;
indent--;
ioutputl ("}");
}
void GenerateFromTypes (TypeContainer types)
{
if (types.Types == null)
return;
foreach (DictionaryEntry de in types.Types){
TypeContainer type = (TypeContainer) de.Value;
if (type is Class)
GenerateFromClass ((Class) type);
}
}
public int GenerateFromTree (Tree tree, StreamWriter os)
{
this.o = os;
ioutputl (".assembly test.exe { }");
GenerateFromTypes (tree.Types);
return 0;
}
public void ParseOptions (string options)
{
}
}
}
+988
View File
@@ -0,0 +1,988 @@
// cs-treedump.cs: Dumps the parsed tree to standard output
//
// Author: Miguel de Icaza ([email protected])
//
// Licensed under the terms of the GNU GPL
//
// (C) 2001 Ximian, Inc. (http://www.ximian.com)
//
// TODO:
// Variable declarations
// Fix precedence rules to lower the number of parenthesis.
//
using System;
using System.IO;
using System.Collections;
using CIR;
namespace Generator {
public class TreeDump : CIR.ITreeDump {
StreamWriter o;
int indent;
bool indented;
bool tag_values;
void space ()
{
if (!indented)
output (new String (' ', indent * 8));
indented = true;
}
void output (string s)
{
Console.Write (s);
//o.Write (s);
}
void newline ()
{
output ("\n");
indented = false;
}
void output_newline (string s)
{
output (s);
newline ();
}
void ioutput (string s)
{
space ();
output (s);
}
string GetParameter (Parameter par)
{
Parameter.Modifier f = par.ModFlags;
string mod = "";
switch (f){
case Parameter.Modifier.REF:
mod = "ref "; break;
case Parameter.Modifier.OUT:
mod = "out "; break;
case Parameter.Modifier.PARAMS:
mod = "params "; break;
case Parameter.Modifier.NONE:
mod = ""; break;
}
return mod + par.Type + " " + par.Name;
}
string GetUnary (Unary u, int paren_level)
{
string e;
bool left = true;
string s = "0_ERROR>";
int prec = 0;
switch (u.Oper){
case Unary.Operator.UnaryPlus:
prec = 10;
s = "+";
break;
case Unary.Operator.UnaryNegation:
prec = 10;
s = "-";
break;
case Unary.Operator.LogicalNot:
s = "!";
prec = 10;
break;
case Unary.Operator.OnesComplement:
prec = 10;
s = "~";
break;
case Unary.Operator.Indirection:
prec = 10;
s = "*";
break;
case Unary.Operator.AddressOf:
prec = 10;
s = "&";
break;
case Unary.Operator.PreIncrement:
prec = 11;
s = "++";
break;
case Unary.Operator.PreDecrement:
prec = 11;
s = "--";
break;
case Unary.Operator.PostDecrement:
left = false;
prec = 12;
s = "--";
break;
case Unary.Operator.PostIncrement:
s = "++";
prec = 12;
left = false;
break;
}
e = GetExpression (u.Expr, prec);
if (left)
e = s + e;
else
e = e + s;
if (prec < paren_level)
return "(" + e + ")";
else
return e;
}
string GetBinary (Binary b, int paren_level)
{
string l, r;
string op = null;
bool assoc_left = true;
int prec = 0;
switch (b.Oper){
case Binary.Operator.Multiply:
prec = 9;
op = "*"; break;
case Binary.Operator.Division:
prec = 9;
op = "/"; break;
case Binary.Operator.Modulus:
prec = 9;
op = "%"; break;
case Binary.Operator.Addition:
prec = 8;
op = "+"; break;
case Binary.Operator.Subtraction:
prec = 8;
op = "-"; break;
case Binary.Operator.LeftShift:
prec = 7;
op = "<<"; break;
case Binary.Operator.RightShift:
prec = 7;
op = ">>"; break;
case Binary.Operator.LessThan:
prec = 6;
op = "<"; break;
case Binary.Operator.GreaterThan:
prec = 6;
op = ">"; break;
case Binary.Operator.LessThanOrEqual:
prec = 6;
op = "<="; break;
case Binary.Operator.GreaterThanOrEqual:
prec = 6;
op = ">="; break;
case Binary.Operator.Equality:
prec = 5;
op = "=="; break;
case Binary.Operator.Inequality:
prec = 5;
op = "!="; break;
case Binary.Operator.BitwiseAnd:
prec = 4;
op = "&"; break;
case Binary.Operator.BitwiseOr:
prec = 2;
op = "|"; break;
case Binary.Operator.LogicalAndAlso:
prec = 1;
op = "AndAlso"; break;
case Binary.Operator.LogicalOrElse:
prec = 0;
op = "OrElse"; break;
case Binary.Operator.ExclusiveOr:
prec = 3;
op = "^"; break;
}
l = GetExpression (b.Left, prec - (assoc_left ? 0 : 1));
r = GetExpression (b.Right, prec - (assoc_left ? 0 : 1));
if (prec <= paren_level)
return "(" + l + " " + op + " " + r + ")";
else
return l + " " + op + " " + r;
}
string GetCast (Cast c)
{
return "(" + c.TargetType + ") (" + GetExpression (c.Expr, 0) + ")";
}
string GetConditional (Conditional c)
{
return "(" + GetExpression (c.Expr, 0) + ") ? (" +
GetExpression (c.TrueExpr, 0) + ") : (" +
GetExpression (c.FalseExpr, 0) + ")";
}
string GetAssign (Assign a)
{
return GetExpression (a.Target, 0) + " = " + GetExpression (a.Source, 0);
}
string GetArguments (ArrayList args)
{
string r = "";
if (args != null){
int top = args.Count;
for (int i = 0; i < top; i++){
Argument arg = (Argument) args [i];
switch (arg.ArgType){
case Argument.AType.Ref:
r += "ref "; break;
case Argument.AType.Out:
r += "out "; break;
}
r += GetExpression (arg.Expr, 0);
if (i+1 != top)
r += ", ";
}
}
return "(" + r + ")";
}
string GetInvocation (Invocation i)
{
return GetExpression (i.Expr, 0) + " " + GetArguments (i.Arguments);
}
string GetNew (New n)
{
return "new " + n.RequestedType + GetArguments (n.Arguments);
}
string GetTypeOf (TypeOf t)
{
return "typeof (" + t.QueriedType + ")";
}
string GetSizeOf (SizeOf t)
{
return "sizeof (" + t.QueriedType + ")";
}
string GetMemberAccess (MemberAccess m)
{
return GetExpression (m.Expr, 0) +
(tag_values ? "/* member access */ . " : ".") +
m.Identifier;
}
string GetSimpleName (SimpleName n)
{
string s = n.Name;
if (s.StartsWith ("0_"))
return "id_" + s;
else
return s;
}
string GetProbe (Probe p)
{
string s = GetExpression (p.Expr, 6);
if (p.Oper == CIR.Probe.Operator.Is)
s += " is ";
else if (p.Oper == CIR.Probe.Operator.As)
s += " as ";
else
s += "UNHANDLED";
s += p.ProbeType;
return s;
}
string GetLocalVariableReference (LocalVariableReference l)
{
if (tag_values)
return "/* local var: */" + l.Name;
else
return l.Name;
}
string GetParameterReference (ParameterReference r)
{
if (tag_values)
return "/* par: */ " + r.Name;
else
return r.Name;
}
string GetExpression (Expression e, int paren_level)
{
if (e == null){
return "<NULL EXPRESSION>";
}
if (e is Unary)
return GetUnary ((Unary) e, paren_level);
else if (e is Binary)
return GetBinary ((Binary) e, paren_level);
else if (e is Cast)
return GetCast ((Cast) e);
else if (e is Conditional)
return GetConditional ((Conditional) e);
else if (e is SimpleName)
return GetSimpleName ((SimpleName)e);
else if (e is LocalVariableReference)
return GetLocalVariableReference ((LocalVariableReference) e);
else if (e is ParameterReference)
return GetParameterReference ((ParameterReference) e);
else if (e is Assign)
return GetAssign ((Assign) e);
else if (e is Literal)
return e.ToString ();
else if (e is Invocation)
return GetInvocation ((Invocation) e);
else if (e is New)
return GetNew ((New) e);
else if (e is This)
return "this";
else if (e is TypeOf)
return GetTypeOf ((TypeOf) e);
else if (e is SizeOf)
return GetSizeOf ((SizeOf) e);
else if (e is MemberAccess)
return GetMemberAccess ((MemberAccess) e);
else if (e is Probe)
return GetProbe ((Probe) e);
else
return "WARNING {" + e.ToString () + "} WARNING";
}
void GenerateParameters (Parameters pars)
{
Parameter [] pfixed;
Parameter parray;
pfixed = pars.FixedParameters;
if (pfixed != null){
for (int i = 0; i < pfixed.Length; i++){
output (GetParameter (pfixed [i]));
if (i+1 != pfixed.Length)
output (", ");
}
}
parray = pars.ArrayParameter;
if (parray != null){
output (GetParameter (parray));
}
}
void GenerateIf (If s)
{
bool do_indent;
output ("if (" + GetExpression (s.Expr, 0) + ") ");
do_indent = !(s.TrueStatement is Block);
if (do_indent)
indent++;
GenerateStatement (s.TrueStatement, true, false, false);
if (do_indent)
indent--;
if (s.FalseStatement != null){
ioutput ("else");
newline ();
GenerateStatement (s.FalseStatement, false, true, false);
}
}
void GenerateDo (Do s)
{
output ("do"); newline ();
indent++;
GenerateStatement (s.EmbeddedStatement, false, false, false);
indent--;
output (" while (" + GetExpression (s.Expr, 0) + ");");
newline ();
}
void GenerateWhile (While s)
{
output ("while (" + GetExpression (s.Expr, 0) + ")");
GenerateStatement (s.Statement, true, true, false);
}
void GenerateFor (For s)
{
output ("for (");
if (! (s.InitStatement == EmptyStatement.Value))
GenerateStatement (s.InitStatement, true, true, true);
output ("; ");
output (GetExpression (s.Test, 0));
output ("; ");
if (! (s.Increment == EmptyStatement.Value))
GenerateStatement (s.Increment, true, true, true);
output (") ");
GenerateStatement (s.Statement, true, true, false);
}
void GenerateReturn (Return s)
{
output ("return " +
(s.Expr != null ?
GetExpression (s.Expr, 0) : "" + ";") +
";");
newline ();
}
void GenerateGoto (Goto s)
{
output ("goto " + s.Target + ";");
newline ();
}
void GenerateThrow (Throw s)
{
}
void GenerateStatementExpression (StatementExpression s)
{
output (GetExpression (s.Expr, 0) + ";");
newline ();
}
void GenerateSwitchLabels (ArrayList labels)
{
foreach (SwitchLabel sl in labels){
Expression lab = sl.Label;
if (lab == null){
ioutput ("default:");
newline ();
} else {
ioutput ("case " + GetExpression (lab, 0) + ":");
newline ();
}
}
}
void GenerateSwitch (Switch s)
{
output_newline ("switch (" + GetExpression (s.Expr, 0) + ")");
foreach (SwitchSection ss in s.Sections){
GenerateSwitchLabels (ss.Labels);
GenerateBlock (ss.Block, false, false);
}
}
void GenerateChecked (Checked c)
{
output ("checked ");
GenerateBlock (c.Block, false, false);
}
void GenerateUnchecked (Unchecked c)
{
output ("unchecked ");
GenerateBlock (c.Block, false, false);
}
void GenerateCatchClauses (ArrayList list)
{
foreach (Catch c in list){
space ();
output ("catch ");
if (c.Type != null){
output ("(" + c.Type +
(c.Name != null ? " " + c.Name : "") + ")");
}
GenerateBlock (c.Block, false, false);
}
}
void GenerateTry (Try t)
{
output ("try");
GenerateBlock (t.Block, false, false);
if (t.Specific != null){
GenerateCatchClauses (t.Specific);
}
if (t.General != null){
space ();
output ("catch");
GenerateBlock (t.Block, false, false);
}
if (t.Fini != null){
GenerateBlock (t.Fini, false, false);
}
}
void GenerateStatement (Statement s, bool doPlacement, bool blockFlushesLine, bool embedded)
{
if (s == null){
output ("WARNING: got a null Statement");
newline ();
return;
}
if (doPlacement){
if (s is Block){
GenerateBlock ((Block) s, doPlacement, embedded);
return;
} else
newline ();
}
space ();
if (s is If)
GenerateIf ((If) s);
else if (s is Do)
GenerateDo ((Do) s);
else if (s is While)
GenerateWhile ((While) s);
else if (s is For)
GenerateFor ((For) s);
else if (s is Return)
GenerateReturn ((Return) s);
else if (s is Goto)
GenerateGoto ((Goto) s);
else if (s is Throw)
GenerateThrow ((Throw) s);
else if (s is Break)
output_newline ("break;");
else if (s is Continue)
output_newline ("continue;");
else if (s == EmptyStatement.Value)
output_newline ("/* empty statement */;");
else if (s is Block)
GenerateBlock ((Block) s, doPlacement, embedded);
else if (s is StatementExpression)
GenerateStatementExpression ((StatementExpression) s);
else if (s is Switch)
GenerateSwitch ((Switch) s);
else if (s is Checked)
GenerateChecked ((Checked) s);
else if (s is Unchecked)
GenerateUnchecked ((Unchecked) s);
else if (s is Try)
GenerateTry ((Try) s);
else {
System.Type t = s.GetType ();
output ("\n*****UNKNOWN Statement:" + t.ToString ());
}
}
//
// embedded is used only for things like the For thing
// that has blocks but for display purposes we want to keep
// without newlines.
void GenerateBlock (Block b, bool doPlacement, bool embedded)
{
if (b.Label != null)
output (b.Label + ":");
if (!b.Implicit){
if (!doPlacement)
space ();
output ("{");
if (!embedded)
newline ();
indent++;
}
if (b.Variables != null){
foreach (DictionaryEntry entry in b.Variables){
VariableInfo vi = (VariableInfo) entry.Value;
space ();
output_newline (
vi.Type + " " +
(string) entry.Key + ";");
}
newline ();
}
foreach (Statement s in b.Statements){
GenerateStatement (s, false, true, false);
}
if (!b.Implicit){
indent--;
ioutput ("}");
if (!embedded)
newline ();
}
}
void GenerateMethod (Method m)
{
ioutput (GetModifiers (m.ModFlags) +
m.ReturnType + " " +
m.Name + " (");
GenerateParameters (m.Parameters);
output_newline (")");
GenerateBlock (m.Block, false, false);
newline ();
}
void GenerateInterfaceMethod (InterfaceMethod imethod)
{
space ();
output (imethod.IsNew ? "new " : "");
output (imethod.ReturnType + " " + imethod.Name + " (");
GenerateParameters (imethod.Parameters);
output (");");
newline ();
}
void GenerateInterfaceProperty (InterfaceProperty iprop)
{
space ();
output (iprop.IsNew ? "new " : "");
output (iprop.Type + " " + iprop.Name + " { ");
if (iprop.HasGet) output ("get; ");
if (iprop.HasSet) output ("set; ");
output ("}");
newline ();
}
void GenerateInterfaceEvent (InterfaceEvent ievent)
{
space ();
output ((ievent.IsNew ? "new " : "") + "event ");
output (ievent.Type + " " + ievent.Name + ";");
newline ();
}
void GenerateInterfaceIndexer (InterfaceIndexer iindexer)
{
space ();
output (iindexer.IsNew ? "new " : "");
output (iindexer.Type + " this [");
output (iindexer.Parameters + "] {");
if (iindexer.HasGet) output ("get; ");
if (iindexer.HasSet) output ("set; ");
output ("}");
newline ();
}
string GenIfaceBases (Interface iface)
{
return GenBases (iface.Bases);
}
void GenerateInterface (Interface iface)
{
ioutput (GetModifiers (iface.ModFlags) + "interface " +
ClassName (iface.Name) + GenIfaceBases (iface) + " {");
newline ();
indent++;
if (iface.InterfaceMethods != null){
foreach (DictionaryEntry de in iface.InterfaceMethods){
InterfaceMethod method = (InterfaceMethod) de.Value;
GenerateInterfaceMethod (method);
}
}
if (iface.InterfaceProperties != null){
foreach (DictionaryEntry de in iface.InterfaceProperties){
InterfaceProperty iprop = (InterfaceProperty) de.Value;
GenerateInterfaceProperty (iprop);
}
}
if (iface.InterfaceEvents != null){
foreach (DictionaryEntry de in iface.InterfaceEvents){
InterfaceEvent ievent = (InterfaceEvent) de.Value;
GenerateInterfaceEvent (ievent);
}
}
if (iface.InterfaceIndexers != null){
foreach (DictionaryEntry de in iface.InterfaceIndexers){
InterfaceIndexer iindexer = (InterfaceIndexer) de.Value;
GenerateInterfaceIndexer (iindexer);
}
}
indent--;
ioutput ("}");
newline ();
newline ();
}
void GenerateField (Field f)
{
space ();
output (GetModifiers (f.ModFlags) +
f.Type + " " + f.Name);
if (f.Initializer != null){
if (f.Initializer is Expression)
output (" = " + GetExpression ((Expression) f.Initializer, 0));
else
output ("ADD SUPPORT FOR ARRAYS");
}
output (";");
newline ();
}
void GenerateConstructor (Constructor c)
{
ConstructorInitializer init = c.Initializer;
space ();
output (GetModifiers (c.ModFlags) + c.Name + " (");
GenerateParameters (c.Parameters);
output (")");
if (init != null){
if (init is ConstructorThisInitializer)
output (": this (");
else
output (": base (");
output (GetArguments (init.Arguments));
output (")");
}
newline ();
GenerateBlock (c.Block, false, false);
}
void GenerateProperty (Property prop)
{
space ();
output (GetModifiers (prop.ModFlags) + prop.Type +
" " + prop.Name + " {");
newline ();
indent++;
if (prop.Get != null){
space ();
output ("get ");
GenerateBlock (prop.Get, false, false);
newline ();
}
if (prop.Set != null){
space ();
output ("set ");
GenerateBlock (prop.Set, false, false);
}
indent--;
space ();
output ("}");
newline ();
}
void GenerateEnum (CIR.Enum e)
{
space ();
output ("enum " + e.Name + " {");
newline ();
indent++;
foreach (string name in e.ValueNames){
Expression expr = e [name];
space ();
output (name);
if (expr != null)
output (" = " + GetExpression (expr, 0));
output (",");
newline ();
}
indent--;
space ();
output_newline ("}");
}
void GenerateTypeContainerData (TypeContainer tc)
{
if (tc.Constants != null){
foreach (Constant c in tc.Constants){
space ();
output ("const " + c.ConstantType + " " + c.Name + " = " +
GetExpression (c.Expr, 0) + ";");
newline ();
}
newline ();
}
if (tc.Enums != null){
foreach (CIR.Enum e in tc.Enums)
GenerateEnum (e);
}
if (tc.Fields != null){
foreach (Field f in tc.Fields)
GenerateField (f);
newline ();
}
if (tc.Constructors != null){
foreach (Constructor c in tc.Constructors)
GenerateConstructor (c);
newline ();
}
if (tc.Properties != null){
foreach (Property prop in tc.Properties)
GenerateProperty (prop);
}
GenerateFromTypes (tc);
if (tc.Methods != null){
foreach (Method m in tc.Methods){
GenerateMethod (m);
}
}
}
string GetModifiers (int mod_flags)
{
string s = "";
for (int i = 1; i <= (int) CIR.Modifiers.TOP; i <<= 1){
if ((mod_flags & i) != 0)
s += Modifiers.Name (i) + " ";
}
return s;
}
string ClassName (string name)
{
return name;
//return name.Substring (1 + name.LastIndexOf ('.'));
}
string GenBases (ArrayList bases)
{
if (bases == null)
return "";
string res = ": ";
int top = bases.Count;
for (int i = 0; i < bases.Count; i++){
Type t = (Type) bases [i];
res += t.Name;
if (i + 1 != top)
res += ", ";
}
return res;
}
string GenClassBases (Class c)
{
return GenBases (c.Bases);
}
void GenerateFromClass (Class c)
{
ioutput (GetModifiers (c.ModFlags) + "class " + ClassName (c.Name) +
" " + GenClassBases (c) + " {");
newline ();
indent++;
GenerateTypeContainerData (c);
indent--;
ioutput ("}");
newline ();
newline ();
}
void GenerateFromStruct (Struct s)
{
GenerateTypeContainerData (s);
}
void GenerateFromTypes (TypeContainer types)
{
if (types.Types == null)
return;
foreach (DictionaryEntry de in types.Types){
TypeContainer type = (TypeContainer) de.Value;
if (type is Class)
GenerateFromClass ((Class) type);
if (type is Struct)
GenerateFromStruct ((Struct) type);
}
if (types.Interfaces != null){
foreach (DictionaryEntry de in types.Interfaces){
Interface iface = (Interface) de.Value;
GenerateInterface (iface);
}
}
}
public int Dump (Tree tree, StreamWriter output)
{
this.o = output;
indent = 0;
GenerateFromTypes (tree.Types);
return 0;
}
public void ParseOptions (string options)
{
if (options == "tag")
tag_values = true;
}
}
}
+3090
View File
File diff suppressed because it is too large. Load diff
+38
View File
@@ -0,0 +1,38 @@
AssemblyInfo.cs
anonymous.cs
assign.cs
attribute.cs
driver.cs
cs-tokenizer.cs
cfold.cs
class.cs
codegen.cs
const.cs
constant.cs
convert.cs
decl.cs
delegate.cs
doc.cs
enum.cs
ecore.cs
expression.cs
flowanalysis.cs
generic.cs
iterators.cs
literal.cs
location.cs
modifiers.cs
namespace.cs
parameter.cs
pending.cs
report.cs
rootcontext.cs
statement.cs
support.cs
typemanager.cs
symbolwriter.cs
tree.cs
CryptoConvert.cs
../class/Mono.CompilerServices.SymbolWriter/MonoSymbolFile.cs
../class/Mono.CompilerServices.SymbolWriter/MonoSymbolTable.cs
../class/Mono.CompilerServices.SymbolWriter/MonoSymbolWriter.cs
File diff suppressed because it is too large. Load diff
+320
View File
@@ -0,0 +1,320 @@
//
// literal.cs: Literal representation for the IL tree.
//
// Author:
// Miguel de Icaza ([email protected])
//
// (C) 2001 Ximian, Inc.
//
//
// Notice that during parsing we create objects of type Literal, but the
// types are not loaded (thats why the Resolve method has to assign the
// type at that point).
//
// Literals differ from the constants in that we know we encountered them
// as a literal in the source code (and some extra rules apply there) and
// they have to be resolved (since during parsing we have not loaded the
// types yet) while constants are created only after types have been loaded
// and are fully resolved when born.
//
using System;
using System.Reflection;
using System.Reflection.Emit;
//
// I put System.Null just so we do not have to special case it on
// TypeManager.CSharpName
//
namespace System {
//
// Represents the Null Type, just used as a placeholder for the type in NullLiteral
//
public class Null {
}
}
namespace Mono.CSharp {
//
// Unlike C#, VB.NET doesn't understand "signed byte",
// "unsigned short", "unsigned int" and "unsigned long" as
// primitive types. The NotDefinedAsPrimitiveType just exists
// to accomodate this fact.
//
public class NotDefinedAsPrimitiveType {
}
//
// The NullType just exists to compare type equality, and for
// expressions that might have the `null type'
//
public class NullType {
}
//
// The null Literal constant
//
public class NullLiteral : Constant {
public static readonly NullLiteral Null;
static NullLiteral ()
{
Null = new NullLiteral ();
}
public NullLiteral ()
{
eclass = ExprClass.Value;
}
override public string AsString ()
{
return "null";
}
public override object GetValue ()
{
return null;
}
public override Expression DoResolve (EmitContext ec)
{
type = TypeManager.null_type;
return this;
}
public override void Emit (EmitContext ec)
{
ec.ig.Emit (OpCodes.Ldnull);
}
public override CharConstant ConvertToChar ()
{
return new CharConstant ((char) 0);
}
public override BoolConstant ConvertToBoolean ()
{
return new BoolConstant (false);
}
public override ByteConstant ConvertToByte ()
{
return new ByteConstant ((byte) 0);
}
public override ShortConstant ConvertToShort ()
{
return new ShortConstant ((short) 0);
}
public override DecimalConstant ConvertToDecimal ()
{
return new DecimalConstant ((decimal) 0);
}
public override DoubleConstant ConvertToDouble ()
{
return new DoubleConstant ((double) 0);
}
public override FloatConstant ConvertToFloat ()
{
return new FloatConstant ((float) 0);
}
public override LongConstant ConvertToLong ()
{
return new LongConstant ((long) 0);
}
public override IntConstant ConvertToInt ()
{
return new IntConstant (0);
}
public override bool IsNegative {
get {
return false;
}
}
public override bool IsZeroInteger {
get { return true; }
}
}
//
// A null literal in a pointer context
//
public class NullPointer : NullLiteral {
public new static readonly NullLiteral Null;
static NullPointer ()
{
Null = new NullPointer ();
}
private NullPointer ()
{
type = TypeManager.object_type;
}
public override void Emit (EmitContext ec)
{
ILGenerator ig = ec.ig;
ig.Emit (OpCodes.Ldc_I4_0);
ig.Emit (OpCodes.Conv_U);
}
}
public class BoolLiteral : BoolConstant {
public BoolLiteral (bool val) : base (val)
{
}
public override Expression DoResolve (EmitContext ec)
{
type = TypeManager.bool_type;
return this;
}
}
public class CharLiteral : CharConstant {
public CharLiteral (char c) : base (c)
{
}
public override Expression DoResolve (EmitContext ec)
{
type = TypeManager.char_type;
return this;
}
}
public class IntLiteral : IntConstant {
public static IntLiteral One, Zero;
static IntLiteral ()
{
Zero = new IntLiteral (0);
One = new IntLiteral (1);
}
public IntLiteral (int l) : base (l)
{
}
public override Expression DoResolve (EmitContext ec)
{
type = TypeManager.int32_type;
return this;
}
}
public class UIntLiteral : UIntConstant {
public UIntLiteral (uint l) : base (l)
{
}
public override Expression DoResolve (EmitContext ec)
{
type = TypeManager.uint32_type;
return this;
}
}
public class LongLiteral : LongConstant {
public LongLiteral (long l) : base (l)
{
}
public override Expression DoResolve (EmitContext ec)
{
type = TypeManager.int64_type;
return this;
}
}
public class ULongLiteral : ULongConstant {
public ULongLiteral (ulong l) : base (l)
{
}
public override Expression DoResolve (EmitContext ec)
{
type = TypeManager.uint64_type;
return this;
}
}
public class FloatLiteral : FloatConstant {
public FloatLiteral (float f) : base (f)
{
}
public override Expression DoResolve (EmitContext ec)
{
type = TypeManager.float_type;
return this;
}
}
public class DoubleLiteral : DoubleConstant {
public DoubleLiteral (double d) : base (d)
{
}
public override Expression DoResolve (EmitContext ec)
{
type = TypeManager.double_type;
return this;
}
}
public class DecimalLiteral : DecimalConstant {
public DecimalLiteral (decimal d) : base (d)
{
}
public override Expression DoResolve (EmitContext ec)
{
type = TypeManager.decimal_type;
return this;
}
}
public class StringLiteral : StringConstant {
public StringLiteral (string s) : base (s)
{
}
public override Expression DoResolve (EmitContext ec)
{
type = TypeManager.string_type;
return this;
}
}
//
// VB.NET specific
//
public class DateLiteral : DateConstant {
public DateLiteral (DateTime s) : base (s)
{
}
public override Expression DoResolve (EmitContext ec)
{
type = TypeManager.date_type;
return this;
}
}
}
+239
View File
@@ -0,0 +1,239 @@
//
// location.cs: Keeps track of the location of source code entity
//
// Author:
// Miguel de Icaza
//
// (C) 2001 Ximian, Inc.
//
using System;
using System.IO;
using System.Collections;
using Mono.CompilerServices.SymbolWriter;
namespace Mono.CSharp {
/// <summary>
/// This is one single source file.
/// </summary>
/// <remarks>
/// This is intentionally a class and not a struct since we need
/// to pass this by reference.
/// </remarks>
public sealed class SourceFile : ISourceFile {
public readonly string Name;
public readonly string Path;
public readonly int Index;
public SourceFileEntry SourceFileEntry;
public bool HasLineDirective;
public SourceFile (string name, string path, int index)
{
this.Index = index;
this.Name = name;
this.Path = path;
}
SourceFileEntry ISourceFile.Entry {
get { return SourceFileEntry; }
}
public override string ToString ()
{
return String.Format ("SourceFile ({0}:{1}:{2}:{3})",
Name, Path, Index, SourceFileEntry);
}
}
/// <summary>
/// Keeps track of the location in the program
/// </summary>
///
/// <remarks>
/// This uses a compact representation and a couple of auxiliary
/// structures to keep track of tokens to (file,line) mappings.
///
/// We could probably also keep track of columns by storing those
/// in 8 bits (and say, map anything after char 255 to be `255+').
/// </remarks>
public struct Location {
public int token;
static ArrayList source_list;
static Hashtable source_files;
static int source_bits;
static int source_mask;
static int source_count;
static int current_source;
public readonly static Location Null;
static Location ()
{
source_files = new Hashtable ();
source_list = new ArrayList ();
current_source = 0;
Null.token = 0;
}
// <summary>
// This must be called before parsing/tokenizing any files.
// </summary>
static public void AddFile (string name)
{
string path = Path.GetFullPath (name);
if (source_files.Contains (path)){
int id = (int) source_files [path];
string other_name = ((SourceFile) source_list [id - 1]).Name;
if (name.Equals (other_name))
Report.Warning (2002, "Source file '{0}' specified multiple times", name);
else
Report.Warning (2002, "Source filenames '{0}' and '{1}' both refer to the same file: {2}", name, other_name, path);
return;
}
source_files.Add (path, ++source_count);
source_list.Add (new SourceFile (name, path, source_count));
}
static public SourceFile[] SourceFiles {
get {
SourceFile[] retval = new SourceFile [source_list.Count];
source_list.CopyTo (retval, 0);
return retval;
}
}
static int log2 (int number)
{
int bits = 0;
while (number > 0) {
bits++;
number /= 2;
}
return bits;
}
// <summary>
// After adding all source files we want to compile with AddFile(), this method
// must be called to `reserve' an appropriate number of bits in the token for the
// source file. We reserve some extra space for files we encounter via #line
// directives while parsing.
// </summary>
static public void Initialize ()
{
source_bits = log2 (source_list.Count) + 2;
source_mask = (1 << source_bits) - 1;
}
// <remarks>
// This is used when we encounter a #line preprocessing directive.
// </remarks>
static public SourceFile LookupFile (string name)
{
string path = name == "" ? "" : Path.GetFullPath (name);
if (!source_files.Contains (path)) {
if (source_count >= (1 << source_bits))
return new SourceFile (name, path, 0);
source_files.Add (path, ++source_count);
SourceFile retval = new SourceFile (name, path, source_count);
source_list.Add (retval);
return retval;
}
int index = (int) source_files [path];
return (SourceFile) source_list [index - 1];
}
/*
static public void Push (SourceFile file)
{
current_source = file.Index;
}
*/
// <remarks>
// If we're compiling with debugging support, this is called between parsing
// and code generation to register all the source files with the
// symbol writer.
// </remarks>
static public void DefineSymbolDocuments (SymbolWriter symwriter)
{
foreach (SourceFile file in source_list) {
file.SourceFileEntry = symwriter.DefineDocument (file.Path);
}
}
public Location (int row)
{
if (row < 0)
token = 0;
else
token = current_source + (row << source_bits);
}
public override string ToString ()
{
return Name + ": (" + Row + ")";
}
/// <summary>
/// Whether the Location is Null
/// </summary>
static public bool IsNull (Location l)
{
return l.token == 0;
}
public string Name {
get {
int index = token & source_mask;
if ((token == 0) || (index == 0))
return "Internal";
SourceFile file = (SourceFile) source_list [index - 1];
return file.Name;
}
}
public int Row {
get {
if (token == 0)
return 1;
return token >> source_bits;
}
}
public int File {
get {
return token & source_mask;
}
}
// The ISymbolDocumentWriter interface is used by the symbol writer to
// describe a single source file - for each source file there's exactly
// one corresponding ISymbolDocumentWriter instance.
//
// This class has an internal hash table mapping source document names
// to such ISymbolDocumentWriter instances - so there's exactly one
// instance per document.
//
// This property returns the ISymbolDocumentWriter instance which belongs
// to the location's source file.
//
// If we don't have a symbol writer, this property is always null.
public SourceFile SourceFile {
get {
int index = token & source_mask;
if (index == 0)
return null;
return (SourceFile) source_list [index - 1];
}
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+252
View File
@@ -0,0 +1,252 @@
//
// modifiers.cs: Modifier handling.
//
using System;
using System.Reflection;
namespace Mono.CSharp {
public class Modifiers {
//
// The ordering of the following 4 constants
// has been carefully done.
//
public const int PROTECTED = 0x0001;
public const int PUBLIC = 0x0002;
public const int PRIVATE = 0x0004;
public const int INTERNAL = 0x0008;
public const int NEW = 0x0010;
public const int ABSTRACT = 0x0020;
public const int SEALED = 0x0040;
public const int STATIC = 0x0080;
public const int READONLY = 0x0100;
public const int VIRTUAL = 0x0200;
public const int OVERRIDE = 0x0400;
public const int EXTERN = 0x0800;
public const int VOLATILE = 0x1000;
public const int UNSAFE = 0x2000;
public const int WRITEONLY = 0x04000;
public const int SHADOWS = 0x08000;
public const int DEFAULT = 0x10000;
public const int NONVIRTUAL= 0x20000;
private const int TOP = 0x20000;
//
// We use this internally to flag that the method contains an iterator
//
public const int METHOD_YIELDS = 0x8000;
public const int METHOD_GENERIC = 0x10000;
public const int Accessibility =
PUBLIC | PROTECTED | INTERNAL | PRIVATE;
public const int AllowedExplicitImplFlags =
UNSAFE | EXTERN;
static public string Name (int i)
{
string s = "";
switch (i) {
case Modifiers.NEW:
s = "new"; break;
case Modifiers.PUBLIC:
s = "public"; break;
case Modifiers.PROTECTED:
s = "protected"; break;
case Modifiers.INTERNAL:
s = "internal"; break;
case Modifiers.PRIVATE:
s = "private"; break;
case Modifiers.ABSTRACT:
s = "abstract"; break;
case Modifiers.SEALED:
s = "sealed"; break;
case Modifiers.STATIC:
s = "static"; break;
case Modifiers.READONLY:
s = "readonly"; break;
case Modifiers.VIRTUAL:
s = "virtual"; break;
case Modifiers.OVERRIDE:
s = "override"; break;
case Modifiers.EXTERN:
s = "extern"; break;
case Modifiers.VOLATILE:
s = "volatile"; break;
case Modifiers.UNSAFE:
s = "unsafe"; break;
}
return s;
}
public static TypeAttributes TypeAttr (int mod_flags, bool is_toplevel)
{
TypeAttributes t = 0;
if (is_toplevel){
if ((mod_flags & PUBLIC) != 0)
t |= TypeAttributes.Public;
if ((mod_flags & PRIVATE) != 0)
t |= TypeAttributes.NotPublic;
} else {
if ((mod_flags & PUBLIC) != 0)
t |= TypeAttributes.NestedPublic;
if ((mod_flags & PRIVATE) != 0)
t |= TypeAttributes.NestedPrivate;
if ((mod_flags & PROTECTED) != 0 && (mod_flags & INTERNAL) != 0)
t |= TypeAttributes.NestedFamORAssem;
if ((mod_flags & PROTECTED) != 0)
t |= TypeAttributes.NestedFamily;
if ((mod_flags & INTERNAL) != 0)
t |= TypeAttributes.NestedAssembly;
}
if ((mod_flags & SEALED) != 0)
t |= TypeAttributes.Sealed;
if ((mod_flags & ABSTRACT) != 0)
t |= TypeAttributes.Abstract;
return t;
}
public static TypeAttributes TypeAttr (int mod_flags, TypeContainer caller)
{
TypeAttributes t = TypeAttr (mod_flags, caller.IsTopLevel);
// If we do not have static constructors, static methods
// can be invoked without initializing the type.
if (!caller.UserDefinedStaticConstructor &&
(caller.Kind != Kind.Interface))
t |= TypeAttributes.BeforeFieldInit;
return t;
}
public static FieldAttributes FieldAttr (int mod_flags)
{
FieldAttributes fa = 0;
if ((mod_flags & PUBLIC) != 0)
fa |= FieldAttributes.Public;
if ((mod_flags & PRIVATE) != 0)
fa |= FieldAttributes.Private;
if ((mod_flags & PROTECTED) != 0){
if ((mod_flags & INTERNAL) != 0)
fa |= FieldAttributes.FamORAssem;
else
fa |= FieldAttributes.Family;
} else {
if ((mod_flags & INTERNAL) != 0)
fa |= FieldAttributes.Assembly;
}
if ((mod_flags & STATIC) != 0)
fa |= FieldAttributes.Static;
if ((mod_flags & READONLY) != 0)
fa |= FieldAttributes.InitOnly;
return fa;
}
public static MethodAttributes MethodAttr (int mod_flags)
{
MethodAttributes ma = MethodAttributes.HideBySig;
if ((mod_flags & PUBLIC) != 0)
ma |= MethodAttributes.Public;
if ((mod_flags & PRIVATE) != 0)
ma |= MethodAttributes.Private;
if ((mod_flags & PROTECTED) != 0){
if ((mod_flags & INTERNAL) != 0)
ma |= MethodAttributes.FamORAssem;
else
ma |= MethodAttributes.Family;
} else {
if ((mod_flags & INTERNAL) != 0)
ma |= MethodAttributes.Assembly;
}
if ((mod_flags & STATIC) != 0)
ma |= MethodAttributes.Static;
if ((mod_flags & ABSTRACT) != 0){
ma |= MethodAttributes.Abstract | MethodAttributes.Virtual;
}
if ((mod_flags & SEALED) != 0)
ma |= MethodAttributes.Final;
if ((mod_flags & VIRTUAL) != 0)
ma |= MethodAttributes.Virtual;
if ((mod_flags & OVERRIDE) != 0)
ma |= MethodAttributes.Virtual;
else {
if ((ma & MethodAttributes.Virtual) != 0)
ma |= MethodAttributes.NewSlot;
}
return ma;
}
// <summary>
// Checks the object @mod modifiers to be in @allowed.
// Returns the new mask. Side effect: reports any
// incorrect attributes.
// </summary>
public static int Check (int allowed, int mod, int def_access, Location l)
{
int invalid_flags = (~allowed) & mod;
int i;
if (invalid_flags == 0){
int a = mod;
if ((mod & Modifiers.UNSAFE) != 0){
if (!RootContext.Unsafe){
Report.Error (227, l,
"Unsafe code requires the -unsafe command " +
"line option to be specified");
}
}
//
// If no accessibility bits provided
// then provide the defaults.
//
if ((mod & Accessibility) == 0){
mod |= def_access;
return mod;
}
//
// Make sure that no conflicting accessibility
// bits have been set. Protected+Internal is
// allowed, that is why they are placed on bits
// 1 and 4 (so the shift 3 basically merges them)
//
a &= 15;
a |= (a >> 3);
a = ((a & 2) >> 1) + (a & 5);
a = ((a & 4) >> 2) + (a & 3);
if (a > 1)
Report.Error (107, l, "More than one protection modifier specified");
return mod;
}
for (i = 1; i <= TOP; i <<= 1){
if ((i & invalid_flags) == 0)
continue;
Error_InvalidModifier (l, Name (i));
}
return allowed & mod;
}
public static void Error_InvalidModifier (Location l, string name)
{
Report.Error (106, l, "the modifier " + name + " is not valid for this item");
}
}
}
+57
View File
@@ -0,0 +1,57 @@
//
// module.cs: Module handler
//
// Author: Rafael Teixeira ([email protected])
//
// Licensed under the terms of the GNU GPL
//
// (C) 2002 Rafael Teixeira
//
using System;
using System.Collections;
using System.Diagnostics.SymbolStore;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using Mono.CSharp ;
namespace Mono.CSharp
{
public class VBModule : Class
{
public new const int AllowedModifiers = Modifiers.PUBLIC |Modifiers.INTERNAL;
public VBModule (NamespaceEntry ns, TypeContainer parent, MemberName name, int mod,
Attributes attrs, Location l)
: base (ns, parent, name, 0, attrs, l)
{
if (parent.Parent != null)
Report.Error (30617, l,
"'Module' statements can occur only at file or namespace level");
// overwrite ModFlags
this.ModFlags = Modifiers.Check (AllowedModifiers, mod, Modifiers.INTERNAL, l);
// add specialized attribute
Mono.CSharp.Attribute standardModuleAttribute = new Mono.CSharp.Attribute(null, Expression.StringToExpression ("Microsoft.VisualBasic.CompilerServices", l), "StandardModuleAttribute", null, l);
ArrayList al = new ArrayList();
al.Add(standardModuleAttribute);
if (attributes == null) {
attributes = new Attributes(al);
} else {
attributes.AddAttributes(al);
}
}
public override TypeAttributes TypeAttr
{
get {
return base.TypeAttr | TypeAttributes.AutoLayout | TypeAttributes.Class | TypeAttributes.Sealed;
}
}
}
}
+635
View File
@@ -0,0 +1,635 @@
//
// namespace.cs: Tracks namespaces
//
// Author:
// Miguel de Icaza ([email protected])
//
// (C) 2001 Ximian, Inc.
//
using System;
using System.Collections;
namespace Mono.CSharp {
/// <summary>
/// Keeps track of the namespaces defined in the C# code.
///
/// This is an Expression to allow it to be referenced in the
/// compiler parse/intermediate tree during name resolution.
/// </summary>
public class Namespace : FullNamedExpression, IAlias {
static ArrayList all_namespaces = new ArrayList ();
static Hashtable namespaces_map = new Hashtable ();
Namespace parent;
string fullname;
ArrayList entries;
Hashtable namespaces;
Hashtable defined_names;
/// <summary>
/// Constructor Takes the current namespace and the
/// name. This is bootstrapped with parent == null
/// and name = ""
/// </summary>
public Namespace (Namespace parent, string name)
{
// Expression members.
this.eclass = ExprClass.Namespace;
this.Type = null;
this.loc = Location.Null;
this.parent = parent;
string pname = parent != null ? parent.Name : "";
if (pname == "")
fullname = name;
else
fullname = parent.Name + "." + name;
entries = new ArrayList ();
namespaces = new Hashtable ();
defined_names = new Hashtable ();
all_namespaces.Add (this);
if (namespaces_map.Contains (fullname))
return;
namespaces_map [fullname] = true;
}
public override Expression DoResolve (EmitContext ec)
{
return this;
}
public override void Emit (EmitContext ec)
{
throw new InternalErrorException ("Expression tree referenced namespace " + fullname + " during Emit ()");
}
public static bool IsNamespace (string name)
{
return namespaces_map [name] != null;
}
public static Namespace Root = new Namespace (null, "");
public Namespace GetNamespace (string name, bool create)
{
int pos = name.IndexOf ('.');
Namespace ns;
string first;
if (pos >= 0)
first = name.Substring (0, pos);
else
first = name;
ns = (Namespace) namespaces [first];
if (ns == null) {
if (!create)
return null;
ns = new Namespace (this, first);
namespaces.Add (first, ns);
}
if (pos >= 0)
ns = ns.GetNamespace (name.Substring (pos + 1), create);
return ns;
}
public static Namespace LookupNamespace (string name, bool create)
{
return Root.GetNamespace (name, create);
}
public FullNamedExpression Lookup (DeclSpace ds, string name, Location loc)
{
IAlias o = (IAlias) defined_names [name];
Type t;
DeclSpace tdecl = o as DeclSpace;
if (tdecl != null) {
t = tdecl.DefineType ();
if (t == null)
return null;
if ((ds == null) || ds.CheckAccessLevel (t))
return new TypeExpression (t, Location.Null);
}
Namespace ns = GetNamespace (name, false);
if (ns != null)
return ns;
t = TypeManager.LookupType (DeclSpace.MakeFQN (fullname, name));
if ((t == null) || ((ds != null) && !ds.CheckAccessLevel (t)))
return null;
return new TypeExpression (t, Location.Null);
}
public void AddNamespaceEntry (NamespaceEntry entry)
{
entries.Add (entry);
}
public void DefineName (string name, IAlias o)
{
defined_names.Add (name, o);
}
static public ArrayList UserDefinedNamespaces {
get {
return all_namespaces;
}
}
/// <summary>
/// The qualified name of the current namespace
/// </summary>
public string Name {
get {
return fullname;
}
}
public override string FullName {
get {
return fullname;
}
}
/// <summary>
/// The parent of this namespace, used by the parser to "Pop"
/// the current namespace declaration
/// </summary>
public Namespace Parent {
get {
return parent;
}
}
public static void DefineNamespaces (SymbolWriter symwriter)
{
foreach (Namespace ns in all_namespaces) {
foreach (NamespaceEntry entry in ns.entries)
entry.DefineNamespace (symwriter);
}
}
/// <summary>
/// Used to validate that all the using clauses are correct
/// after we are finished parsing all the files.
/// </summary>
public static void VerifyUsing ()
{
foreach (Namespace ns in all_namespaces) {
foreach (NamespaceEntry entry in ns.entries)
entry.VerifyUsing ();
}
}
public override string ToString ()
{
if (this == Root)
return "Namespace (<root>)";
else
return String.Format ("Namespace ({0})", Name);
}
bool IAlias.IsType {
get { return false; }
}
TypeExpr IAlias.ResolveAsType (EmitContext ec)
{
throw new InvalidOperationException ();
}
}
public class NamespaceEntry
{
Namespace ns;
NamespaceEntry parent, implicit_parent;
SourceFile file;
int symfile_id;
Hashtable aliases;
ArrayList using_clauses;
public bool DeclarationFound = false;
//
// This class holds the location where a using definition is
// done, and whether it has been used by the program or not.
//
// We use this to flag using clauses for namespaces that do not
// exist.
//
public class UsingEntry {
public Expression Name;
public readonly NamespaceEntry NamespaceEntry;
public readonly Location Location;
public UsingEntry (NamespaceEntry entry, Expression name, Location loc)
{
Name = name;
NamespaceEntry = entry;
Location = loc;
}
internal FullNamedExpression resolved;
public Namespace Resolve ()
{
if (resolved != null)
return resolved as Namespace;
DeclSpace root = RootContext.Tree.Types;
root.NamespaceEntry = NamespaceEntry;
resolved = Name.ResolveAsTypeStep (root.EmitContext);
root.NamespaceEntry = null;
return resolved as Namespace;
}
}
public class AliasEntry {
public readonly string Name;
public readonly Expression Alias;
public readonly NamespaceEntry NamespaceEntry;
public readonly Location Location;
public AliasEntry (NamespaceEntry entry, string name, Expression alias, Location loc)
{
Name = name;
Alias = alias;
NamespaceEntry = entry;
Location = loc;
}
FullNamedExpression resolved;
public FullNamedExpression Resolve ()
{
if (resolved != null)
return resolved;
DeclSpace root = RootContext.Tree.Types;
root.NamespaceEntry = NamespaceEntry;
resolved = Alias.ResolveAsTypeStep (root.EmitContext);
root.NamespaceEntry = null;
return resolved;
}
}
public NamespaceEntry (NamespaceEntry parent, SourceFile file, string name, Location loc)
{
this.parent = parent;
this.file = file;
this.IsImplicit = false;
this.ID = ++next_id;
if (parent != null)
ns = parent.NS.GetNamespace (name, true);
else if (name != null)
ns = Namespace.LookupNamespace (name, true);
else
ns = Namespace.Root;
ns.AddNamespaceEntry (this);
this.FullName = ns.Name;
}
private NamespaceEntry (NamespaceEntry parent, SourceFile file, Namespace ns)
{
this.parent = parent;
this.file = file;
this.IsImplicit = true;
this.ID = ++next_id;
this.ns = ns;
this.FullName = ns.Name;
}
//
// According to section 16.3.1 (using-alias-directive), the namespace-or-type-name is
// resolved as if the immediately containing namespace body has no using-directives.
//
// Section 16.3.2 says that the same rule is applied when resolving the namespace-name
// in the using-namespace-directive.
//
// To implement these rules, the expressions in the using directives are resolved using
// the "doppelganger" (ghostly bodiless duplicate).
//
NamespaceEntry doppelganger;
NamespaceEntry Doppelganger {
get {
if (!IsImplicit && doppelganger == null)
doppelganger = new NamespaceEntry (ImplicitParent, file, ns);
return doppelganger;
}
}
static int next_id = 0;
public readonly string FullName;
public readonly int ID;
public readonly bool IsImplicit;
public Namespace NS {
get {
return ns;
}
}
public NamespaceEntry Parent {
get {
return parent;
}
}
public NamespaceEntry ImplicitParent {
get {
if (parent == null)
return null;
if (implicit_parent == null) {
implicit_parent = (parent.NS == ns.Parent)
? parent
: new NamespaceEntry (parent, file, ns.Parent);
}
return implicit_parent;
}
}
public void DefineName (string name, IAlias o)
{
ns.DefineName (name, o);
}
/// <summary>
/// Records a new namespace for resolving name references
/// </summary>
public void Using (Expression ns, Location loc)
{
string name = ns.ToString ();
if (DeclarationFound){
Report.Error (1529, loc, "A using clause must precede all other namespace elements");
return;
}
if (name == FullName)
return;
if (using_clauses == null)
using_clauses = new ArrayList ();
foreach (UsingEntry old_entry in using_clauses) {
if (old_entry.Name.ToString () == name) {
if (RootContext.WarningLevel >= 3)
Report.Warning (105, loc, "The using directive for '{0}' appeared previously in this namespace", name);
return;
}
}
UsingEntry ue = new UsingEntry (Doppelganger, ns, loc);
using_clauses.Add (ue);
}
public void UsingAlias (string name, Expression alias, Location loc)
{
if (DeclarationFound){
Report.Error (1529, loc, "A using clause must precede all other namespace elements");
return;
}
if (aliases == null)
aliases = new Hashtable ();
if (aliases.Contains (name)){
Report.Error (1537, loc, "The using alias `" + name +
"' appeared previously in this namespace");
return;
}
aliases [name] = new AliasEntry (Doppelganger, name, alias, loc);
}
public FullNamedExpression LookupAlias (string alias)
{
AliasEntry entry = null;
if (aliases != null)
entry = (AliasEntry) aliases [alias];
return entry == null ? null : entry.Resolve ();
}
public FullNamedExpression LookupNamespaceOrType (DeclSpace ds, string name, Location loc)
{
FullNamedExpression resolved = null;
string rest = null;
// If name is of the form `N.I', first lookup `N', then search a member `I' in it.
int pos = name.IndexOf ('.');
if (pos >= 0) {
rest = name.Substring (pos + 1);
name = name.Substring (0, pos);
}
for (NamespaceEntry curr_ns = this; curr_ns != null; curr_ns = curr_ns.ImplicitParent) {
if ((resolved = curr_ns.Lookup (ds, name, loc)) != null)
break;
}
if (resolved == null || rest == null)
return resolved;
Namespace ns = resolved as Namespace;
if (ns != null)
return ns.Lookup (ds, rest, loc);
Type nested = TypeManager.LookupType (resolved.FullName + "." + rest);
if ((nested == null) || ((ds != null) && !ds.CheckAccessLevel (nested)))
return null;
return new TypeExpression (nested, Location.Null);
}
private FullNamedExpression Lookup (DeclSpace ds, string name, Location loc)
{
// Precondition: Only simple names (no dots) will be looked up with this function.
//
// Check whether it's in the namespace.
//
FullNamedExpression o = NS.Lookup (ds, name, loc);
if (o != null)
return o;
if (IsImplicit)
return null;
//
// Check aliases.
//
o = LookupAlias (name);
if (o != null)
return o;
//
// Check using entries.
//
FullNamedExpression t = null, match = null;
foreach (Namespace using_ns in GetUsingTable ()) {
match = using_ns.Lookup (ds, name, loc);
if ((match != null) && (match is TypeExpr)) {
if (t != null) {
DeclSpace.Error_AmbiguousTypeReference (loc, name, t.FullName, match.FullName);
return null;
} else {
t = match;
}
}
}
return t;
}
// Our cached computation.
Namespace [] namespace_using_table;
public Namespace[] GetUsingTable ()
{
if (namespace_using_table != null)
return namespace_using_table;
if (using_clauses == null) {
namespace_using_table = new Namespace [0];
return namespace_using_table;
}
ArrayList list = new ArrayList (using_clauses.Count);
foreach (UsingEntry ue in using_clauses) {
Namespace using_ns = ue.Resolve ();
if (using_ns == null)
continue;
list.Add (using_ns);
}
namespace_using_table = new Namespace [list.Count];
list.CopyTo (namespace_using_table, 0);
return namespace_using_table;
}
public void DefineNamespace (SymbolWriter symwriter)
{
if (symfile_id != 0)
return;
if (parent != null)
parent.DefineNamespace (symwriter);
string[] using_list;
if (using_clauses != null) {
using_list = new string [using_clauses.Count];
for (int i = 0; i < using_clauses.Count; i++)
using_list [i] = ((UsingEntry) using_clauses [i]).Name.ToString ();
} else {
using_list = new string [0];
}
int parent_id = parent != null ? parent.symfile_id : 0;
if (file.SourceFileEntry == null)
return;
symfile_id = symwriter.DefineNamespace (
ns.Name, file.SourceFileEntry, using_list, parent_id);
}
public int SymbolFileID {
get {
return symfile_id;
}
}
static void MsgtryRef (string s)
{
Console.WriteLine (" Try using -r:" + s);
}
static void MsgtryPkg (string s)
{
Console.WriteLine (" Try using -pkg:" + s);
}
protected void error246 (Location loc, string name)
{
Report.Error (246, loc, "The namespace `" + name +
"' can not be found (missing assembly reference?)");
switch (name) {
case "Gtk": case "GtkSharp":
MsgtryPkg ("gtk-sharp");
break;
case "Gdk": case "GdkSharp":
MsgtryPkg ("gdk-sharp");
break;
case "Glade": case "GladeSharp":
MsgtryPkg ("glade-sharp");
break;
case "System.Drawing":
case "System.Web.Services":
case "System.Web":
case "System.Data":
case "System.Windows.Forms":
MsgtryRef (name);
break;
}
}
/// <summary>
/// Used to validate that all the using clauses are correct
/// after we are finished parsing all the files.
/// </summary>
public void VerifyUsing ()
{
if (using_clauses != null){
foreach (UsingEntry ue in using_clauses){
if (ue.Resolve () != null)
continue;
if (ue.resolved == null)
error246 (ue.Location, ue.Name.ToString ());
else
Report.Error (138, ue.Location, "The using keyword only lets you specify a namespace, " +
"`" + ue.Name + "' is a class not a namespace.");
}
}
if (aliases != null){
foreach (DictionaryEntry de in aliases){
AliasEntry alias = (AliasEntry) de.Value;
if (alias.Resolve () != null)
continue;
error246 (alias.Location, alias.Alias.ToString ());
}
}
}
public override string ToString ()
{
if (NS == Namespace.Root)
return "NamespaceEntry (<root>)";
else
return String.Format ("NamespaceEntry ({0},{1},{2})", FullName, IsImplicit, ID);
}
}
}
+720
View File
@@ -0,0 +1,720 @@
//
// parameter.cs: Parameter definition.
//
// Author: Miguel de Icaza ([email protected])
//
// Licensed under the terms of the GNU GPL
//
// (C) 2001 Ximian, Inc (http://www.ximian.com)
//
//
//
using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Collections;
namespace Mono.CSharp {
/// <summary>
/// Abstract Base class for parameters of a method.
/// </summary>
public abstract class ParameterBase : Attributable {
protected ParameterBuilder builder;
public ParameterBase (Attributes attrs)
: base (attrs)
{
}
public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
{
if (a.Type == TypeManager.marshal_as_attr_type) {
UnmanagedMarshal marshal = a.GetMarshal (this);
if (marshal != null) {
builder.SetMarshal (marshal);
}
return;
}
if (a.Type.IsSubclassOf (TypeManager.security_attr_type)) {
a.Error_InvalidSecurityParent ();
return;
}
builder.SetCustomAttribute (cb);
}
public override bool IsClsCompliaceRequired(DeclSpace ds)
{
return false;
}
}
/// <summary>
/// Class for applying custom attributes on the return type
/// </summary>
public class ReturnParameter: ParameterBase {
public ReturnParameter (MethodBuilder mb, Location location):
base (null)
{
try {
builder = mb.DefineParameter (0, ParameterAttributes.None, "");
}
catch (ArgumentOutOfRangeException) {
Report.Warning (-28, location, "The Microsoft .NET Runtime 1.x does not permit setting custom attributes on the return type");
}
}
public override void ApplyAttributeBuilder(Attribute a, CustomAttributeBuilder cb)
{
if (a.Type == TypeManager.cls_compliant_attribute_type) {
Report.Warning (3023, 1, a.Location, "CLSCompliant attribute has no meaning when applied to return types. Try putting it on the method instead");
}
// This occurs after Warning -28
if (builder == null)
return;
base.ApplyAttributeBuilder (a, cb);
}
public override AttributeTargets AttributeTargets {
get {
return AttributeTargets.ReturnValue;
}
}
/// <summary>
/// Is never called
/// </summary>
public override string[] ValidAttributeTargets {
get {
return null;
}
}
}
/// <summary>
/// Class for applying custom attributes on the implicit parameter type
/// of the 'set' method in properties, and the 'add' and 'remove' methods in events.
/// </summary>
public class ImplicitParameter: ParameterBase {
public ImplicitParameter (MethodBuilder mb):
base (null)
{
builder = mb.DefineParameter (1, ParameterAttributes.None, "");
}
public override AttributeTargets AttributeTargets {
get {
return AttributeTargets.Parameter;
}
}
/// <summary>
/// Is never called
/// </summary>
public override string[] ValidAttributeTargets {
get {
return null;
}
}
}
/// <summary>
/// Represents a single method parameter
/// </summary>
//TODO: Add location member to this or base class for better error location and all methods simplification.
public class Parameter : ParameterBase {
[Flags]
public enum Modifier : byte {
NONE = 0,
VAL = 0,
REF = 1,
OUT = 2,
PARAMS = 4,
// This is a flag which says that it's either REF or OUT.
ISBYREF = 8,
ARGLIST = 16,
// This value is changed from the one in mbas source code
OPTIONAL = 32
}
static string[] attribute_targets = new string [] { "param" };
public Expression TypeName;
public readonly Modifier ModFlags;
public readonly string Name;
GenericConstraints constraints;
Type parameter_type;
EmitContext ec; // because ApplyAtrribute doesn't have ec
/* These two fields are mbas specific. The corresponding
changes need to be merged from mbas */
public readonly Expression ParameterInitializer;
public readonly bool IsOptional;
public Parameter (Expression type, string name, Modifier mod, Attributes attrs)
: base (attrs)
{
Name = name;
ModFlags = mod;
TypeName = type;
ParameterInitializer = null;
IsOptional = false;
}
public Parameter (Expression type, string name, Modifier mod, Attributes attrs, Expression pi)
: base (attrs)
{
Name = name;
ModFlags = mod;
TypeName = type;
ParameterInitializer = pi;
IsOptional = false;
}
public Parameter (Expression type, string name, Modifier mod, Attributes attrs, Expression pi, bool opt)
: base (attrs)
{
Name = name;
ModFlags = mod;
TypeName = type;
ParameterInitializer = pi;
IsOptional = opt;
}
public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
{
if (a.Type == TypeManager.in_attribute_type && Attributes == ParameterAttributes.Out) {
Report.Error (36, a.Location, "Can not use [In] attribute on out parameter");
return;
}
if (a.Type == TypeManager.param_array_type) {
Report.Error (674, a.Location, "Do not use 'System.ParamArrayAttribute'. Use the 'params' keyword instead");
return;
}
if (a.Type == TypeManager.out_attribute_type && (ModFlags & Modifier.REF) != 0 &&
!OptAttributes.Contains (TypeManager.in_attribute_type, ec)) {
Report.Error (662, a.Location,
"'{0}' cannot specify only Out attribute on a ref parameter. Use both In and Out attributes, or neither", GetSignatureForError ());
return;
}
if (a.Type == TypeManager.cls_compliant_attribute_type) {
Report.Warning (3022, 1, a.Location, "CLSCompliant attribute has no meaning when applied to parameters. Try putting it on the method instead");
}
base.ApplyAttributeBuilder (a, cb);
}
// <summary>
// Resolve is used in method definitions
// </summary>
public bool Resolve (EmitContext ec, Location l)
{
TypeExpr texpr = TypeName.ResolveAsTypeTerminal (ec);
this.ec = ec;
if (texpr == null)
return false;
TypeParameterExpr tparam = texpr as TypeParameterExpr;
if (tparam != null)
constraints = tparam.TypeParameter.Constraints;
parameter_type = texpr.Type;
if (parameter_type.IsAbstract && parameter_type.IsSealed) {
Report.Error (721, l, "'{0}': static types cannot be used as parameters", GetSignatureForError ());
return false;
}
if (parameter_type == TypeManager.void_type){
Report.Error (1536, l, "Invalid parameter type 'void'");
return false;
}
if ((ModFlags & Parameter.Modifier.ISBYREF) != 0){
if (parameter_type == TypeManager.typed_reference_type ||
parameter_type == TypeManager.arg_iterator_type){
Report.Error (1601, l,
"out or ref parameter can not be of type TypedReference or ArgIterator");
return false;
}
}
return parameter_type != null;
}
public Type ExternalType ()
{
if ((ModFlags & Parameter.Modifier.ISBYREF) != 0)
return TypeManager.GetReferenceType (parameter_type);
return parameter_type;
}
public Type ParameterType {
get {
return parameter_type;
}
}
public GenericConstraints GenericConstraints {
get {
return constraints;
}
}
public ParameterAttributes Attributes {
get {
int flags = ((int) ModFlags) & ~((int) Parameter.Modifier.ISBYREF);
switch ((Modifier) flags) {
case Modifier.NONE:
return ParameterAttributes.None;
case Modifier.REF:
return ParameterAttributes.None;
case Modifier.OUT:
return ParameterAttributes.Out;
case Modifier.PARAMS:
return 0;
}
return ParameterAttributes.None;
}
}
public static ParameterAttributes GetParameterAttributes (Modifier mod)
{
int flags = ((int) mod) & ~((int) Parameter.Modifier.ISBYREF);
switch ((Modifier) flags) {
case Modifier.NONE:
return ParameterAttributes.None;
case Modifier.REF:
return ParameterAttributes.None;
case Modifier.OUT:
return ParameterAttributes.Out;
case Modifier.PARAMS:
return 0;
}
return ParameterAttributes.None;
}
public override AttributeTargets AttributeTargets {
get {
return AttributeTargets.Parameter;
}
}
/// <summary>
/// Returns the signature for this parameter evaluating it on the
/// @tc context
/// </summary>
public string GetSignature (EmitContext ec, Location loc)
{
if (parameter_type == null){
if (!Resolve (ec, loc))
return null;
}
return ExternalType ().FullName;
}
public string GetSignatureForError ()
{
string typeName;
if (parameter_type != null)
typeName = TypeManager.CSharpName (parameter_type);
else if (TypeName.Type != null)
typeName = TypeManager.CSharpName (TypeName.Type);
else
typeName = TypeName.ToString ();
switch (ModFlags & unchecked (~Modifier.ISBYREF)) {
case Modifier.OUT:
return "out " + typeName;
case Modifier.PARAMS:
return "params " + typeName;
case Modifier.REF:
return "ref " + typeName;
}
return typeName;
}
public void DefineParameter (EmitContext ec, MethodBuilder mb, ConstructorBuilder cb, int index, Location loc)
{
ParameterAttributes par_attr = Attributes;
if (mb == null)
builder = cb.DefineParameter (index, par_attr, Name);
else
builder = mb.DefineParameter (index, par_attr, Name);
if (OptAttributes != null) {
OptAttributes.Emit (ec, this);
}
}
public override string[] ValidAttributeTargets {
get {
return attribute_targets;
}
}
}
/// <summary>
/// Represents the methods parameters
/// </summary>
public class Parameters {
public Parameter [] FixedParameters;
public readonly Parameter ArrayParameter;
public readonly bool HasArglist;
string signature;
Type [] types;
Location loc;
static Parameters empty_parameters;
public Parameters (Parameter [] fixed_parameters, Parameter array_parameter, Location l)
{
FixedParameters = fixed_parameters;
ArrayParameter = array_parameter;
loc = l;
}
public Parameters (Parameter [] fixed_parameters, bool has_arglist, Location l)
{
FixedParameters = fixed_parameters;
HasArglist = has_arglist;
loc = l;
}
/// <summary>
/// This is used to reuse a set of empty parameters, because they
/// are common
/// </summary>
public static Parameters EmptyReadOnlyParameters {
get {
if (empty_parameters == null)
empty_parameters = new Parameters (null, null, Location.Null);
return empty_parameters;
}
}
public bool Empty {
get {
return (FixedParameters == null) && (ArrayParameter == null);
}
}
public void ComputeSignature (EmitContext ec)
{
signature = "";
if (FixedParameters != null){
for (int i = 0; i < FixedParameters.Length; i++){
Parameter par = FixedParameters [i];
signature += par.GetSignature (ec, loc);
}
}
//
// Note: as per the spec, the `params' arguments (ArrayParameter)
// are not used in the signature computation for a method
//
}
void Error_DuplicateParameterName (string name)
{
Report.Error (
100, loc, "The parameter name `" + name + "' is a duplicate");
}
public bool VerifyArgs ()
{
int count;
int i, j;
if (FixedParameters == null)
return true;
count = FixedParameters.Length;
string array_par_name = ArrayParameter != null ? ArrayParameter.Name : null;
for (i = 0; i < count; i++){
string base_name = FixedParameters [i].Name;
for (j = i + 1; j < count; j++){
if (base_name != FixedParameters [j].Name)
continue;
Error_DuplicateParameterName (base_name);
return false;
}
if (base_name == array_par_name){
Error_DuplicateParameterName (base_name);
return false;
}
}
return true;
}
/// <summary>
/// Returns the signature of the Parameters evaluated in
/// the @ec EmitContext
/// </summary>
public string GetSignature (EmitContext ec)
{
if (signature == null){
VerifyArgs ();
ComputeSignature (ec);
}
return signature;
}
/// <summary>
/// Returns the paramenter information based on the name
/// </summary>
public Parameter GetParameterByName (string name, out int idx)
{
idx = 0;
int i = 0;
if (FixedParameters != null){
foreach (Parameter par in FixedParameters){
if (par.Name == name){
idx = i;
return par;
}
i++;
}
}
if (ArrayParameter != null){
if (name == ArrayParameter.Name){
idx = i;
return ArrayParameter;
}
}
return null;
}
public Parameter GetParameterByName (string name)
{
int idx;
return GetParameterByName (name, out idx);
}
bool ComputeParameterTypes (EmitContext ec)
{
int extra = (ArrayParameter != null) ? 1 : 0;
int i = 0;
int pc;
if (FixedParameters == null)
pc = extra;
else
pc = extra + FixedParameters.Length;
types = new Type [pc];
if (!VerifyArgs ()){
FixedParameters = null;
return false;
}
bool failed = false;
if (FixedParameters != null){
foreach (Parameter p in FixedParameters){
Type t = null;
if (p.Resolve (ec, loc))
t = p.ExternalType ();
else
failed = true;
types [i] = t;
i++;
}
}
if (extra > 0){
if (ArrayParameter.Resolve (ec, loc))
types [i] = ArrayParameter.ExternalType ();
else
failed = true;
}
if (failed){
types = null;
return false;
}
return true;
}
//
// This variant is used by Delegates, because they need to
// resolve/define names, instead of the plain LookupType
//
public bool ComputeAndDefineParameterTypes (EmitContext ec)
{
bool old_type_resolving = ec.ResolvingTypeTree;
ec.ResolvingTypeTree = true;
bool retval = ComputeParameterTypes (ec);
ec.ResolvingTypeTree = old_type_resolving;
return retval;
}
/// <summary>
/// Returns the argument types as an array
/// </summary>
static Type [] no_types = new Type [0];
public Type [] GetParameterInfo (EmitContext ec)
{
if (types != null)
return types;
if (FixedParameters == null && ArrayParameter == null)
return no_types;
if (ComputeParameterTypes (ec) == false){
types = null;
return null;
}
return types;
}
/// <summary>
/// Returns the type of a given parameter, and stores in the `is_out'
/// boolean whether this is an out or ref parameter.
///
/// Note that the returned type will not contain any dereference in this
/// case (ie, you get "int" for a ref int instead of "int&"
/// </summary>
public Type GetParameterInfo (EmitContext ec, int idx, out Parameter.Modifier mod)
{
mod = Parameter.Modifier.NONE;
if (!VerifyArgs ()){
FixedParameters = null;
return null;
}
if (FixedParameters == null && ArrayParameter == null)
return null;
if (types == null)
if (ComputeParameterTypes (ec) == false)
return null;
//
// If this is a request for the variable lenght arg.
//
int array_idx = (FixedParameters != null ? FixedParameters.Length : 0);
if (idx == array_idx)
return types [idx];
//
// Otherwise, it is a fixed parameter
//
Parameter p = FixedParameters [idx];
mod = p.ModFlags;
if ((mod & (Parameter.Modifier.REF | Parameter.Modifier.OUT)) != 0)
mod |= Parameter.Modifier.ISBYREF;
return p.ParameterType;
}
public CallingConventions GetCallingConvention ()
{
if (HasArglist)
return CallingConventions.VarArgs;
else
return CallingConventions.Standard;
}
//
// The method's attributes are passed in because we need to extract
// the "return:" attribute from there to apply on the return type
//
public void LabelParameters (EmitContext ec,
MethodBase builder,
Location loc) {
//
// Define each type attribute (in/out/ref) and
// the argument names.
//
int i = 0;
MethodBuilder mb = builder as MethodBuilder;
ConstructorBuilder cb = builder as ConstructorBuilder;
if (FixedParameters != null) {
for (i = 0; i < FixedParameters.Length; i++) {
FixedParameters [i].DefineParameter (ec, mb, cb, i + 1, loc);
}
}
if (ArrayParameter != null){
ParameterBuilder pb;
Parameter array_param = ArrayParameter;
if (mb == null)
pb = cb.DefineParameter (
i + 1, array_param.Attributes,
array_param.Name);
else
pb = mb.DefineParameter (
i + 1, array_param.Attributes,
array_param.Name);
CustomAttributeBuilder a = new CustomAttributeBuilder (
TypeManager.cons_param_array_attribute, new object [0]);
pb.SetCustomAttribute (a);
}
}
public Parameters Copy (Location l)
{
Parameters p = new Parameters (null, null, l);
p.FixedParameters = new Parameter[this.FixedParameters.Length];
this.FixedParameters.CopyTo (p.FixedParameters, 0);
return (p);
}
public void AppendParameter (Parameter p)
{
if (FixedParameters != null)
{
Parameter [] pa = new Parameter [FixedParameters.Length+1];
FixedParameters.CopyTo (pa, 0);
pa[FixedParameters.Length] = p;
FixedParameters = pa;
}
else
{
FixedParameters = new Parameter [1];
FixedParameters[0] = p;
}
}
}
}
+23
View File
@@ -0,0 +1,23 @@
namespace Compiler {
using System;
abstract public class Parser {
public string name;
public System.IO.Stream input;
public Parser (Mono.CSharp.Tree tree, string name, System.IO.Stream stream)
{
this.tree = tree;
this.name = name;
this.input = stream;
}
public string getName (){
return name;
}
abstract public int parse ();
}
}
+572
View File
@@ -0,0 +1,572 @@
//
// pending.cs: Pending method implementation
//
// Author:
// Miguel de Icaza ([email protected])
//
// Licensed under the terms of the GNU GPL
//
// (C) 2001, 2002 Ximian, Inc (http://www.ximian.com)
//
//
using System;
using System.Collections;
using System.Reflection;
using System.Reflection.Emit;
namespace Mono.CSharp {
struct TypeAndMethods {
public Type type;
public MethodInfo [] methods;
//
// Whether it is optional, this is used to allow the explicit/implicit
// implementation when a base class already implements an interface.
//
// For example:
//
// class X : IA { } class Y : X, IA { IA.Explicit (); }
//
public bool optional;
// Far from ideal, but we want to avoid creating a copy
// of methods above.
public Type [][] args;
//
// This flag on the method says `We found a match, but
// because it was private, we could not use the match
//
public bool [] found;
// If a method is defined here, then we always need to
// create a proxy for it. This is used when implementing
// an interface's indexer with a different IndexerName.
public MethodInfo [] need_proxy;
//
// The name of the indexer (if it exists), precompute set/get, because
// they would be recomputed many times inside a loop later on.
//
public string set_indexer_name;
public string get_indexer_name;
}
public class PendingImplementation {
/// <summary>
/// The container for this PendingImplementation
/// </summary>
TypeContainer container;
/// <summary>
/// This filter is used by FindMembers, and it is used to
/// extract only virtual/abstract fields
/// </summary>
static MemberFilter virtual_method_filter;
/// <summary>
/// This is the array of TypeAndMethods that describes the pending implementations
/// (both interfaces and abstract methods in base class)
/// </summary>
TypeAndMethods [] pending_implementations;
static bool IsVirtualFilter (MemberInfo m, object filterCriteria)
{
MethodInfo mi = m as MethodInfo;
return (mi == null) ? false : mi.IsVirtual;
}
/// <summary>
/// Inits the virtual_method_filter
/// </summary>
static PendingImplementation ()
{
virtual_method_filter = new MemberFilter (IsVirtualFilter);
}
// <remarks>
// Returns a list of the abstract methods that are exposed by all of our
// bases that we must implement. Notice that this `flattens' the
// method search space, and takes into account overrides.
// </remarks>
static ArrayList GetAbstractMethods (Type t)
{
ArrayList list = null;
bool searching = true;
Type current_type = t;
do {
MemberList mi;
mi = TypeContainer.FindMembers (
current_type, MemberTypes.Method,
BindingFlags.Public | BindingFlags.Instance |
BindingFlags.DeclaredOnly,
virtual_method_filter, null);
if (current_type == TypeManager.object_type)
searching = false;
else {
current_type = current_type.BaseType;
if (!current_type.IsAbstract)
searching = false;
}
if (mi.Count == 0)
continue;
if (mi.Count == 1 && !(mi [0] is MethodBase))
searching = false;
else
list = TypeManager.CopyNewMethods (list, mi);
} while (searching);
if (list == null)
return null;
for (int i = 0; i < list.Count; i++){
while (list.Count > i && !((MethodInfo) list [i]).IsAbstract)
list.RemoveAt (i);
}
if (list.Count == 0)
return null;
return list;
}
PendingImplementation (TypeContainer container, MissingInterfacesInfo [] missing_ifaces, ArrayList abstract_methods, int total)
{
TypeBuilder type_builder = container.TypeBuilder;
this.container = container;
pending_implementations = new TypeAndMethods [total];
int i = 0;
foreach (MissingInterfacesInfo missing in missing_ifaces){
MethodInfo [] mi;
Type t = missing.Type;
if (!t.IsInterface)
continue;
if (t is TypeBuilder){
TypeContainer iface;
iface = TypeManager.LookupInterface (t);
mi = iface.GetMethods ();
} else
mi = t.GetMethods ();
int count = mi.Length;
pending_implementations [i].type = t;
pending_implementations [i].optional = missing.Optional;
pending_implementations [i].methods = mi;
pending_implementations [i].args = new Type [count][];
pending_implementations [i].found = new bool [count];
pending_implementations [i].need_proxy = new MethodInfo [count];
string indexer_name = TypeManager.IndexerPropertyName (t);
pending_implementations [i].set_indexer_name = "set_" + indexer_name;
pending_implementations [i].get_indexer_name = "get_" + indexer_name;
int j = 0;
foreach (MethodInfo m in mi){
Type [] types = TypeManager.GetArgumentTypes (m);
pending_implementations [i].args [j] = types;
j++;
}
i++;
}
if (abstract_methods != null){
int count = abstract_methods.Count;
pending_implementations [i].methods = new MethodInfo [count];
pending_implementations [i].need_proxy = new MethodInfo [count];
abstract_methods.CopyTo (pending_implementations [i].methods, 0);
pending_implementations [i].found = new bool [count];
pending_implementations [i].args = new Type [count][];
pending_implementations [i].type = type_builder;
string indexer_name = TypeManager.IndexerPropertyName (type_builder);
pending_implementations [i].set_indexer_name = "set_" + indexer_name;
pending_implementations [i].get_indexer_name = "get_" + indexer_name;
int j = 0;
foreach (MemberInfo m in abstract_methods){
MethodInfo mi = (MethodInfo) m;
Type [] types = TypeManager.GetArgumentTypes (mi);
pending_implementations [i].args [j] = types;
j++;
}
}
}
struct MissingInterfacesInfo {
public Type Type;
public bool Optional;
public MissingInterfacesInfo (Type t)
{
Type = t;
Optional = false;
}
}
static MissingInterfacesInfo [] EmptyMissingInterfacesInfo = new MissingInterfacesInfo [0];
static MissingInterfacesInfo [] GetMissingInterfaces (TypeBuilder type_builder)
{
//
// Notice that TypeBuilders will only return the interfaces that the Type
// is supposed to implement, not all the interfaces that the type implements.
//
// Even better -- on MS it returns an empty array, no matter what.
//
// Completely broken. So we do it ourselves!
//
Type [] impl = TypeManager.GetExplicitInterfaces (type_builder);
if (impl == null || impl.Length == 0)
return EmptyMissingInterfacesInfo;
MissingInterfacesInfo [] ret = new MissingInterfacesInfo [impl.Length];
for (int i = 0; i < impl.Length; i++)
ret [i] = new MissingInterfacesInfo (impl [i]);
// we really should not get here because Object doesnt implement any
// interfaces. But it could implement something internal, so we have
// to handle that case.
if (type_builder.BaseType == null)
return ret;
Type [] base_impls = TypeManager.GetInterfaces (type_builder.BaseType);
foreach (Type t in base_impls) {
for (int i = 0; i < ret.Length; i ++) {
if (t == ret [i].Type) {
ret [i].Optional = true;
break;
}
}
}
return ret;
}
//
// Factory method: if there are pending implementation methods, we return a PendingImplementation
// object, otherwise we return null.
//
// Register method implementations are either abstract methods
// flagged as such on the base class or interface methods
//
static public PendingImplementation GetPendingImplementations (TypeContainer container)
{
TypeBuilder type_builder = container.TypeBuilder;
MissingInterfacesInfo [] missing_interfaces;
Type b = type_builder.BaseType;
missing_interfaces = GetMissingInterfaces (type_builder);
//
// If we are implementing an abstract class, and we are not
// ourselves abstract, and there are abstract methods (C# allows
// abstract classes that have no abstract methods), then allocate
// one slot.
//
// We also pre-compute the methods.
//
bool implementing_abstract = ((b != null) && b.IsAbstract && !type_builder.IsAbstract);
ArrayList abstract_methods = null;
if (implementing_abstract){
abstract_methods = GetAbstractMethods (b);
if (abstract_methods == null)
implementing_abstract = false;
}
int total = missing_interfaces.Length + (implementing_abstract ? 1 : 0);
if (total == 0)
return null;
return new PendingImplementation (container, missing_interfaces, abstract_methods, total);
}
public enum Operation {
//
// If you change this, review the whole InterfaceMethod routine as there
// are a couple of assumptions on these three states
//
Lookup, ClearOne, ClearAll
}
/// <summary>
/// Whether the specified method is an interface method implementation
/// </summary>
public MethodInfo IsInterfaceMethod (Type t, string name, Type ret_type, Type [] args)
{
return InterfaceMethod (t, name, ret_type, args, Operation.Lookup, null);
}
public MethodInfo IsInterfaceIndexer (Type t, Type ret_type, Type [] args)
{
return InterfaceMethod (t, null, ret_type, args, Operation.Lookup, null);
}
public void ImplementMethod (Type t, string name, Type ret_type, Type [] args, bool clear_one)
{
InterfaceMethod (t, name, ret_type, args,
clear_one ? Operation.ClearOne : Operation.ClearAll, null);
}
public void ImplementIndexer (Type t, MethodInfo mi, Type ret_type, Type [] args, bool clear_one)
{
InterfaceMethod (t, null, ret_type, args,
clear_one ? Operation.ClearOne : Operation.ClearAll, mi);
}
/// <remarks>
/// If a method in Type `t' (or null to look in all interfaces
/// and the base abstract class) with name `Name', return type `ret_type' and
/// arguments `args' implements an interface, this method will
/// return the MethodInfo that this method implements.
///
/// If `name' is null, we operate solely on the method's signature. This is for
/// instance used when implementing indexers.
///
/// The `Operation op' controls whether to lookup, clear the pending bit, or clear
/// all the methods with the given signature.
///
/// The `MethodInfo need_proxy' is used when we're implementing an interface's
/// indexer in a class. If the new indexer's IndexerName does not match the one
/// that was used in the interface, then we always need to create a proxy for it.
///
/// </remarks>
public MethodInfo InterfaceMethod (Type t, string name, Type ret_type, Type [] args,
Operation op, MethodInfo need_proxy)
{
int arg_len = args.Length;
if (pending_implementations == null)
return null;
foreach (TypeAndMethods tm in pending_implementations){
if (!(t == null || tm.type == t))
continue;
int method_count = tm.methods.Length;
MethodInfo m;
for (int i = 0; i < method_count; i++){
m = tm.methods [i];
if (m == null)
continue;
string mname = TypeManager.GetMethodName (m);
//
// `need_proxy' is not null when we're implementing an
// interface indexer and this is Clear(One/All) operation.
//
// If `name' is null, then we do a match solely based on the
// signature and not on the name (this is done in the Lookup
// for an interface indexer).
//
if (name == null){
if (mname != tm.get_indexer_name && mname != tm.set_indexer_name)
continue;
} else if ((need_proxy == null) && (name != mname))
continue;
if (!TypeManager.IsEqual (ret_type, m.ReturnType)){
if (!((ret_type == null && m.ReturnType == TypeManager.void_type) ||
(m.ReturnType == null && ret_type == TypeManager.void_type)))
continue;
}
//
// Check if we have the same parameters
//
if (tm.args [i].Length != arg_len)
continue;
int j, top = args.Length;
bool fail = false;
for (j = 0; j < top; j++){
if (!TypeManager.IsEqual (tm.args [i][j], args[j])){
fail = true;
break;
}
}
if (fail)
continue;
if (op != Operation.Lookup){
// If `t != null', then this is an explicitly interface
// implementation and we can always clear the method.
// `need_proxy' is not null if we're implementing an
// interface indexer. In this case, we need to create
// a proxy if the implementation's IndexerName doesn't
// match the IndexerName in the interface.
bool name_matches = false;
if (name == mname || mname == tm.get_indexer_name || mname == tm.set_indexer_name)
name_matches = true;
if ((t == null) && (need_proxy != null) && !name_matches)
tm.need_proxy [i] = need_proxy;
else
tm.methods [i] = null;
}
tm.found [i] = true;
//
// Lookups and ClearOne return
//
if (op != Operation.ClearAll)
return m;
}
// If a specific type was requested, we can stop now.
if (tm.type == t)
return null;
}
return null;
}
/// <summary>
/// C# allows this kind of scenarios:
/// interface I { void M (); }
/// class X { public void M (); }
/// class Y : X, I { }
///
/// For that case, we create an explicit implementation function
/// I.M in Y.
/// </summary>
void DefineProxy (Type iface, MethodInfo base_method, MethodInfo iface_method,
Type [] args)
{
MethodBuilder proxy;
string proxy_name = iface.Name + "." + iface_method.Name;
proxy = container.TypeBuilder.DefineMethod (
proxy_name,
MethodAttributes.HideBySig |
MethodAttributes.NewSlot |
MethodAttributes.Virtual,
CallingConventions.Standard | CallingConventions.HasThis,
base_method.ReturnType, args);
ParameterData pd = Invocation.GetParameterData (iface_method);
proxy.DefineParameter (0, ParameterAttributes.None, "");
for (int i = 0; i < pd.Count; i++) {
string name = pd.ParameterName (i);
ParameterAttributes attr = Parameter.GetParameterAttributes (pd.ParameterModifier (i));
proxy.DefineParameter (i + 1, attr, name);
}
int top = args.Length;
ILGenerator ig = proxy.GetILGenerator ();
for (int i = 0; i <= top; i++)
ParameterReference.EmitLdArg (ig, i);
ig.Emit (OpCodes.Call, base_method);
ig.Emit (OpCodes.Ret);
container.TypeBuilder.DefineMethodOverride (proxy, iface_method);
}
/// <summary>
/// This function tells whether one of our base classes implements
/// the given method (which turns out, it is valid to have an interface
/// implementation in a base
/// </summary>
bool BaseImplements (Type iface_type, MethodInfo mi)
{
MethodSignature ms;
Type [] args = TypeManager.GetArgumentTypes (mi);
ms = new MethodSignature (mi.Name, mi.ReturnType, args);
MemberList list = TypeContainer.FindMembers (
container.TypeBuilder.BaseType, MemberTypes.Method | MemberTypes.Property,
BindingFlags.Public | BindingFlags.Instance,
MethodSignature.method_signature_filter, ms);
if (list.Count == 0)
return false;
MethodInfo base_method = (MethodInfo) list [0];
if (!base_method.IsAbstract)
DefineProxy (iface_type, base_method, mi, args);
return true;
}
/// <summary>
/// Verifies that any pending abstract methods or interface methods
/// were implemented.
/// </summary>
public bool VerifyPendingMethods ()
{
int top = pending_implementations.Length;
bool errors = false;
int i;
for (i = 0; i < top; i++){
Type type = pending_implementations [i].type;
int j = 0;
foreach (MethodInfo mi in pending_implementations [i].methods){
if (mi == null)
continue;
if (type.IsInterface){
MethodInfo need_proxy =
pending_implementations [i].need_proxy [j];
if (need_proxy != null) {
Type [] args = TypeManager.GetArgumentTypes (mi);
DefineProxy (type, need_proxy, mi, args);
continue;
}
if (BaseImplements (type, mi))
continue;
if (pending_implementations [i].optional)
continue;
if (pending_implementations [i].found [j]) {
string[] methodLabel = TypeManager.CSharpSignature (mi).Split ('.');
Report.Error (536, container.Location,
"'{0}' does not implement interface member '{1}'. '{2}.{3}' " +
"is either static, not public, or has the wrong return type",
container.Name, TypeManager.CSharpSignature (mi),
container.Name, methodLabel[methodLabel.Length - 1]);
}
else {
Report.Error (535, container.Location, "'{0}' does not implement interface member '{1}'",
container.Name, TypeManager.CSharpSignature (mi));
}
} else {
Report.Error (534, container.Location, "'{0}' does not implement inherited abstract member '{1}'",
container.Name, TypeManager.CSharpSignature (mi));
}
errors = true;
j++;
}
}
return errors;
}
} /* end of class */
}
+669
View File
@@ -0,0 +1,669 @@
//
// report.cs: report errors and warnings.
//
// Author: Miguel de Icaza ([email protected])
//
// (C) 2001 Ximian, Inc. (http://www.ximian.com)
//
//
// FIXME: currently our class library does not support custom number format strings
//
using System;
using System.Text;
using System.Collections;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Reflection;
namespace Mono.CSharp {
/// <summary>
/// This class is used to report errors and warnings t te user.
/// </summary>
public class Report {
/// <summary>
/// Errors encountered so far
/// </summary>
static public int Errors;
/// <summary>
/// Warnings encountered so far
/// </summary>
static public int Warnings;
/// <summary>
/// Whether errors should be throw an exception
/// </summary>
static public bool Fatal;
/// <summary>
/// Whether warnings should be considered errors
/// </summary>
static public bool WarningsAreErrors;
/// <summary>
/// Whether to dump a stack trace on errors.
/// </summary>
static public bool Stacktrace;
//
// If the 'expected' error code is reported then the
// compilation succeeds.
//
// Used for the test suite to excercise the error codes
//
static int expected_error = 0;
//
// Keeps track of the warnings that we are ignoring
//
static Hashtable warning_ignore_table;
static Hashtable warning_regions_table;
/// <summary>
/// List of symbols related to reported error/warning. You have to fill it before error/warning is reported.
/// </summary>
static StringCollection extra_information = new StringCollection ();
abstract class AbstractMessage {
static void Check (int code)
{
if (code == expected_error) {
Environment.Exit (0);
}
}
public abstract bool IsWarning { get; }
public abstract string MessageType { get; }
public virtual void Print (int code, string location, string text)
{
if (code < 0)
code = 8000-code;
StringBuilder msg = new StringBuilder ();
if (location.Length != 0) {
msg.Append (location);
msg.Append (' ');
}
msg.AppendFormat ("{0} CS{1:0000}: {2}", MessageType, code, text);
Console.Error.WriteLine (msg.ToString ());
foreach (string s in extra_information)
Console.Error.WriteLine (s + MessageType);
extra_information.Clear ();
if (Stacktrace)
Console.WriteLine (FriendlyStackTrace (new StackTrace (true)));
if (Fatal) {
if (!IsWarning || WarningsAreErrors)
throw new Exception (text);
}
Check (code);
}
public virtual void Print (int code, Location location, string text)
{
if (location.Equals (Location.Null)) {
Print (code, "", text);
return;
}
Print (code, String.Format ("{0}({1})", location.Name, location.Row), text);
}
}
sealed class WarningMessage: AbstractMessage {
Location loc = Location.Null;
readonly int Level;
public WarningMessage ():
this (-1) {}
public WarningMessage (int level)
{
Level = level;
}
public override bool IsWarning {
get { return true; }
}
bool IsEnabled (int code)
{
if (RootContext.WarningLevel < Level)
return false;
if (warning_ignore_table != null) {
if (warning_ignore_table.Contains (code)) {
return false;
}
}
if (warning_regions_table == null || loc.Equals (Location.Null))
return true;
WarningRegions regions = (WarningRegions)warning_regions_table [loc.Name];
return regions.IsWarningEnabled (code, loc.Row);
}
public override void Print(int code, string location, string text)
{
if (!IsEnabled (code)) {
extra_information.Clear ();
return;
}
if (WarningsAreErrors) {
new ErrorMessage ().Print (code, location, text);
return;
}
Warnings++;
base.Print (code, location, text);
}
public override void Print(int code, Location location, string text)
{
loc = location;
base.Print (code, location, text);
}
public override string MessageType {
get {
return "warning";
}
}
}
sealed class ErrorMessage: AbstractMessage {
public override void Print(int code, string location, string text)
{
Errors++;
base.Print (code, location, text);
}
public override bool IsWarning {
get { return false; }
}
public override string MessageType {
get {
return "error";
}
}
}
public static void FeatureIsNotStandardized (Location loc, string feature)
{
Report.Error (1644, loc, "Feature '{0}' cannot be used because it is not part of the standardized ISO C# language specification", feature);
}
public static string FriendlyStackTrace (Exception e)
{
return FriendlyStackTrace (new StackTrace (e, true));
}
static string FriendlyStackTrace (StackTrace t)
{
StringBuilder sb = new StringBuilder ();
bool foundUserCode = false;
for (int i = 0; i < t.FrameCount; i++) {
StackFrame f = t.GetFrame (i);
MethodBase mb = f.GetMethod ();
if (!foundUserCode && mb.ReflectedType == typeof (Report))
continue;
foundUserCode = true;
sb.Append ("\tin ");
if (f.GetFileLineNumber () > 0)
sb.AppendFormat ("(at {0}:{1}) ", f.GetFileName (), f.GetFileLineNumber ());
sb.AppendFormat ("{0}.{1} (", mb.ReflectedType.Name, mb.Name);
bool first = true;
foreach (ParameterInfo pi in mb.GetParameters ()) {
if (!first)
sb.Append (", ");
first = false;
sb.Append (TypeManager.CSharpName (pi.ParameterType));
}
sb.Append (")\n");
}
return sb.ToString ();
}
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// IF YOU ADD A NEW WARNING YOU HAVE TO DUPLICATE ITS ID HERE
//
public static bool IsValidWarning (int code)
{
int[] all_warnings = new int[] {
28, 67, 78, 105, 108, 109, 114, 192, 168, 169, 183, 184, 219, 251, 612, 618, 626, 628, 642, 649,
659, 660, 661, 672, 1030, 1522, 1616, 1691, 1692, 1901, 2002, 2023, 3012, 3019, 8024, 8028
};
foreach (int i in all_warnings) {
if (i == code)
return true;
}
return false;
}
static public void LocationOfPreviousError (Location loc)
{
Console.Error.WriteLine (String.Format ("{0}({1}) (Location of symbol related to previous error)", loc.Name, loc.Row));
}
static public void RuntimeMissingSupport (Location loc, string feature)
{
Report.Error (-88, loc, "Your .NET Runtime does not support '{0}'. Please use the latest Mono runtime instead.", feature);
}
/// <summary>
/// In most error cases is very useful to have information about symbol that caused the error.
/// Call this method before you call Report.Error when it makes sense.
/// </summary>
static public void SymbolRelatedToPreviousError (Location loc, string symbol)
{
SymbolRelatedToPreviousError (String.Format ("{0}({1})", loc.Name, loc.Row), symbol);
}
static public void SymbolRelatedToPreviousError (MemberInfo mi)
{
TypeContainer temp_ds = TypeManager.LookupGenericTypeContainer (mi.DeclaringType);
if (temp_ds == null) {
SymbolRelatedToPreviousError (mi.DeclaringType.Assembly.Location, TypeManager.GetFullNameSignature (mi));
} else {
MethodBase mb = mi as MethodBase;
if (mb != null) {
while (mb.Mono_IsInflatedMethod)
mb = mb.GetGenericMethodDefinition ();
IMethodData md = TypeManager.GetMethod (mb);
SymbolRelatedToPreviousError (md.Location, md.GetSignatureForError (temp_ds));
return;
}
string name = String.Concat (temp_ds.Name, ".", mi.Name);
MemberCore mc = temp_ds.GetDefinition (name);
SymbolRelatedToPreviousError (mc);
}
}
static public void SymbolRelatedToPreviousError (MemberCore mc)
{
SymbolRelatedToPreviousError (mc.Location, mc.GetSignatureForError ());
}
static public void SymbolRelatedToPreviousError (Type type)
{
DeclSpace temp_ds = TypeManager.LookupDeclSpace (type);
if (temp_ds == null)
SymbolRelatedToPreviousError (type.Assembly.Location, TypeManager.CSharpName (type));
else
SymbolRelatedToPreviousError (temp_ds.Location, TypeManager.CSharpName (type));
}
static void SymbolRelatedToPreviousError (string loc, string symbol)
{
extra_information.Add (String.Format ("{0}: '{1}' (name of symbol related to previous ", loc, symbol));
}
public static void ExtraInformation (Location loc, string msg)
{
extra_information.Add (String.Format ("{0}({1}) {2}", loc.Name, loc.Row, msg));
}
public static WarningRegions RegisterWarningRegion (Location location)
{
if (warning_regions_table == null)
warning_regions_table = new Hashtable ();
WarningRegions regions = (WarningRegions)warning_regions_table [location.Name];
if (regions == null) {
regions = new WarningRegions ();
warning_regions_table.Add (location.Name, regions);
}
return regions;
}
static public void Warning (int code, int level, Location loc, string format, params object[] args)
{
WarningMessage w = new WarningMessage (level);
w.Print (code, loc, String.Format (format, args));
}
static public void Warning (int code, Location loc, string format, params object[] args)
{
WarningMessage w = new WarningMessage ();
w.Print (code, loc, String.Format (format, args));
}
static public void Warning (int code, string format, params object[] args)
{
Warning (code, Location.Null, String.Format (format, args));
}
/// <summary>
/// Did you test your WarningLevel, that you use this method
/// </summary>
static public void Warning (int code, string text)
{
Warning (code, Location.Null, text);
}
static public void Error (int code, string format, params object[] args)
{
Error (code, Location.Null, String.Format (format, args));
}
static public void Error (int code, Location loc, string format, params object[] args)
{
ErrorMessage e = new ErrorMessage ();
e.Print (code, loc, String.Format (format, args));
}
static public void SetIgnoreWarning (int code)
{
if (warning_ignore_table == null)
warning_ignore_table = new Hashtable ();
warning_ignore_table [code] = true;
}
static public int ExpectedError {
set {
expected_error = value;
}
get {
return expected_error;
}
}
public static int DebugFlags = 0;
[Conditional ("MCS_DEBUG")]
static public void Debug (string message, params object[] args)
{
Debug (4, message, args);
}
[Conditional ("MCS_DEBUG")]
static public void Debug (int category, string message, params object[] args)
{
if ((category & DebugFlags) == 0)
return;
StringBuilder sb = new StringBuilder (message);
if ((args != null) && (args.Length > 0)) {
sb.Append (": ");
bool first = true;
foreach (object arg in args) {
if (first)
first = false;
else
sb.Append (", ");
if (arg == null)
sb.Append ("null");
else if (arg is ICollection)
sb.Append (PrintCollection ((ICollection) arg));
else
sb.Append (arg);
}
}
Console.WriteLine (sb.ToString ());
}
static public string PrintCollection (ICollection collection)
{
StringBuilder sb = new StringBuilder ();
sb.Append (collection.GetType ());
sb.Append ("(");
bool first = true;
foreach (object o in collection) {
if (first)
first = false;
else
sb.Append (", ");
sb.Append (o);
}
sb.Append (")");
return sb.ToString ();
}
}
public enum TimerType {
FindMembers = 0,
TcFindMembers = 1,
MemberLookup = 2,
CachedLookup = 3,
CacheInit = 4,
MiscTimer = 5,
CountTimers = 6
}
public enum CounterType {
FindMembers = 0,
MemberCache = 1,
MiscCounter = 2,
CountCounters = 3
}
public class Timer
{
static DateTime[] timer_start;
static TimeSpan[] timers;
static long[] timer_counters;
static long[] counters;
static Timer ()
{
timer_start = new DateTime [(int) TimerType.CountTimers];
timers = new TimeSpan [(int) TimerType.CountTimers];
timer_counters = new long [(int) TimerType.CountTimers];
counters = new long [(int) CounterType.CountCounters];
for (int i = 0; i < (int) TimerType.CountTimers; i++) {
timer_start [i] = DateTime.Now;
timers [i] = TimeSpan.Zero;
}
}
[Conditional("TIMER")]
static public void IncrementCounter (CounterType which)
{
++counters [(int) which];
}
[Conditional("TIMER")]
static public void StartTimer (TimerType which)
{
timer_start [(int) which] = DateTime.Now;
}
[Conditional("TIMER")]
static public void StopTimer (TimerType which)
{
timers [(int) which] += DateTime.Now - timer_start [(int) which];
++timer_counters [(int) which];
}
[Conditional("TIMER")]
static public void ShowTimers ()
{
ShowTimer (TimerType.FindMembers, "- FindMembers timer");
ShowTimer (TimerType.TcFindMembers, "- TypeContainer.FindMembers timer");
ShowTimer (TimerType.MemberLookup, "- MemberLookup timer");
ShowTimer (TimerType.CachedLookup, "- CachedLookup timer");
ShowTimer (TimerType.CacheInit, "- Cache init");
ShowTimer (TimerType.MiscTimer, "- Misc timer");
ShowCounter (CounterType.FindMembers, "- Find members");
ShowCounter (CounterType.MemberCache, "- Member cache");
ShowCounter (CounterType.MiscCounter, "- Misc counter");
}
static public void ShowCounter (CounterType which, string msg)
{
Console.WriteLine ("{0} {1}", counters [(int) which], msg);
}
static public void ShowTimer (TimerType which, string msg)
{
Console.WriteLine (
"[{0:00}:{1:000}] {2} (used {3} times)",
(int) timers [(int) which].TotalSeconds,
timers [(int) which].Milliseconds, msg,
timer_counters [(int) which]);
}
}
public class InternalErrorException : Exception {
public InternalErrorException ()
: base ("Internal error")
{
}
public InternalErrorException (string message)
: base (message)
{
}
}
/// <summary>
/// Handles #pragma warning
/// </summary>
public class WarningRegions {
abstract class PragmaCmd
{
public int Line;
protected PragmaCmd (int line)
{
Line = line;
}
public abstract bool IsEnabled (int code, bool previous);
}
class Disable: PragmaCmd
{
int code;
public Disable (int line, int code)
: base (line)
{
this.code = code;
}
public override bool IsEnabled (int code, bool previous)
{
return this.code == code ? false : previous;
}
}
class DisableAll: PragmaCmd
{
public DisableAll (int line)
: base (line) {}
public override bool IsEnabled(int code, bool previous)
{
return false;
}
}
class Enable: PragmaCmd
{
int code;
public Enable (int line, int code)
: base (line)
{
this.code = code;
}
public override bool IsEnabled(int code, bool previous)
{
return this.code == code ? true : previous;
}
}
class EnableAll: PragmaCmd
{
public EnableAll (int line)
: base (line) {}
public override bool IsEnabled(int code, bool previous)
{
return true;
}
}
ArrayList regions = new ArrayList ();
public void WarningDisable (int line)
{
regions.Add (new DisableAll (line));
}
public void WarningDisable (Location location, int code)
{
if (CheckWarningCode (code, location))
regions.Add (new Disable (location.Row, code));
}
public void WarningEnable (int line)
{
regions.Add (new EnableAll (line));
}
public void WarningEnable (Location location, int code)
{
if (CheckWarningCode (code, location))
regions.Add (new Enable (location.Row, code));
}
public bool IsWarningEnabled (int code, int src_line)
{
bool result = true;
foreach (PragmaCmd pragma in regions) {
if (src_line < pragma.Line)
break;
result = pragma.IsEnabled (code, result);
}
return result;
}
bool CheckWarningCode (int code, Location loc)
{
if (Report.IsValidWarning (code))
return true;
Report.Warning (1691, 1, loc, "'{0}' is not a valid warning number", code);
return false;
}
}
}
+724
View File
@@ -0,0 +1,724 @@
//
// rootcontext.cs: keeps track of our tree representation, and assemblies loaded.
//
// Author: Miguel de Icaza ([email protected])
// Ravi Pratap ([email protected])
//
// Licensed under the terms of the GNU GPL
//
// (C) 2001 Ximian, Inc (http://www.ximian.com)
// (C) 2004 Novell, Inc
using System;
using System.Collections;
using System.Reflection;
using System.Reflection.Emit;
using System.Diagnostics;
using System.Xml;
using Microsoft.VisualBasic;
namespace Mono.CSharp {
public enum LanguageVersion
{
Default = 0,
ISO_1 = 1
}
public class RootContext {
//
// Contains the parsed tree
//
static Tree tree;
//
// This hashtable contains all of the #definitions across the source code
// it is used by the ConditionalAttribute handler.
//
public static Hashtable AllDefines = new Hashtable ();
//
// Whether we are being linked against the standard libraries.
// This is only used to tell whether `System.Object' should
// have a base class or not.
//
public static bool StdLib = true;
//
// This keeps track of the order in which classes were defined
// so that we can poulate them in that order.
//
// Order is important, because we need to be able to tell, by
// examining the list of methods of the base class, which ones are virtual
// or abstract as well as the parent names (to implement new,
// override).
//
static ArrayList type_container_resolve_order;
static ArrayList attribute_types;
//
// Holds a reference to the Private Implementation Details
// class.
//
static ArrayList helper_classes;
static TypeBuilder impl_details_class;
public static int WarningLevel = 3;
public static Target Target = Target.Exe;
public static string TargetExt = ".exe";
public static bool VerifyClsCompliance = true;
public static LanguageVersion Version = LanguageVersion.Default;
//
// We keep strongname related info here because
// it's also used as complier options from CSC 8.x
//
public static string StrongNameKeyFile;
public static string StrongNameKeyContainer;
public static bool StrongNameDelaySign = false;
//
// If set, enable XML documentation generation
//
public static Documentation Documentation;
//
// Constructor
//
static RootContext ()
{
tree = new Tree ();
type_container_resolve_order = new ArrayList ();
}
public static bool NeedsEntryPoint {
get {
return RootContext.Target == Target.Exe || RootContext.Target == Target.WinExe;
}
}
static public Tree Tree {
get {
return tree;
}
}
static public string MainClass;
public static void RegisterOrder (TypeContainer tc)
{
type_container_resolve_order.Add (tc);
}
public static void RegisterAttribute (TypeContainer tc)
{
if (attribute_types == null)
attribute_types = new ArrayList ();
attribute_types.Add (tc);
}
//
// The default compiler checked state. It's "On" in case of VB.NET compiler.
//
static public bool Checked = true;
//
// Whether to allow Unsafe code
//
static public bool Unsafe = false;
//
// VB.NET specific compiler options
//
//
// The default type checking state
//
static public bool StricterTypeChecking = false;
//
// The default character comparison mode
//
static public CompareMethod StringComparisonMode = CompareMethod.Binary;
static string MakeFQN (string nsn, string name)
{
if (nsn == "")
return name;
return String.Concat (nsn, ".", name);
}
// <remarks>
// This function is used to resolve the hierarchy tree.
// It processes interfaces, structs and classes in that order.
//
// It creates the TypeBuilder's as it processes the user defined
// types.
// </remarks>
static public void ResolveTree ()
{
//
// Process the attribute types separately and before anything else
//
if (attribute_types != null)
foreach (TypeContainer tc in attribute_types)
tc.DefineType ();
//
// Interfaces are processed next, as classes and
// structs might inherit from an object or implement
// a set of interfaces, we need to be able to tell
// them appart by just using the TypeManager.
//
TypeContainer root = Tree.Types;
ArrayList ifaces = root.Interfaces;
if (ifaces != null){
foreach (Interface i in ifaces)
i.DefineType ();
}
foreach (TypeContainer tc in root.Types)
tc.DefineType ();
if (root.Delegates != null)
foreach (Delegate d in root.Delegates)
d.DefineType ();
if (root.Enums != null)
foreach (Enum e in root.Enums)
e.DefineType ();
}
static void Error_TypeConflict (string name, Location loc)
{
Report.Error (
520, loc, "`" + name + "' conflicts with a predefined type");
}
static void Error_TypeConflict (string name)
{
Report.Error (
520, "`" + name + "' conflicts with a predefined type");
}
//
// Resolves a single class during the corlib bootstrap process
//
static TypeBuilder BootstrapCorlib_ResolveClass (TypeContainer root, string name)
{
object o = root.GetDefinition (name);
if (o == null){
Report.Error (518, "The predefined type `" + name + "' is not defined");
return null;
}
if (!(o is Class)){
if (o is DeclSpace){
DeclSpace d = (DeclSpace) o;
Error_TypeConflict (name, d.Location);
} else
Error_TypeConflict (name);
return null;
}
return ((DeclSpace) o).DefineType ();
}
//
// Resolves a struct during the corlib bootstrap process
//
static void BootstrapCorlib_ResolveStruct (TypeContainer root, string name)
{
object o = root.GetDefinition (name);
if (o == null){
Report.Error (518, "The predefined type `" + name + "' is not defined");
return;
}
if (!(o is Struct)){
if (o is DeclSpace){
DeclSpace d = (DeclSpace) o;
Error_TypeConflict (name, d.Location);
} else
Error_TypeConflict (name);
return;
}
((DeclSpace) o).DefineType ();
}
//
// Resolves a struct during the corlib bootstrap process
//
static void BootstrapCorlib_ResolveInterface (TypeContainer root, string name)
{
object o = root.GetDefinition (name);
if (o == null){
Report.Error (518, "The predefined type `" + name + "' is not defined");
return;
}
if (!(o is Interface)){
if (o is DeclSpace){
DeclSpace d = (DeclSpace) o;
Error_TypeConflict (name, d.Location);
} else
Error_TypeConflict (name);
return;
}
((DeclSpace) o).DefineType ();
}
//
// Resolves a delegate during the corlib bootstrap process
//
static void BootstrapCorlib_ResolveDelegate (TypeContainer root, string name)
{
object o = root.GetDefinition (name);
if (o == null){
Report.Error (518, "The predefined type `" + name + "' is not defined");
Environment.Exit (1);
}
if (!(o is Delegate)){
Error_TypeConflict (name);
return;
}
((DeclSpace) o).DefineType ();
}
/// <summary>
/// Resolves the core types in the compiler when compiling with --nostdlib
/// </summary>
static public void ResolveCore ()
{
TypeContainer root = Tree.Types;
TypeManager.object_type = BootstrapCorlib_ResolveClass (root, "System.Object");
TypeManager.value_type = BootstrapCorlib_ResolveClass (root, "System.ValueType");
TypeManager.attribute_type = BootstrapCorlib_ResolveClass (root, "System.Attribute");
string [] interfaces_first_stage = {
"System.IComparable", "System.ICloneable",
"System.IConvertible",
"System.Collections.IEnumerable",
"System.Collections.ICollection",
"System.Collections.IEnumerator",
"System.Collections.IList",
"System.IAsyncResult",
"System.IDisposable",
"System.Runtime.Serialization.ISerializable",
"System.Runtime.InteropServices._Exception",
"System.Reflection.IReflect",
"System.Reflection.ICustomAttributeProvider",
//
// Generic types
//
"System.Collections.Generic.IEnumerator`1",
"System.Collections.Generic.IEnumerable`1",
};
foreach (string iname in interfaces_first_stage)
BootstrapCorlib_ResolveInterface (root, iname);
//
// These are the base value types
//
string [] structs_first_stage = {
"System.Byte", "System.SByte",
"System.Int16", "System.UInt16",
"System.Int32", "System.UInt32",
"System.Int64", "System.UInt64",
};
foreach (string cname in structs_first_stage)
BootstrapCorlib_ResolveStruct (root, cname);
//
// Now, we can load the enumerations, after this point,
// we can use enums.
//
TypeManager.InitEnumUnderlyingTypes ();
string [] structs_second_stage = {
"System.Single", "System.Double",
"System.Char", "System.Boolean",
"System.Decimal", "System.Void",
"System.RuntimeFieldHandle",
"System.RuntimeArgumentHandle",
"System.RuntimeTypeHandle",
"System.IntPtr",
"System.TypedReference",
"System.ArgIterator"
};
foreach (string cname in structs_second_stage)
BootstrapCorlib_ResolveStruct (root, cname);
//
// These are classes that depends on the core interfaces
//
string [] classes_second_stage = {
"System.Enum",
"System.String",
"System.Array",
"System.Reflection.MemberInfo",
"System.Type",
"System.Exception",
"System.Activator",
//
// These are not really important in the order, but they
// are used by the compiler later on (typemanager/CoreLookupType-d)
//
"System.Runtime.CompilerServices.RuntimeHelpers",
"System.Reflection.DefaultMemberAttribute",
"System.Threading.Monitor",
"System.AttributeUsageAttribute",
"System.Runtime.InteropServices.DllImportAttribute",
"System.Runtime.CompilerServices.MethodImplAttribute",
"System.Runtime.InteropServices.MarshalAsAttribute",
"System.Runtime.CompilerServices.NewConstraintAttribute",
"System.Diagnostics.ConditionalAttribute",
"System.ObsoleteAttribute",
"System.ParamArrayAttribute",
"System.CLSCompliantAttribute",
"System.Security.UnverifiableCodeAttribute",
"System.Security.Permissions.SecurityAttribute",
"System.Runtime.CompilerServices.IndexerNameAttribute",
"System.Runtime.CompilerServices.DecimalConstantAttribute",
"System.Runtime.InteropServices.InAttribute",
"System.Runtime.InteropServices.OutAttribute",
"System.Runtime.InteropServices.StructLayoutAttribute",
"System.Runtime.InteropServices.FieldOffsetAttribute",
"System.InvalidOperationException",
"System.NotSupportedException",
"System.MarshalByRefObject",
"System.Security.CodeAccessPermission"
};
foreach (string cname in classes_second_stage)
BootstrapCorlib_ResolveClass (root, cname);
BootstrapCorlib_ResolveStruct (root, "System.Nullable`1");
BootstrapCorlib_ResolveDelegate (root, "System.AsyncCallback");
// These will be defined indirectly during the previous ResolveDelegate.
// However make sure the rest of the checks happen.
string [] delegate_types = { "System.Delegate", "System.MulticastDelegate" };
foreach (string cname in delegate_types)
BootstrapCorlib_ResolveClass (root, cname);
}
// <summary>
// Closes all open types
// </summary>
//
// <remarks>
// We usually use TypeBuilder types. When we are done
// creating the type (which will happen after we have added
// methods, fields, etc) we need to "Define" them before we
// can save the Assembly
// </remarks>
static public void CloseTypes ()
{
TypeContainer root = Tree.Types;
if (root.Enums != null)
foreach (Enum en in root.Enums)
en.CloseType ();
if (attribute_types != null)
foreach (TypeContainer tc in attribute_types)
tc.CloseType ();
//
// We do this in two passes, first we close the structs,
// then the classes, because it seems the code needs it this
// way. If this is really what is going on, we should probably
// make sure that we define the structs in order as well.
//
foreach (TypeContainer tc in type_container_resolve_order){
if (tc.Kind == Kind.Struct && tc.Parent == tree.Types){
tc.CloseType ();
}
}
foreach (TypeContainer tc in type_container_resolve_order){
if (!(tc.Kind == Kind.Struct && tc.Parent == tree.Types))
tc.CloseType ();
}
if (root.Delegates != null)
foreach (Delegate d in root.Delegates)
d.CloseType ();
//
// If we have a <PrivateImplementationDetails> class, close it
//
if (helper_classes != null){
foreach (TypeBuilder type_builder in helper_classes)
type_builder.CreateType ();
}
attribute_types = null;
type_container_resolve_order = null;
helper_classes = null;
//tree = null;
TypeManager.CleanUp ();
}
/// <summary>
/// Used to register classes that need to be closed after all the
/// user defined classes
/// </summary>
public static void RegisterHelperClass (TypeBuilder helper_class)
{
if (helper_classes == null)
helper_classes = new ArrayList ();
helper_classes.Add (helper_class);
}
static void Report1530 (Location loc)
{
Report.Error (1530, loc, "Keyword new not allowed for namespace elements");
}
static public void PopulateCoreType (TypeContainer root, string name)
{
DeclSpace ds = (DeclSpace) root.GetDefinition (name);
ds.DefineMembers (root);
ds.Define ();
}
static public void BootCorlib_PopulateCoreTypes ()
{
TypeContainer root = tree.Types;
PopulateCoreType (root, "System.Object");
PopulateCoreType (root, "System.ValueType");
PopulateCoreType (root, "System.Attribute");
}
// <summary>
// Populates the structs and classes with fields and methods
// </summary>
//
// This is invoked after all interfaces, structs and classes
// have been defined through `ResolveTree'
static public void PopulateTypes ()
{
TypeContainer root = Tree.Types;
if (attribute_types != null)
foreach (TypeContainer tc in attribute_types)
tc.DefineMembers (root);
if (type_container_resolve_order != null){
if (RootContext.StdLib){
foreach (TypeContainer tc in type_container_resolve_order)
tc.DefineMembers (root);
} else {
foreach (TypeContainer tc in type_container_resolve_order) {
// When compiling corlib, these types have already been
// populated from BootCorlib_PopulateCoreTypes ().
if (((tc.Name == "System.Object") ||
(tc.Name == "System.Attribute") ||
(tc.Name == "System.ValueType")))
continue;
tc.DefineMembers (root);
}
}
}
ArrayList delegates = root.Delegates;
if (delegates != null){
foreach (Delegate d in delegates)
if ((d.ModFlags & Modifiers.NEW) == 0)
d.DefineMembers (root);
else
Report1530 (d.Location);
}
ArrayList enums = root.Enums;
if (enums != null){
foreach (Enum en in enums)
if ((en.ModFlags & Modifiers.NEW) == 0)
en.DefineMembers (root);
else
Report1530 (en.Location);
}
//
// Check for cycles in the struct layout
//
if (type_container_resolve_order != null){
Hashtable seen = new Hashtable ();
foreach (TypeContainer tc in type_container_resolve_order)
TypeManager.CheckStructCycles (tc, seen);
}
}
//
// A generic hook delegate
//
public delegate void Hook ();
//
// A hook invoked when the code has been generated.
//
public static event Hook EmitCodeHook;
//
// DefineTypes is used to fill in the members of each type.
//
static public void DefineTypes ()
{
TypeContainer root = Tree.Types;
if (attribute_types != null)
foreach (TypeContainer tc in attribute_types)
tc.Define ();
if (type_container_resolve_order != null){
foreach (TypeContainer tc in type_container_resolve_order) {
// When compiling corlib, these types have already been
// populated from BootCorlib_PopulateCoreTypes ().
if (!RootContext.StdLib &&
((tc.Name == "System.Object") ||
(tc.Name == "System.Attribute") ||
(tc.Name == "System.ValueType")))
continue;
if ((tc.ModFlags & Modifiers.NEW) == 0)
tc.Define ();
}
}
ArrayList delegates = root.Delegates;
if (delegates != null){
foreach (Delegate d in delegates)
if ((d.ModFlags & Modifiers.NEW) == 0)
d.Define ();
}
ArrayList enums = root.Enums;
if (enums != null){
foreach (Enum en in enums)
if ((en.ModFlags & Modifiers.NEW) == 0)
en.Define ();
}
}
static public void EmitCode ()
{
if (attribute_types != null)
foreach (TypeContainer tc in attribute_types)
tc.EmitType ();
CodeGen.Assembly.Emit (Tree.Types);
CodeGen.Module.Emit (Tree.Types);
if (Tree.Types.Enums != null) {
foreach (Enum e in Tree.Types.Enums)
e.Emit ();
}
if (type_container_resolve_order != null) {
foreach (TypeContainer tc in type_container_resolve_order)
tc.EmitType ();
}
if (Tree.Types.Delegates != null) {
foreach (Delegate d in Tree.Types.Delegates)
d.Emit ();
}
//
// Run any hooks after all the types have been defined.
// This is used to create nested auxiliary classes for example
//
if (EmitCodeHook != null)
EmitCodeHook ();
}
//
// Public Field, used to track which method is the public entry
// point.
//
static public MethodInfo EntryPoint;
//
// Track the location of the entry point.
//
static public Location EntryPointLocation;
//
// These are used to generate unique names on the structs and fields.
//
static int field_count;
//
// Makes an initialized struct, returns the field builder that
// references the data. Thanks go to Sergey Chaban for researching
// how to do this. And coming up with a shorter mechanism than I
// was able to figure out.
//
// This works but makes an implicit public struct $ArrayType$SIZE and
// makes the fields point to it. We could get more control if we did
// use instead:
//
// 1. DefineNestedType on the impl_details_class with our struct.
//
// 2. Define the field on the impl_details_class
//
static public FieldBuilder MakeStaticData (byte [] data)
{
FieldBuilder fb;
if (impl_details_class == null){
impl_details_class = CodeGen.Module.Builder.DefineType (
"<PrivateImplementationDetails>",
TypeAttributes.NotPublic,
TypeManager.object_type);
RegisterHelperClass (impl_details_class);
}
fb = impl_details_class.DefineInitializedData (
"$$field-" + (field_count++), data,
FieldAttributes.Static | FieldAttributes.Assembly);
return fb;
}
}
}
+29
View File
@@ -0,0 +1,29 @@
using System;
using Generics;
namespace Test
{
public class Bar : Foo
{
public void Hello (Stack<int> stack)
{
Console.WriteLine ("Hello Generic World!");
Console.WriteLine (stack);
Console.WriteLine (stack.GetType ());
}
public Stack<int> Test ()
{
return Driver.int_stack;
}
public static void Main ()
{
Foo foo = new Bar ();
Driver.Init (foo);
Stack<int> a = Driver.int_stack;
Console.WriteLine ("STACK: {0}", a);
foo.Hello (a);
}
}
}
File diff suppressed because it is too large. Load diff
+618
View File
@@ -0,0 +1,618 @@
//
// support.cs: Support routines to work around the fact that System.Reflection.Emit
// can not introspect types that are being constructed
//
// Author:
// Miguel de Icaza ([email protected])
//
// (C) 2001 Ximian, Inc (http://www.ximian.com)
//
using System;
using System.IO;
using System.Text;
using System.Reflection;
using System.Collections;
using System.Reflection.Emit;
using System.Globalization;
namespace Mono.CSharp {
public interface ParameterData {
Type ParameterType (int pos);
GenericConstraints GenericConstraints (int pos);
int Count { get; }
bool HasParams { get; }
string ParameterName (int pos);
string ParameterDesc (int pos);
Parameter.Modifier ParameterModifier (int pos);
}
public class ReflectionParameters : ParameterData {
ParameterInfo [] pi;
Type[] type_params;
bool last_arg_is_params = false;
bool is_varargs = false;
ParameterData gpd;
public ReflectionParameters (MethodBase mb)
{
object [] attrs;
ParameterInfo [] pi = mb.GetParameters ();
is_varargs = (mb.CallingConvention & CallingConventions.VarArgs) != 0;
this.pi = pi;
int count = pi.Length-1;
if (count < 0)
return;
if (mb.Mono_IsInflatedMethod) {
MethodInfo generic = mb.GetGenericMethodDefinition ();
gpd = Invocation.GetParameterData (generic);
last_arg_is_params = gpd.HasParams;
return;
}
if (mb.IsGenericMethodDefinition)
type_params = mb.GetGenericArguments ();
attrs = pi [count].GetCustomAttributes (TypeManager.param_array_type, true);
if (attrs == null)
return;
if (attrs.Length == 0)
return;
last_arg_is_params = true;
}
public Type ParameterType (int pos)
{
if (last_arg_is_params && pos >= pi.Length - 1)
return pi [pi.Length - 1].ParameterType;
else if (is_varargs && pos >= pi.Length)
return TypeManager.runtime_argument_handle_type;
else {
Type t = pi [pos].ParameterType;
return t;
}
}
public GenericConstraints GenericConstraints (int pos)
{
if (gpd != null)
return gpd.GenericConstraints (pos);
if (type_params == null)
return null;
return new ReflectionConstraints (type_params [pos]);
}
public string ParameterName (int pos)
{
if (gpd != null)
return gpd.ParameterName (pos);
if (last_arg_is_params && pos >= pi.Length - 1)
return pi [pi.Length - 1].Name;
else if (is_varargs && pos >= pi.Length)
return "__arglist";
else
return pi [pos].Name;
}
public string ParameterDesc (int pos)
{
if (is_varargs && pos >= pi.Length)
return "";
StringBuilder sb = new StringBuilder ();
if (pi [pos].IsIn)
sb.Append ("in ");
Type partype = ParameterType (pos);
if (partype.IsByRef){
partype = TypeManager.GetElementType (partype);
if (pi [pos].IsOut)
sb.Append ("out ");
else
sb.Append ("ref ");
}
if (pos >= pi.Length - 1 && last_arg_is_params)
sb.Append ("params ");
sb.Append (TypeManager.CSharpName (partype));
return sb.ToString ();
}
public Parameter.Modifier ParameterModifier (int pos)
{
if (last_arg_is_params && pos >= pi.Length - 1)
return Parameter.Modifier.PARAMS;
else if (is_varargs && pos >= pi.Length)
return Parameter.Modifier.ARGLIST;
if (gpd != null)
return gpd.ParameterModifier (pos);
Type t = pi [pos].ParameterType;
if (t.IsByRef){
if ((pi [pos].Attributes & ParameterAttributes.Out) != 0)
return Parameter.Modifier.ISBYREF | Parameter.Modifier.OUT;
else
return Parameter.Modifier.ISBYREF | Parameter.Modifier.REF;
}
return Parameter.Modifier.NONE;
}
public int Count {
get {
return is_varargs ? pi.Length + 1 : pi.Length;
}
}
public bool HasParams {
get {
return this.last_arg_is_params;
}
}
}
public class InternalParameters : ParameterData {
Type [] param_types;
bool has_varargs;
int count;
public readonly Parameters Parameters;
public readonly TypeParameter[] TypeParameters;
public InternalParameters (Type [] param_types, Parameters parameters)
{
this.param_types = param_types;
this.Parameters = parameters;
has_varargs = parameters.HasArglist;
if (param_types == null)
count = 0;
else
count = param_types.Length;
}
public InternalParameters (Type [] param_types, Parameters parameters,
TypeParameter [] type_params)
: this (param_types, parameters)
{
this.TypeParameters = type_params;
}
public int Count {
get {
return has_varargs ? count + 1 : count;
}
}
public bool HasParams {
get {
return Parameters.ArrayParameter != null;
}
}
Parameter GetParameter (int pos)
{
Parameter [] fixed_pars = Parameters.FixedParameters;
if (fixed_pars != null){
int len = fixed_pars.Length;
if (pos < len)
return Parameters.FixedParameters [pos];
}
return Parameters.ArrayParameter;
}
public Type ParameterType (int pos)
{
if (has_varargs && pos >= count)
return TypeManager.runtime_argument_handle_type;
if (param_types == null)
return null;
return GetParameter (pos).ExternalType ();
}
public GenericConstraints GenericConstraints (int pos)
{
if (TypeParameters == null)
return null;
return TypeParameters [pos].Constraints;
}
public string ParameterName (int pos)
{
if (has_varargs && pos >= count)
return "__arglist";
return GetParameter (pos).Name;
}
public string ParameterDesc (int pos)
{
if (has_varargs && pos >= count)
return "__arglist";
string tmp = String.Empty;
Parameter p = GetParameter (pos);
//
// We need to and for REF/OUT, because if either is set the
// extra flag ISBYREF will be set as well
//
if ((p.ModFlags & Parameter.Modifier.REF) != 0)
tmp = "ref ";
else if ((p.ModFlags & Parameter.Modifier.OUT) != 0)
tmp = "out ";
else if (p.ModFlags == Parameter.Modifier.PARAMS)
tmp = "params ";
Type t = ParameterType (pos);
return tmp + TypeManager.CSharpName (t);
}
public Parameter.Modifier ParameterModifier (int pos)
{
if (has_varargs && pos >= count)
return Parameter.Modifier.ARGLIST;
Parameter.Modifier mod = GetParameter (pos).ModFlags;
if ((mod & (Parameter.Modifier.REF | Parameter.Modifier.OUT)) != 0)
mod |= Parameter.Modifier.ISBYREF;
return mod;
}
}
public class ReflectionConstraints : GenericConstraints
{
GenericParameterAttributes attrs;
Type base_type;
Type class_constraint;
Type[] iface_constraints;
public ReflectionConstraints (Type t)
{
Type[] constraints = t.GetGenericParameterConstraints ();
if ((constraints.Length > 0) && !constraints [0].IsInterface) {
class_constraint = constraints [0];
iface_constraints = new Type [constraints.Length - 1];
Array.Copy (constraints, 1, iface_constraints, 0, constraints.Length - 1);
} else
iface_constraints = constraints;
attrs = t.GenericParameterAttributes;
if (HasValueTypeConstraint)
base_type = TypeManager.value_type;
else if (class_constraint != null)
base_type = class_constraint;
else
base_type = TypeManager.object_type;
}
public override GenericParameterAttributes Attributes {
get { return attrs; }
}
public override Type ClassConstraint {
get { return class_constraint; }
}
public override Type EffectiveBaseClass {
get { return base_type; }
}
public override Type[] InterfaceConstraints {
get { return iface_constraints; }
}
}
class PtrHashtable : Hashtable {
sealed class PtrComparer : IComparer {
private PtrComparer () {}
public static PtrComparer Instance = new PtrComparer ();
public int Compare (object x, object y)
{
if (x == y)
return 0;
else
return 1;
}
}
public PtrHashtable ()
{
comparer = PtrComparer.Instance;
}
}
/*
* Hashtable whose keys are character arrays with the same length
*/
class CharArrayHashtable : Hashtable {
sealed class ArrComparer : IComparer {
private int len;
public ArrComparer (int len) {
this.len = len;
}
public int Compare (object x, object y)
{
char[] a = (char[])x;
char[] b = (char[])y;
for (int i = 0; i < len; ++i)
if (a [i] != b [i])
return 1;
return 0;
}
}
private int len;
protected override int GetHash (Object key)
{
char[] arr = (char[])key;
int h = 0;
for (int i = 0; i < len; ++i)
h = (h << 5) - h + arr [i];
return h;
}
public CharArrayHashtable (int len)
{
this.len = len;
comparer = new ArrComparer (len);
}
}
struct Pair {
public object First;
public object Second;
public Pair (object f, object s)
{
First = f;
Second = s;
}
}
/// <summary>
/// This is a wrapper around StreamReader which is seekable.
/// </summary>
public class SeekableStreamReader
{
public SeekableStreamReader (StreamReader reader)
{
this.reader = reader;
this.buffer = new char [DefaultCacheSize];
// Compute the preamble size
// Let the StreamWriter autodetect the encoder
reader.Peek ();
reader.BaseStream.Position = 0;
Encoding enc = reader.CurrentEncoding;
// First of all, get at least a char
byte[] auxb = new byte [50];
int num_bytes = 0;
int num_chars = 0;
int br = 0;
do {
br = reader.BaseStream.Read (auxb, num_bytes, auxb.Length - num_bytes);
num_bytes += br;
num_chars = enc.GetCharCount (auxb, 0, num_bytes);
}
while (num_chars == 0 && br > 0);
if (num_chars != 0)
{
// Now, check which bytes at the beginning have no effect in the
// char count
int p = 0;
while (enc.GetCharCount (auxb, p, num_bytes-p) >= num_chars)
p++;
preamble_size = p - 1;
reader.BaseStream.Position = 0;
reader.DiscardBufferedData ();
buffer_start = preamble_size;
}
}
public SeekableStreamReader (Stream stream, Encoding encoding, bool detect_encoding_from_bytemarks)
: this (new StreamReader (stream, encoding, detect_encoding_from_bytemarks))
{ }
StreamReader reader;
private const int DefaultCacheSize = 1024;
char[] buffer;
int buffer_start; // in bytes
int buffer_size; // in bytes
int char_count; // count buffer[] valid characters
int pos; // index into buffer[]
int preamble_size;
/// <remarks>
/// The difference to the StreamReader's BaseStream.Position is that this one is reliable; ie. it
// always reports the correct position and if it's modified, it also takes care of the buffered data.
/// </remarks>
public int Position {
get {
return buffer_start + reader.CurrentEncoding.GetByteCount (buffer, 0, pos);
}
set {
// This one is easy: we're modifying the position within our current
// buffer.
if ((value >= buffer_start) && (value < buffer_start + buffer_size)) {
int byte_offset = value - buffer_start;
// pos is an index into a char
// buffer so it might be
// greater than the buffer
// length now, if the buffer
// contains multibyte chars
pos = byte_offset;
// encoded characters can take
// more than 1 byte length.
while ((pos > buffer.Length) ||
reader.CurrentEncoding.GetByteCount (buffer, 0, pos) > byte_offset) {
pos--;
}
return;
}
if (value == 0) // Skip preamble
value = preamble_size;
// Ok, now we need to seek.
reader.DiscardBufferedData ();
reader.BaseStream.Position = buffer_start = value;
char_count = buffer_size = pos = 0;
}
}
private bool ReadBuffer ()
{
pos = 0;
buffer_start += buffer_size;
char_count = reader.Read (buffer, 0, buffer.Length);
buffer_size = reader.CurrentEncoding.GetByteCount (buffer, 0, char_count);
return buffer_size > 0;
}
public int Peek ()
{
if ((pos >= char_count) && !ReadBuffer ())
return -1;
return buffer [pos];
}
public int Read ()
{
if ((pos >= char_count) && !ReadBuffer ())
return -1;
return buffer [pos++];
}
}
public class DoubleHash {
const int DEFAULT_INITIAL_BUCKETS = 100;
public DoubleHash () : this (DEFAULT_INITIAL_BUCKETS) {}
public DoubleHash (int size)
{
count = size;
buckets = new Entry [size];
}
int count;
Entry [] buckets;
int size = 0;
class Entry {
public object key1;
public object key2;
public int hash;
public object value;
public Entry next;
public Entry (object key1, object key2, int hash, object value, Entry next)
{
this.key1 = key1;
this.key2 = key2;
this.hash = hash;
this.next = next;
this.value = value;
}
}
public bool Lookup (object a, object b, out object res)
{
int h = (a.GetHashCode () ^ b.GetHashCode ()) & 0x7FFFFFFF;
for (Entry e = buckets [h % count]; e != null; e = e.next) {
if (e.hash == h && e.key1.Equals (a) && e.key2.Equals (b)) {
res = e.value;
return true;
}
}
res = null;
return false;
}
public void Insert (object a, object b, object value)
{
// Is it an existing one?
int h = (a.GetHashCode () ^ b.GetHashCode ()) & 0x7FFFFFFF;
for (Entry e = buckets [h % count]; e != null; e = e.next) {
if (e.hash == h && e.key1.Equals (a) && e.key2.Equals (b))
e.value = value;
}
int bucket = h % count;
buckets [bucket] = new Entry (a, b, h, value, buckets [bucket]);
// Grow whenever we double in size
if (size++ == count) {
count <<= 1;
count ++;
Entry [] newBuckets = new Entry [count];
foreach (Entry root in buckets) {
Entry e = root;
while (e != null) {
int newLoc = e.hash % count;
Entry n = e.next;
e.next = newBuckets [newLoc];
newBuckets [newLoc] = e;
e = n;
}
}
buckets = newBuckets;
}
}
}
}
+91
View File
@@ -0,0 +1,91 @@
//
// symbolwriter.cs: The symbol writer
//
// Author:
// Martin Baulig ([email protected])
//
// (C) 2003 Ximian, Inc.
//
using System;
using System.Collections;
using System.Reflection;
using System.Reflection.Emit;
using Mono.CompilerServices.SymbolWriter;
namespace Mono.CSharp {
public class SymbolWriter : MonoSymbolWriter {
delegate int GetILOffsetFunc (ILGenerator ig);
delegate Guid GetGuidFunc (ModuleBuilder mb);
GetILOffsetFunc get_il_offset_func;
GetGuidFunc get_guid_func;
ModuleBuilder module_builder;
protected SymbolWriter (ModuleBuilder module_builder, string filename)
: base (filename)
{
this.module_builder = module_builder;
}
bool Initialize ()
{
MethodInfo mi = typeof (ILGenerator).GetMethod (
"Mono_GetCurrentOffset",
BindingFlags.Static | BindingFlags.NonPublic);
if (mi == null)
return false;
get_il_offset_func = (GetILOffsetFunc) System.Delegate.CreateDelegate (
typeof (GetILOffsetFunc), mi);
mi = typeof (ModuleBuilder).GetMethod (
"Mono_GetGuid",
BindingFlags.Static | BindingFlags.NonPublic);
if (mi == null)
return false;
get_guid_func = (GetGuidFunc) System.Delegate.CreateDelegate (
typeof (GetGuidFunc), mi);
Location.DefineSymbolDocuments (this);
Namespace.DefineNamespaces (this);
return true;
}
public void DefineLocalVariable (string name, LocalBuilder builder)
{
SignatureHelper sighelper = SignatureHelper.GetLocalVarSigHelper (
module_builder);
sighelper.AddArgument (builder.LocalType);
byte[] signature = sighelper.GetSignature ();
DefineLocalVariable (name, signature);
}
public void MarkSequencePoint (ILGenerator ig, int row, int column)
{
int offset = get_il_offset_func (ig);
MarkSequencePoint (offset, row, column);
}
public void WriteSymbolFile ()
{
Guid guid = get_guid_func (module_builder);
WriteSymbolFile (guid);
}
public static SymbolWriter GetSymbolWriter (ModuleBuilder module,
string filename)
{
SymbolWriter writer = new SymbolWriter (module, filename);
if (!writer.Initialize ())
return null;
return writer;
}
}
}
+135
View File
@@ -0,0 +1,135 @@
//
// tree.cs: keeps a tree representation of the generated code
//
// Author: Miguel de Icaza ([email protected])
//
// Licensed under the terms of the GNU GPL
//
// (C) 2001 Ximian, Inc (http://www.ximian.com)
//
//
using System;
using System.Collections;
using System.Reflection;
using System.Reflection.Emit;
using System.IO;
namespace Mono.CSharp
{
public interface ITreeDump {
int Dump (Tree tree, StreamWriter output);
void ParseOptions (string options);
}
// <summary>
//
// We store here all the toplevel types that we have parsed,
// this is the root of all information we have parsed.
//
// </summary>
public class Tree {
TypeContainer root_types;
// <summary>
// Keeps track of all the types definied (classes, structs, ifaces, enums)
// </summary>
Hashtable decls;
public Tree ()
{
root_types = new RootTypes ();
decls = new Hashtable ();
}
DoubleHash decl_ns_name = new DoubleHash ();
public void RecordDecl (string name, DeclSpace ds)
{
DeclSpace other = (DeclSpace) decls [name];
if (other != null){
PartialContainer other_pc = other as PartialContainer;
if ((ds is TypeContainer) && (other_pc != null)) {
Report.Error (
260, ds.Location, "Missing partial modifier " +
"on declaration of type `{0}'; another " +
"partial implementation of this type exists",
name);
Report.LocationOfPreviousError (other.Location);
return;
}
Report.SymbolRelatedToPreviousError (
other.Location, other.GetSignatureForError ());
Report.Error (
101, ds.Location,
"There is already a definition for `" + name + "'");
return;
}
ds.RecordDecl ();
int p = name.LastIndexOf ('.');
if (p == -1)
decl_ns_name.Insert ("", name, ds);
else {
decl_ns_name.Insert (name.Substring (0, p), name.Substring (p+1), ds);
}
decls.Add (name, ds);
}
public DeclSpace LookupByNamespace (string ns, string name)
{
object res;
decl_ns_name.Lookup (ns, name, out res);
return (DeclSpace) res;
}
//
// FIXME: Why are we using Types?
//
public TypeContainer Types {
get {
return root_types;
}
}
public Hashtable Decls {
get {
return decls;
}
}
}
public class RootTypes : TypeContainer
{
public RootTypes ()
: base (null, null, MemberName.Null, null, Kind.Root, Location.Null)
{
ec = new EmitContext (null, this, Location.Null, null, null, 0, false);
}
public override void Register ()
{
throw new InvalidOperationException ();
}
public override PendingImplementation GetPendingImplementations ()
{
throw new InvalidOperationException ();
}
public override bool IsClsCompliaceRequired (DeclSpace ds)
{
return true;
}
}
}
File diff suppressed because it is too large. Load diff
+3
View File
@@ -0,0 +1,3 @@
config.make
pre-config.make
semantic.cache
-200
View File
@@ -1,203 +1,3 @@
2008-06-30 Marek Safar <[email protected]>
* platforms/linux.make: Enable mcs optimizations.
2008-06-03 Zoltan Varga <[email protected]>
* rules.make (PROFILE): Reapply the PROFILE=net_2_0 change. One can still
build 1.1 libraries using make PROFILE=default.
2008-05-27 Raja R Harinath <[email protected]>
* executable.make ($(PROGRAM_config)): Depend on directory
creation stamp.
2008-04-09 Gert Driesen <[email protected]>
* library.make: hidden -bootstrap option for gacutil is no longer
necessary.
2008-03-24 Zoltan Varga <[email protected]>
* library.make (check): Add a standard check target and make it the same as
run-test.
2008-03-22 Zoltan Varga <[email protected]>
* profiles/net_3_5.make (PROFILE_MCS_FLAGS): Get rid of obsolete
-langversion:linq option.
Fri Mar 14 09:31:59 CET 2008 Paolo Molaro <[email protected]>
* rules.make, library.make: move GACUTIL definition into rules.make as
it's used also by the tools. Add the hidden -bootstrap option.
2008-02-18 Raja R Harinath <[email protected]>
* rules.make (%/.stamp): Unify all directory creation targets here.
2008-02-17 Raja R Harinath <[email protected]>
* profiles/net_2_1_bootstrap.make: New.
* profiles/net_2_1_raw.make: New. The untuned 2.1 profile.
* profiles/net_2_1.make: New. The tuned 2.1 profile.
* Makefile (PROFILES): Update.
2007-12-06 Atsushi Enomoto <[email protected]>
* profiles/net_3_5.make : fixed net_2_0 path.
2007-12-03 Marek Safar <[email protected]>
* Makefile.make: Distribute 3.5 profile
2007-11-08 Wade Berrier <[email protected]>
* config-default.make: add sysconfdir dir (for mconfig/config.xml)
2007-11-01 Marek Safar <[email protected]>
* corcompare.make: Build corcompare into same directory.
2007-10-27 Marek Safar <[email protected]>
* profiles/net_2_0_bootstrap.make: Fixed generics compiler name.
2007-10-27 Marek Safar <[email protected]>
* rules.make: Changed gmcs location.
2007-10-27 Marek Safar <[email protected]>
* executable.make: Added KEEP_OUTPUT_FILE_COPY to avoid move and copy
back compiler executables.
2007-09-21 Raja R Harinath <[email protected]>
* Makefile (PROFILES): Remove 'atomic' profiles.
* profiles/atomic.make, profiles/bootstrap.make: Remove.
2007-09-04 Wade Berrier <[email protected]>
* library.make: Glob for .sources for all profiles.
Use tools/removecomments.sh to account for '#include' and
comments, which are only used in the jvm profile at this point
2007-09-01 Jb Evain <[email protected]>
* Makefile: consider the net_2_1 profile.
2007-08-12 Marek Safar <[email protected]>
* library.make: Includes new `corcompare' target.
* corcompare.make: I got tired of hacking corcompare stuff again and
again.
2007-08-11 Jb Evain <[email protected]>
* profiles/net_2_1: allow 2.1 assemblies in the GAC.
2007-07-27 Jb Evain <[email protected]>
* profiles/net_2_1: use smcs to compile the .net 2.1 assemblies.
2007-07-23 Raja R Harinath <[email protected]>
* library.make (install-local) [GAC]: If LIBRARY_PACKAGE is set to
'none' don't install a symlink from a package directory into the gac.
2007-07-11 Jb Evain <[email protected]>
* profiles/net_2_1.make: work on the 2_1 profile.
2007-06-12 Marek Safar <[email protected]>
* rules.make: Added FRAMEWORK_VERSION_MAJOR.
2007-05-11 Raja R Harinath <[email protected]>
* Makefile (dist-local): Remove special-case code.
* rules.make ($(depsdir)): New rule to create the dependencies
directory on demand.
* library.make, executable.make: Make generated files depend on
$(depsdir).
* profiles/basic.make: Likewise.
* profiles/net_2_0_bootstrap.make: Move rules for mcs.exe to
mcs/Makefile.
* library.make (the_libdir, build_libdir): New. Create these
directories on demand instead of worrying about keeping the list
of profiles uptodate.
* executable.make (prog_dir): Likewise.
2007-03-17 Marek Sieradzki <[email protected]>
* library.make: Show correct log (TestResult-ondotnet-PROFILE...) for
make run-test-ondotnet.
Fri Nov 24 18:38:31 CET 2006 Paolo Molaro <[email protected]>
* library.make: added ability to pass flags to the mono runtime when
running the test suite.
2006-09-06 Kornél Pál <[email protected]>
* TestConfiguration.cs: Moved to Npgsql.
2006-09-05 Kornél Pál <[email protected]>
* config-default.make: Use UTF-8 as the default encoding for compilers.
2006-09-04 Raja R Harinath <[email protected]>
* library.make (TEST_HARNESS_VERBOSE): New user toggle. If
defined, NUnit will print the names of the unit tests as they are
run. Can be used to narrow down infloops.
(TEST_HARNESS_EXCLUDE): Provide a way to override the list of
excluded unit test categories.
2006-04-11 Raja R Harinath <[email protected]>
* profiles/default.make (BOOTSTRAP_PROFILE): Define.
* profiles/net_2_0.make (BOOTSTRAP_PROFILE): Define.
* rules.make (INTERNAL_RESGEN): Pick from bootstrap profile.
2006-01-19 Raja R Harinath <[email protected]>
* library.make (test_lib): Don't allow to be overridden.
(test_against, test_dep): Remove.
2006-01-11 Gonzalo Paniagua Javier <[email protected]>
* executable.make: allow installing a different .config file for
executables such as nunit-console.exe that should use a different one
depending on the profile.
2006-01-05 Raja R Harinath <[email protected]>
* library.make (run-test-lib, run-test-ondotnet-lib): Workaround a
sed limitation when printing the testsuite log.
2005-12-22 Raja R Harinath <[email protected]>
* library.make (lib_dir): Define to 'compat' if LIBRARY_COMPAT is
defined, 'lib' otherwise.
(the_lib): Use it to decide where to place the output library.
(LIBRARY_PACKAGE): New define. Install development symlinks for
compat libraries in a different directory.
2005-12-03 Kornél Pál <[email protected]>
* config-default.make: Corrected default CODEPAGE comment to ISO-8859-1
(Latin 1).
2005-11-22 Vladislav Spivak <[email protected]>
* Missed dependency.
<profile>.sources file is supporting #include directive
Usually it includes common .sources file.
Let's make it dependency of <profile>.sources
2005-10-03 Raja R Harinath <[email protected]>
* profiles/basic.make (monolite_flag, use_monolite): New. Used to
+5 -14
View File
@@ -16,29 +16,20 @@ common/Consts.cs: common/Consts.cs.in $(wildcard config.make)
PLATFORMS = linux win32
PROFILES = \
basic \
net_1_1_bootstrap \
default \
net_2_0_bootstrap \
net_2_0 \
net_2_1_bootstrap \
net_2_1_raw \
net_2_1 \
net_1_0 \
net_3_5
basic net_1_1_bootstrap default net_2_0_bootstrap net_2_0 \
atomic net_1_0
COMMON_SRCS = \
Consts.cs.in \
Locale.cs \
MonoTODOAttribute.cs
MonoTODOAttribute.cs \
TestConfiguration.cs
DISTFILES = \
README.makefiles \
README.platforms \
README.configury \
config-default.make \
corcompare.make \
corcompare-api.xsl \
executable.make \
library.make \
rules.make \
@@ -46,4 +37,4 @@ DISTFILES = \
$(PLATFORMS:%=platforms/%.make) $(PROFILES:%=profiles/%.make)
dist-local: dist-default
$(MKINSTALLDIRS) $(distdir)/deps
-46
View File
@@ -1,49 +1,3 @@
2008-04-13 Jb Evain <[email protected]>
* Consts.cs.in: update the 2.1 profile versions.
Merged from the Moonlight 2 branch.
2008-04-09 Andreas Nahr <[email protected]>
* Consts.cs.in: Add common strings for assembly attributes
2007-12-31 Gert Driesen <[email protected]>
* Consts.cs.in: Add corlib assembly name.
2007-12-04 Marek Safar <[email protected]>
* Consts.cs.in: Update 3.5 to RTM version number.
2007-08-20 Marek Safar <[email protected]>
* Consts.cs.in: Add NET_3_5 constants.
2007-06-12 Marek Safar <[email protected]>
* Consts.cs.in: Add NET_2_1 constants.
2007-06-01 Atsushi Enomoto <[email protected]>
* MonoTODOAttribute.cs : fixed regression that those derived todo
attribute types are not reported in the class status pages.
2006-12-14 Eyal Alaluf <[email protected]>
* MonoTODOAttribute.cs: Add MonoDocumentationNoteAttribute,
MonoExtensionAttribute, MonoInternalNoteAttribute,
MonoLimitationAttribute and MonoNotSupportedAttribute. These
attribute will be used to describe the status of the Mono APIs.
2006-09-06 Kornél Pál <[email protected]>
* Makefile: Removed TestConfiguration.cs.
2006-06-07 Kornél Pál <[email protected]>
* Consts.cs.in: Removed RuntimeVersion as it should be the same as
FxFileVersion. Use FxFileVersion for Environment.Version.
2005-11-05 Kornél Pál <[email protected]>
* Consts.cs.in: Removed obsolete using System.Runtime.InteropServices.
+12 -25
View File
@@ -2,9 +2,9 @@
// Consts.cs.in
//
// Author:
// Kornél Pál <http://www.kornelpal.hu/>
// Kornél Pál <http://www.kornelpal.hu/>
//
// Copyright (C) 2005-2006 Kornél Pál
// Copyright (C) 2005 Kornél Pál
//
//
@@ -47,40 +47,28 @@ internal
//
public const string MonoVersion = "@MONO_VERSION@";
public const string MonoCompany = "MONO development team";
public const string MonoProduct = "MONO Common language infrastructure";
public const string MonoCopyright = "(c) various MONO Authors";
#if NET_3_5
// Versions of .NET Framework 3.5 RTM
public const string FxVersion = "3.5.0.0";
public const string FxFileVersion = "3.5.21022.8";
public const string VsVersion = "0.0.0.0"; // Useless ?
#elif NET_2_1
// Versions of .NET Framework for SilverLight
public const string FxVersion = "2.0.5.0";
public const string VsVersion = "9.0.0.0"; // TODO:
public const string FxFileVersion = "2.0.30226.2";
public const string VsFileVersion = "9.0.50727.42"; // TODO:
#elif NET_2_0 || BOOTSTRAP_NET_2_0
// Versions of .NET Framework 2.0 RTM
#if NET_2_0 || BOOTSTRAP_NET_2_0
// Environment.Version of .NET Framework 2.0 RTM
public const string RuntimeVersion = "2.0.50727.42";
public const string FxVersion = "2.0.0.0";
public const string VsVersion = "8.0.0.0";
public const string FxFileVersion = "2.0.50727.42";
public const string VsFileVersion = "8.0.50727.42";
#elif NET_1_1
// Versions of .NET Framework 1.1 SP1
#elif NET_1_1 || TARGET_JVM
// Environment.Version of .NET Framework 1.1 SP1
public const string RuntimeVersion = "1.1.4322.2032";
public const string FxVersion = "1.0.5000.0";
public const string VsVersion = "7.0.5000.0";
public const string FxFileVersion = "1.1.4322.2032";
public const string VsFileVersion = "7.10.6001.4";
public const string VsFileVersion = "7.10.3052.4";
#elif NET_1_0
// Versions of .NET Framework 1.0 SP3
// Environment.Version of .NET Framework 1.0 SP3
public const string RuntimeVersion = "1.0.3705.6018";
public const string FxVersion = "1.0.3300.0";
public const string VsVersion = "7.0.3300.0";
public const string FxFileVersion = "1.0.3705.6018";
public const string VsFileVersion = "7.0.9951.0";
public const string VsFileVersion = "7.0.9466.0";
#else
#error No profile symbols defined.
#endif
@@ -98,7 +86,6 @@ internal
public const string AssemblyMono_Http = "Mono.Http, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=0738eb9f132ed756";
public const string AssemblyMono_Posix = "Mono.Posix, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=0738eb9f132ed756";
public const string AssemblyMono_Security = "Mono.Security, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=0738eb9f132ed756";
public const string AssemblyCorlib = "mscorlib, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b77a5c561934e089";
public const string AssemblySystem = "System, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b77a5c561934e089";
public const string AssemblySystem_Data = "System.Data, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b77a5c561934e089";
public const string AssemblySystem_Design = "System.Design, Version=" + FxVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
+3 -70
View File
@@ -1,16 +1,14 @@
//
// MonoTODOAttribute.cs
//
// Authors:
// Author:
// Ravi Pratap ([email protected])
// Eyal Alaluf <[email protected]>
//
// (C) Ximian, Inc. http://www.ximian.com
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
// Copyright (C) 2006 Mainsoft, Inc (http://www.mainsoft.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -35,7 +33,7 @@
namespace System {
[AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
internal class MonoTODOAttribute : Attribute {
internal sealed class MonoTODOAttribute : Attribute {
string comment;
@@ -48,73 +46,8 @@ namespace System {
this.comment = comment;
}
public virtual string Comment {
public string Comment {
get { return comment; }
}
}
[AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
internal class MonoDocumentationNoteAttribute : MonoTODOAttribute {
public MonoDocumentationNoteAttribute (string comment)
: base (comment)
{
}
public override string Comment {
get { return base.Comment; }
}
}
[AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
internal class MonoExtensionAttribute : MonoTODOAttribute {
public MonoExtensionAttribute (string comment)
: base (comment)
{
}
public override string Comment {
get { return base.Comment; }
}
}
[AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
internal class MonoInternalNoteAttribute : MonoTODOAttribute {
public MonoInternalNoteAttribute (string comment)
: base (comment)
{
}
public override string Comment {
get { return base.Comment; }
}
}
[AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
internal class MonoLimitationAttribute : MonoTODOAttribute {
public MonoLimitationAttribute (string comment)
: base (comment)
{
}
public override string Comment {
get { return base.Comment; }
}
}
[AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
internal class MonoNotSupportedAttribute : MonoTODOAttribute {
public MonoNotSupportedAttribute (string comment)
: base (comment)
{
}
public override string Comment {
get { return base.Comment; }
}
}
}
@@ -31,7 +31,7 @@ using NUnit.Framework;
using NUnit.Core;
namespace NpgsqlTests {
namespace System {
class TestConfiguration {
public static string NpgsqlConnectionString {
get {
+2 -3
View File
@@ -6,8 +6,8 @@
# DO NOT EDIT THIS FILE! Create config.make and override settings
# there.
# Use UTF-8 as the default encoding for compilers
CODEPAGE = 65001
# Use ISO-28591 as the default encoding for compilers
CODEPAGE = 28591
RUNTIME_FLAGS =
TEST_HARNESS = $(topdir)/class/lib/$(PROFILE)/nunit-console.exe
@@ -18,7 +18,6 @@ CFLAGS = -g -O2
prefix = /usr/local
exec_prefix = $(prefix)
mono_libdir = $(exec_prefix)/lib
sysconfdir = $(prefix)/etc
#RUNTIME = mono
RUNTIME = false
TEST_RUNTIME = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) --debug
-568
View File
@@ -1,568 +0,0 @@
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name="source-name" select="(fillme)" />
<xsl:output method="html" indent="no"/>
<!-- <xsl:output method="xml"/>-->
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:variable name="assembly-name" select="substring-before ($source-name, '.src')" />
<html>
<head>
<title>
Mono Class Library Status for <xsl:value-of select="$assembly-name" />
</title>
<script src="cm/cormissing.js"></script>
<link rel="stylesheet" type="text/css" href="cm/cormissing.css"></link>
<style type="text/css"><![CDATA[
div.links {
background-color: #CCFFCC;
}
div.links ul li {
display: inline;
padding: 5px;
}
]]></style>
</head>
<body>
<div class="links">
<ul>
<li><a href="System.Runtime.Serialization.html">Runtime.Serialization</a></li>
<li><a href="System.IdentityModel.html">IdentityModel</a></li>
<li><a href="System.IdentityModel.Selectors.html">IdentityModel.Selectors</a></li>
<li><a href="System.ServiceModel.html">ServiceModel</a></li>
</ul>
</div>
<div class="main">
<p>
<h1>Mono Class Library Status for <xsl:value-of select="$assembly-name" /></h1>
</p>
<p>
<table>
<tr>
<td> <input type="checkbox" ID="todo" onClick="selectTodo();" checked="1"/> </td>
<td> <img src="cm/st.gif"/> </td>
<td> TODO </td>
<td width="20"/>
<td> <input type="checkbox" ID="missing" onClick="selectMissing();" checked="1"/> </td>
<td> <img src="cm/sm.gif"/> </td>
<td> Missing </td>
</tr>
<tr>
<td> <input type="checkbox" ID="extra" onClick="selectExtra();" checked="1"/> </td>
<td> <img src="cm/sx.gif"/> </td>
<td> Extra </td>
<td width="20"/>
<td> <input type="checkbox" ID="errors" onClick="selectErrors();" checked="1"/> </td>
<td> <img src="cm/se.gif"/> </td>
<td> Errors </td>
</tr>
<tr>
<td> </td>
<td> <img src="cm/sc.gif"/> </td>
<td> Completed </td>
</tr>
</table>
</p>
<p>
<select id="FilteredAttributes">
<option>System.Runtime.InteropServices.ComVisibleAttribute</option>
<option>System.Diagnostics.DebuggerDisplayAttribute</option>
<option>System.Diagnostics.DebuggerTypeProxyAttribute</option>
</select>
<input type="button" onclick="removeAndFilter()" value="Unfilter attribute" />
</p>
<p>
<input type="text" id="NewFilterTarget" length="60" />
<input type="button" onclick="addAndFilter()" value="Add to attribute filter" />
</p>
<p>Target Reference:
<input type="radio" id="TargetMonodoc" name="TargetDoc" value="0" />monodoc
<input type="radio" id="TargetMsdn1" name="TargetDoc" value="1" />msdn
<input type="radio" id="TargetMsdn2" name="TargetDoc" value="2" checked="checked" />msdn2
<input type="radio" id="TargetWinsdk" name="TargetDoc" value="3" checked="checked" />Windows SDK
</p>
<DIV ID="ROOT">
<xsl:apply-templates/>
</DIV>
<p>
Legend :<BR/>
<table>
<tr>
<td> <img src="cm/y.gif"/> </td>
<td> Assembly </td>
<td width="20"/>
<td> <img src="cm/n.gif"/> </td>
<td> Namespace </td>
<td width="20"/>
<td> <img src="cm/c.gif"/> </td>
<td> Class </td>
<td width="20"/>
<td> <img src="cm/s.gif"/> </td>
<td> Struct </td>
<tr>
</tr>
<td> <img src="cm/i.gif"/> </td>
<td> Interface </td>
<td width="20"/>
<td> <img src="cm/d.gif"/> </td>
<td> Delegate </td>
<td width="20"/>
<td> <img src="cm/en.gif"/> </td>
<td> Enum </td>
<td width="20"/>
<td> <img src="cm/m.gif"/> </td>
<td> Method </td>
</tr>
<tr>
<td> <img src="cm/f.gif"/> </td>
<td> Field </td>
<td width="20"/>
<td> <img src="cm/p.gif"/> </td>
<td> Property </td>
<td width="20"/>
<td> <img src="cm/e.gif"/> </td>
<td> Event </td>
<td width="20"/>
<td> <img src="cm/r.gif"/> </td>
<td> Attribute </td>
</tr>
<tr>
<td> <img src="cm/w.gif" /> </td>
<td colspan="10"> Generic Constraints</td>
</tr>
</table>
</p>
</div>
</body>
</html>
</xsl:template>
<!-- assembly -->
<xsl:template match="/assemblies">
<xsl:apply-templates select="assembly">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="assembly">
<DIV>
<xsl:call-template name="ELEMENT">
<xsl:with-param name="class">y</xsl:with-param>
</xsl:call-template>
<xsl:if test="not(@presence)">
<xsl:apply-templates/>
</xsl:if>
</DIV>
</xsl:template>
<!-- namespace -->
<xsl:template match="namespaces">
<xsl:apply-templates select="namespace">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="namespace">
<DIV>
<xsl:call-template name="ELEMENT">
<xsl:with-param name="class">n</xsl:with-param>
</xsl:call-template>
<xsl:if test="not(@presence)">
<xsl:apply-templates/>
</xsl:if>
</DIV>
</xsl:template>
<xsl:template match="namespace/classes">
<xsl:apply-templates select="class[@type='interface']">
<xsl:sort select="@name"/>
</xsl:apply-templates>
<xsl:apply-templates select="class[@type='class']">
<xsl:sort select="@name"/>
</xsl:apply-templates>
<xsl:apply-templates select="class[@type='struct']">
<xsl:sort select="@name"/>
</xsl:apply-templates>
<xsl:apply-templates select="class[@type='delegate']">
<xsl:sort select="@name"/>
</xsl:apply-templates>
<xsl:apply-templates select="class[@type='enum']">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:template>
<!-- class -->
<xsl:template match="class[@type='class']">
<DIV>
<xsl:call-template name="ELEMENT">
<xsl:with-param name="class">c</xsl:with-param>
</xsl:call-template>
<xsl:if test="(@missing_total or @todo_total or @extra_total or @warning_total or @error) and not(@presence)">
<xsl:apply-templates select="attributes"/>
<xsl:apply-templates select="interfaces"/>
<xsl:apply-templates select="constructors"/>
<xsl:apply-templates select="./*[local-name() != 'attributes' and local-name() != 'constructors' and local-name() != 'interfaces']"/>
</xsl:if>
</DIV>
</xsl:template>
<!-- struct -->
<xsl:template match="class[@type='struct'][@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
<DIV>
<xsl:call-template name="ELEMENT">
<xsl:with-param name="class">s</xsl:with-param>
</xsl:call-template>
<xsl:if test="not(@presence)">
<xsl:apply-templates/>
</xsl:if>
</DIV>
</xsl:template>
<!-- interface types -->
<xsl:template match="class[@type='interface']">
<xsl:apply-templates select="class[@type='interface']">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="class[@type='interface'][@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
<DIV>
<xsl:call-template name="ELEMENT">
<xsl:with-param name="class">i</xsl:with-param>
</xsl:call-template>
<xsl:if test="not(@presence)">
<xsl:apply-templates/>
</xsl:if>
</DIV>
</xsl:template>
<!-- interfaces implemented by Types -->
<xsl:template match="interface">
<xsl:apply-templates select="interface">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="interface[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
<DIV>
<xsl:call-template name="ELEMENT">
<xsl:with-param name="class">i</xsl:with-param>
</xsl:call-template>
<xsl:if test="not(@presence)">
<xsl:apply-templates/>
</xsl:if>
</DIV>
</xsl:template>
<!-- generic constraints -->
<xsl:template match="generic-type-constraints">
<xsl:apply-templates select="generic-type-constraint">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="generic-type-constraint[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
<DIV>
<xsl:call-template name="ELEMENT">
<xsl:with-param name="class">w</xsl:with-param>
</xsl:call-template>
<xsl:if test="not(@presence)">
<xsl:apply-templates/>
</xsl:if>
</DIV>
</xsl:template>
<!-- delegate -->
<xsl:template match="class[@type='delegate'][@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
<DIV>
<xsl:call-template name="ELEMENT">
<xsl:with-param name="class">d</xsl:with-param>
</xsl:call-template>
<xsl:if test="not(@presence)">
<xsl:apply-templates/>
</xsl:if>
</DIV>
</xsl:template>
<!-- enumeration -->
<xsl:template match="class[@type='enum'][@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
<DIV>
<xsl:call-template name="ELEMENT">
<xsl:with-param name="class">en</xsl:with-param>
</xsl:call-template>
<xsl:if test="not(@presence)">
<xsl:apply-templates/>
</xsl:if>
</DIV>
</xsl:template>
<!-- method -->
<xsl:template match="methods">
<xsl:apply-templates select="method">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="method[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
<DIV>
<xsl:call-template name="ELEMENT">
<xsl:with-param name="class">m</xsl:with-param>
</xsl:call-template>
<xsl:if test="not(@presence)">
<xsl:apply-templates/>
</xsl:if>
</DIV>
</xsl:template>
<!-- property -->
<xsl:template match="properties">
<xsl:apply-templates select="property">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="property[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
<DIV>
<xsl:call-template name="ELEMENT">
<xsl:with-param name="class">p</xsl:with-param>
</xsl:call-template>
<xsl:if test="not(@presence)">
<xsl:apply-templates/>
</xsl:if>
</DIV>
</xsl:template>
<!-- event -->
<xsl:template match="events">
<xsl:apply-templates select="event">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="event[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
<DIV>
<xsl:call-template name="ELEMENT">
<xsl:with-param name="class">e</xsl:with-param>
</xsl:call-template>
<xsl:if test="not(@presence)">
<xsl:apply-templates/>
</xsl:if>
</DIV>
</xsl:template>
<!-- constructor -->
<xsl:template match="constructors">
<xsl:apply-templates select="constructor">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="constructor[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
<DIV>
<xsl:call-template name="ELEMENT">
<xsl:with-param name="class">x</xsl:with-param>
<xsl:with-param name="image">m</xsl:with-param>
</xsl:call-template>
<xsl:if test="not(@presence)">
<xsl:apply-templates/>
</xsl:if>
</DIV>
</xsl:template>
<!-- field -->
<xsl:template match="fields">
<xsl:apply-templates select="field">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="field[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
<DIV>
<xsl:call-template name="ELEMENT">
<xsl:with-param name="class">f</xsl:with-param>
</xsl:call-template>
<xsl:if test="not(@presence)">
<xsl:apply-templates/>
</xsl:if>
</DIV>
</xsl:template>
<!-- accessor -->
<xsl:template match="property/methods">
<xsl:apply-templates select="method">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="property[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]/methods/method[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
<DIV>
<xsl:call-template name="ELEMENT">
<xsl:with-param name="class">o</xsl:with-param>
<xsl:with-param name="image">m</xsl:with-param>
</xsl:call-template>
<xsl:if test="not(@presence)">
<xsl:apply-templates/>
</xsl:if>
</DIV>
</xsl:template>
<!-- attribute -->
<xsl:template match="attributes">
<xsl:apply-templates select="attribute">
<xsl:sort select="@name"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="attribute[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
<DIV>
<xsl:call-template name="ELEMENT">
<xsl:with-param name="class">r</xsl:with-param>
</xsl:call-template>
<xsl:if test="not(@presence)">
<xsl:apply-templates/>
</xsl:if>
</DIV>
</xsl:template>
<!-- support templates -->
<xsl:template name="ELEMENT">
<xsl:param name="class"/>
<xsl:param name="image"/>
<xsl:attribute name="class">
<xsl:value-of select="$class"/>
<xsl:if test="./node() and local-name() != 'assembly'">_</xsl:if>
</xsl:attribute>
<xsl:call-template name="toggle"/>
<xsl:choose>
<xsl:when test="@error and @error != 'todo'">
<xsl:element name="img">
<xsl:attribute name="src">cm/se.gif</xsl:attribute>
<xsl:attribute name="class">t</xsl:attribute>
<xsl:attribute name="title"><xsl:call-template name="warning-hover" /></xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:when test="@error = 'todo'">
<xsl:element name="img">
<xsl:attribute name="src">cm/st.gif</xsl:attribute>
<xsl:attribute name="class">t</xsl:attribute>
<xsl:if test="@comment">
<xsl:attribute name="title"><xsl:value-of select="@comment"/></xsl:attribute>
</xsl:if>
<xsl:if test="not(@comment)">
<xsl:attribute name="title">No TODO description</xsl:attribute>
</xsl:if>
</xsl:element>
</xsl:when>
<xsl:when test="@presence = 'missing'">
<img src="cm/sm.gif" class="t"/>
</xsl:when>
<xsl:when test="@presence = 'extra'">
<img src="cm/sx.gif" class="t"/>
</xsl:when>
<xsl:otherwise>
<img src="cm/sc.gif" class="t"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$image">
<img src="cm/{$image}.gif" class="t"/>
</xsl:when>
<xsl:otherwise>
<img src="cm/{$class}.gif" class="t"/>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="name"/>
<xsl:if test="not(@presence)">
<xsl:call-template name="status"/>
</xsl:if>
</xsl:template>
<xsl:template name="status">
<xsl:if test="@complete_total and @complete_total != 0">
<SPAN class="st">
<img src="cm/sc.gif"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="@complete_total"/>
<xsl:text>%</xsl:text>
</SPAN>
</xsl:if>
<xsl:if test="@todo_total">
<SPAN class="st">
<img src="cm/st.gif"/>: <xsl:value-of select="@todo_total"/>
</SPAN>
</xsl:if>
<xsl:if test="@missing_total">
<SPAN class="st">
<img src="cm/sm.gif"/>: <xsl:value-of select="@missing_total"/>
</SPAN>
</xsl:if>
<xsl:if test="@extra_total">
<SPAN class="st">
<img src="cm/sx.gif"/>: <xsl:value-of select="@extra_total"/>
</SPAN>
</xsl:if>
<xsl:if test="@warning_total">
<SPAN class="st">
<img src="cm/se.gif"/>: <xsl:value-of select="@warning_total"/>
</SPAN>
</xsl:if>
</xsl:template>
<xsl:template name="toggle">
<xsl:choose>
<xsl:when test="not(@presence) and .//*[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
<xsl:choose>
<xsl:when test="local-name() != 'assembly'">
<img src="cm/tp.gif" class="t"/>
</xsl:when>
<xsl:otherwise>
<img src="cm/tm.gif" class="t"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<img src="cm/tb.gif"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="name">
<xsl:if test="@name">
<SPAN class="l"><xsl:value-of select="@name"/></SPAN>
</xsl:if>
</xsl:template>
<xsl:template name="warning-hover">
<xsl:for-each select="warnings/warning">
<xsl:text>WARNING: </xsl:text>
<xsl:value-of select="@text"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
-25
View File
@@ -1,25 +0,0 @@
API_INFO = $(MONO_PATH) $(RUNTIME) $(topdir)/class/lib/$(PROFILE)/mono-api-info.exe
API_DIFF = $(MONO_PATH) $(RUNTIME) $(topdir)/tools/corcompare/mono-api-diff.exe
TRANSFORM = $(MONO_PATH) $(RUNTIME) $(topdir)/tools/corcompare/transform.exe
OBJECTS = $(topdir)/build/corcompare/$(LIBRARY_NAME:.dll=.html)
corcompare: $(OBJECTS)
$(OBJECTS): $(patsubst $(topdir)/build/corcompare/%.html,%.src, $(OBJECTS))
.PRECIOUS: $(topdir)/build/corcompare/%.html
$(topdir)/build/corcompare/%.html: %.src
$(TRANSFORM) $< $(topdir)/build/corcompare-api.xsl source-name=$(notdir $<) > $@
.PRECIOUS: %.src
%.src: %.xml
$(API_DIFF) masterinfos/$(PROFILE)/$(notdir $<) $< > $@ || (rm -rf $@ && exit 1)
.PRECIOUS: %.xml
%.xml: $(topdir)/class/lib/$(PROFILE)/%.dll
$(API_INFO) $< > $@ || (rm -f $@ && exit 1)
CLEAN_FILES += $(topdir)/build/corcompare/$(LIBRARY_NAME:.dll=.html) $(LIBRARY_NAME:.dll=.src) $(LIBRARY_NAME:.dll=.xmlsrc)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

-199
View File
@@ -1,199 +0,0 @@
.y IMG
{
border: 0px;
padding: 0px;
margin: 0px;
margin-right: 4px;
vertical-align: middle;
}
.y, .y_,
.n, .n_,
.c, .c_,
.c, .c_,
.d, .d_,
.en, .en_,
.i, .i_,
.s, .s_,
.e, .e_,
.f, .f_,
.m, .m_,
.o, .o_,
.p, .p_,
.r, .r_,
.x, .x_,
.w, .w_
{
FONT: 10px 'Verdana';
margin-left: 20px;
}
.y_ .n,
.y_ .n_,
.n_ .c,
.n_ .c_,
.n_ .s,
.n_ .s_,
.n_ .d,
.n_ .d_,
.n_ .en,
.n_ .en_,
.n_ .i,
.n_ .i_,
.c_ .c,
.c_ .c_,
.c_ .e,
.c_ .e_,
.c_ .f,
.c_ .f_,
.c_ .m,
.c_ .m_,
.c_ .o,
.c_ .o_,
.c_ .p,
.c_ .p_,
.c_ .r,
.c_ .r_,
.c_ .x,
.c_ .x_,
.c_ .i,
.c_ .i_,
.c_ .w,
.c_ .w_,
.d_ .c,
.d_ .c_,
.d_ .e,
.d_ .e_,
.d_ .f,
.d_ .f_,
.d_ .m,
.d_ .m_,
.d_ .o,
.d_ .o_,
.d_ .p,
.d_ .p_,
.d_ .r,
.d_ .r_,
.d_ .x,
.d_ .x_,
.d_ .w,
.d_ .w_,
.en_ .c,
.en_ .c_,
.en_ .e,
.en_ .e_,
.en_ .f,
.en_ .f_,
.en_ .m,
.en_ .m_,
.en_ .o,
.en_ .o_,
.en_ .p,
.en_ .p_,
.en_ .r,
.en_ .r_,
.en_ .x,
.en_ .x_,
.en_ .w,
.en_ .w_,
.i_ .c,
.i_ .c_,
.i_ .e,
.i_ .e_,
.i_ .f,
.i_ .f_,
.i_ .m,
.i_ .m_,
.i_ .o,
.i_ .o_,
.i_ .p,
.i_ .p_,
.i_ .r,
.i_ .r_,
.i_ .x,
.i_ .x_,
.i_ .w,
.i_ .w_,
.i_ .i,
.i_ .i_,
.s_ .c,
.s_ .c_,
.s_ .e,
.s_ .e_,
.s_ .f,
.s_ .f_,
.s_ .m,
.s_ .m_,
.s_ .o,
.s_ .o_,
.s_ .p,
.s_ .p_,
.s_ .r,
.s_ .r_,
.s_ .s,
.s_ .s_,
.s_ .x,
.s_ .x_,
.s_ .i,
.s_ .i_,
.s_ .w,
.s_ .w_,
.e_ .r,
.e_ .r_,
.e_ .o,
.e_ .o_,
.f_ .r,
.f_ .r_,
.f_ .o,
.f_ .o_,
.m_ .r,
.m_ .r_,
.m_ .o,
.m_ .o_,
.o_ .r,
.o_ .r_,
.o_ .o,
.o_ .o_,
.p_ .r,
.p_ .r_,
.p_ .o,
.p_ .o_,
.r_ .r,
.r_ .r_,
.r_ .o,
.r_ .o_,
.x_ .r,
.x_ .r_,
.x_ .o,
.x_ .o_
.w_ .r,
.w_ .r_,
.w_ .o,
.w_ .o_
{
display: none;
}
.t
{
cursor: pointer;
margin-right: 8px;
}
.filter
{
cursor: pointer;
vertical-align: middle;
}
.st
{
margin-left: 20px;
}
.l
{
cursor: pointer;
}
-593
View File
@@ -1,593 +0,0 @@
// FIXME:
// It still does not update icons previous to a type/member name when
// certain icon kinds are unchecked (when an item has "todo" and "missing",
// the default display is "missing" and when "missing" is unchecked it
// should turn into "todo").
function toggle (elt)
{
if (elt == null)
return;
var eltLink = firstElement (elt);
if (eltLink != null && eltLink.className == 't') // toggle
{
var ich = elt.className.indexOf ('_');
if (ich < 0)
{
eltLink.src = 'cm/tp.gif';
elt.className += '_';
}
else
{
eltLink.src = 'cm/tm.gif';
elt.className = elt.className.slice (0, ich);
}
}
}
function setView (elt, fView)
{
var eltLink = firstElement (elt);
if (eltLink != null && eltLink.className == 't') // toggle
{
var ich = elt.className.indexOf ('_');
if (ich < 0 && !fView)
{
eltLink.src = 'cm/tp.gif';
elt.className += '_';
}
else if (ich >= 0 && fView)
{
eltLink.src = 'cm/tm.gif';
elt.className = elt.className.slice (0, ich);
}
}
}
function firstElement (elt)
{
var c = elt.firstChild;
while (c != null) {
if (c.nodeType == 1) // Node.ELEMENT_NODE (IE6 does not recognize it)
return c;
c = c.nextSibling;
}
return null;
}
function trimSrc (strSrc)
{
return strSrc.slice (strSrc.lastIndexOf ('/') + 1, strSrc.lastIndexOf ('.'));
}
function getChildrenByTagName (elt, strTag)
{
strTag = strTag.toLowerCase ();
var rgChildren = new Array ();
var eltChild = firstElement (elt);
while (eltChild)
{
if (eltChild.tagName && eltChild.tagName.toLowerCase () == strTag)
rgChildren.push (eltChild);
eltChild = eltChild.nextSibling;
}
return rgChildren;
}
function viewAll (elt, dictTypes, attrFilters)
{
var fView = isShown (elt, dictTypes, attrFilters);
var aCounts = new Array (4);
for (i = 0; i < 4; i++)
aCounts [i] = 0;
var rgElts = getChildrenByTagName (elt, 'DIV');
for (iElt in rgElts) {
var aChildRet = viewAll (rgElts [iElt], dictTypes, attrFilters);
if (aChildRet != null) {
fView = true;
for (i = 0; i < 4; i++)
aCounts [i] += aChildRet [i];
}
}
elt.style.display = fView ? '' : 'none';
if (!fView)
return null;
rgShownDivs = getChildrenByTagName (elt, 'DIV');
for (i = 0; i < rgShownDivs.length; i++) {
var cDiv = rgShownDivs [i];
if (cDiv.style.display == 'none')
continue;
incrementCount (cDiv, aCounts, dictTypes);
}
// update the numbers
rgSpans = getChildrenByTagName (elt, 'SPAN');
for (iSpan in rgSpans) {
var cSpan = rgSpans [iSpan];
var cImage = firstElement (cSpan);
if (cImage == null)
continue;
switch (trimSrc (cImage.src)) {
case 'st': cSpan.lastChild.nodeValue = ": " + aCounts [0]; break;
case 'sm': cSpan.lastChild.nodeValue = ": " + aCounts [1]; break;
case 'sx': cSpan.lastChild.nodeValue = ": " + aCounts [2]; break;
case 'se': cSpan.lastChild.nodeValue = ": " + aCounts [3]; break;
}
}
return aCounts;
}
function isShown (elt, dictTypes, attrFilters)
{
if (!isShownMarkType (elt, dictTypes))
return false;
// Check attributes that are being filtered out.
var rgSpans = getChildrenByTagName (elt, 'SPAN');
var cSpans = rgSpans.length;
for (var iSpan = 0; iSpan < cSpans; iSpan++)
{
var strSpan = rgSpans [iSpan].firstChild.nodeValue;
for (strzzz in attrFilters)
if (strSpan == strzzz)
return false;
}
return true;
}
function isShownMarkType (elt, dictTypes)
{
var rgImages = getChildrenByTagName (elt, 'IMG');
var cImages = rgImages.length;
for (var iImage = 0; iImage < cImages; iImage++)
{
var strImage = trimSrc (rgImages [iImage].src);
if (dictTypes [strImage])
return true;
}
return false;
}
function incrementCount (cDiv, aCounts, dictTypes)
{
switch (cDiv.className) {
case 'y': case 'y_': // assembly
case 'n': case 'n_': // namespace
// types
case 'c': case 'c_': case 'i': case 'i_':
case 'en': case 'en_': case 'd': case 'd_':
// members
case 'r': case 'r_': case 'x': case 'x_': case 'm': case 'm_':
case 'f': case 'f_': case 'e': case 'e_': case 'p': case 'p_':
case 'o': case 'o_':
var rgImgs = getChildrenByTagName (cDiv, 'IMG');
for (iImg = 0; iImg < rgImgs.length; iImg++) {
var cImg = rgImgs [iImg];
if (cImg.className != 't')
continue;
var stype = trimSrc (cImg.src);
if (!dictTypes [stype])
continue;
switch (stype) {
case "st": aCounts [0]++; break;
case "sm": aCounts [1]++; break;
case "sx": aCounts [2]++; break;
case "se": aCounts [3]++; break;
default:
continue;
}
break;
}
break;
}
}
/* just for debugging use now.
function firstInnerText (elt)
{
var s = elt.innerText;
if (s != null)
return s;
var n = elt.firstChild;
while (n != null) {
s = n.nodeValue;
if (s != null && s.replace (/^\s+/g, '') != '')
return s;
s = firstInnerText (n);
if (s != null)
return s;
n = n.nextSibling;
}
return s;
}
*/
function getView (elt)
{
var eltLink = firstElement (elt);
if (eltLink != null && eltLink.className == 't') // toggle
{
var ich = elt.className.indexOf ('_');
if (ich < 0)
return true;
}
return false;
}
function getParentDiv (elt)
{
if (elt)
{
do
{
elt = elt.parentNode;
}
while (elt && elt.tagName != 'DIV');
}
return elt;
}
function getName (elt)
{
var rgSpans = getChildrenByTagName (elt, 'SPAN');
for (var iSpan = 0; iSpan < rgSpans.length; iSpan ++)
{
var span = rgSpans [iSpan];
if (span.className == 'l') // label
{
if (span.innerText)
return span.innerText;
else
return span.firstChild.nodeValue;
}
}
return null;
}
function clickHandler (evt)
{
var elt;
if (document.layers)
elt = evt.taget;
else if (window.event && window.event.srcElement)
{
elt = window.event.srcElement;
evt = window.event;
}
else if (evt && evt.stopPropagation)
elt = evt.target;
if (!elt.className && elt.parentNode)
elt = elt.parentNode;
if (elt.className == 'l') // label
{
var strClass;
var strField;
var strNamespace;
var strAssembly;
var strFieldType;
elt = getParentDiv (elt);
var strEltClass = elt.className;
if (strEltClass.charAt (strEltClass.length - 1) == '_')
strEltClass = strEltClass.slice (0, strEltClass.length - 1);
if (strEltClass == 'x') // constructor
{
strField = 'ctor';
elt = getParentDiv (elt);
}
else
if (strEltClass == 'm' || // method
strEltClass == 'p' || // property
strEltClass == 'e' || // event
strEltClass == 'f') // field
{
strFieldType = strEltClass;
strField = getName (elt);
var match = strField.match ( /[\.A-Z0-9_]*/i );
if (match)
strField = match [0];
elt = getParentDiv (elt);
}
var strEltClass = elt.className;
if (strEltClass.charAt (strEltClass.length - 1) == '_')
strEltClass = strEltClass.slice (0, strEltClass.length - 1);
if (strEltClass == 'c' || // class
strEltClass == 's' || // struct
strEltClass == 'i' || // struct
strEltClass == 'd' || // delegate
strEltClass == 'en') // enum
{
strClass = getName (elt);
if (strEltClass == 'en')
strField = null;
elt = getParentDiv (elt);
}
var strEltClass = elt.className;
if (strEltClass.charAt (strEltClass.length - 1) == '_')
strEltClass = strEltClass.slice (0, strEltClass.length - 1);
if (strEltClass == 'n')
{
strNamespace = getName (elt);
elt = getParentDiv (elt);
}
var strEltClass = elt.className;
if (strEltClass.charAt (strEltClass.length - 1) == '_')
strEltClass = strEltClass.slice (0, strEltClass.length - 1);
if (strEltClass == 'y')
{
strAssembly = getName (elt);
}
if (evt.ctrlKey)
{
var strRoot = 'http://anonsvn.mono-project.com/viewcvs/trunk/mcs/class/';
var strExtra = '';
if (strAssembly)
{
if (strAssembly == 'mscorlib')
strAssembly = 'corlib';
else if (strAssembly == 'System.Xml')
strAssembly = 'System.XML';
strRoot = strRoot + strAssembly + '/';
if (strNamespace)
{
strRoot = strRoot + strNamespace + '/';
if (strClass)
{
strRoot += strClass + '.cs';
strExtra += '?view=markup';
}
}
window.open (strRoot + strExtra, 'CVS');
}
}
else if (strNamespace)
{
if (document.getElementById ('TargetMsdn1').checked)
{
var re = /\./g ;
strNamespace = strNamespace.toLowerCase ().replace (re, '');
if (strClass)
strNamespace += strClass.toLowerCase () + 'class';
if (strField)
strNamespace += strField;
if (strClass || strField)
strNamespace += 'topic';
window.open ('http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrf' + strNamespace + '.asp', 'MSDN');
}
else
{
if (strClass)
strNamespace += '.' + strClass;
if (strField)
strNamespace += '.' + strField;
if (document.getElementById ('TargetMonodoc').checked)
{
var category = null;
if (strClass == null)
category = "N:";
else if (strField == null)
category = "T:";
else {
switch (strFieldType) {
case 'f': category = "F:"; break;
case 'p': category = "P:"; break;
case 'm': category = "M:"; break;
case 'e': category = "E:"; break;
}
}
if (category != null)
window.open ('http://www.go-mono.com/docs/monodoc.ashx?link=' + category + strNamespace);
}
else
{
window.open ('http://msdn2.microsoft.com/library/' + strNamespace + '.aspx', 'MSDN');
}
}
}
}
else
{
if (elt.parentNode && elt.parentNode.className == 't') // toggle
elt = elt.parentNode;
else if (elt.className != 't') // toggle
return;
while (elt != null && elt.tagName != 'DIV')
elt = elt.parentNode;
if (evt.shiftKey)
{
var rgElts = getChildrenByTagName (elt, 'DIV');
var cElts = rgElts.length;
if (cElts != 0)
{
var fView = false;
var iElt;
for (iElt = 0; iElt < cElts; iElt ++)
{
if (getView (rgElts [iElt]))
{
fView = true;
break;
}
}
for (iElt = 0; iElt < cElts; iElt ++)
{
setView (rgElts [iElt], !fView);
}
}
}
else if (evt.ctrlKey)
{
setView (elt, true);
var eltParent = getParentDiv (elt);
while (eltParent)
{
var rgSiblings = getChildrenByTagName (eltParent, 'DIV');
var cSiblings = rgSiblings.length;
for (var iSibling = 0; iSibling < cSiblings; iSibling++)
{
var eltSibling = rgSiblings [iSibling];
if (eltSibling != elt)
{
setView (eltSibling, false);
}
}
elt = eltParent;
eltParent = getParentDiv (elt);
}
}
else
toggle (elt);
}
return false;
}
function filterTree ()
{
var eltMissing = document.getElementById ('missing');
var eltTodo = document.getElementById ('todo');
var eltExtra = document.getElementById ('extra');
var eltErrors = document.getElementById ('errors');
var eltComVisible = document.getElementById ('ComVisible');
var eltDebuggerDisplay = document.getElementById ('DebuggerDisplay');
var dictTypes = new Object ();
if (eltMissing.checked)
dictTypes ['sm'] = true;
if (eltTodo.checked)
dictTypes ['st'] = true;
if (eltErrors.checked)
dictTypes ['se'] = true;
if (eltExtra.checked)
dictTypes ['sx'] = true;
// dictTypes ['sc'] = true;
var attrFilters = new Object ();
var rgOptions = getChildrenByTagName (document.getElementById ('FilteredAttributes'), "option");
for (i = 0; i < rgOptions.length; i++)
attrFilters [rgOptions [i].firstChild.nodeValue.replace (/\s+/g, '')] = true;
viewAll (document.getElementById ('ROOT'), dictTypes, attrFilters);
}
function addAndFilter ()
{
var newInput = document.getElementById ('NewFilterTarget');
var newAttr = newInput.value;
if (newAttr.length > 0) {
var selection = document.getElementById ('FilteredAttributes');
var newElem = document.createElement ('option');
newElem.appendChild (document.createTextNode (newAttr));
selection.appendChild (newElem);
newInput.value = '';
filterTree ();
}
}
function removeAndFilter ()
{
var selection = document.getElementById ('FilteredAttributes');
if (selection.selectedIndex >= 0) {
var newInput = document.getElementById ('NewFilterTarget');
if (newInput.value.length == 0)
newInput.value = selection.options [selection.selectedIndex].firstChild.nodeValue;
selection.removeChild (selection.options [selection.selectedIndex]);
filterTree ();
}
}
function selectMissing ()
{
toggleFilter ('missing');
}
function selectTodo ()
{
toggleFilter ('todo');
}
function selectExtra ()
{
toggleFilter ('extra');
}
function selectErrors ()
{
toggleFilter ('errors');
}
function toggleAttributeFilter (attrName)
{
toggleFilter (attrName);
}
function toggleFilter (strFilter)
{
var eltTodo = document.getElementById ('todo');
var eltMissing = document.getElementById ('missing');
var eltExtra = document.getElementById ('extra');
var eltErrors = document.getElementById ('errors');
var eltToggle = document.getElementById (strFilter);
if (window && window.event && window.event.shiftKey)
{
eltMissing.checked = eltTodo.checked = eltExtra.checked = eltErrors.checked = false;
eltToggle.checked = true;
}
else
if (!eltTodo.checked && !eltMissing.checked && !eltExtra.checked && !eltErrors.checked)
{
eltMissing.checked = eltTodo.checked = eltExtra.checked = eltErrors.checked = true;
eltToggle.checked = false;
}
filterTree ();
}
function onLoad ()
{
var eltMissing = document.getElementById ('missing');
var eltTodo = document.getElementById ('todo');
var eltExtra = document.getElementById ('extra');
var eltErrors = document.getElementById ('errors');
eltMissing.checked = eltTodo.checked = eltExtra.checked = eltErrors.checked = true;
filterTree ();
}
if (document.layers)
{
document.captureEvents (Event.MOUSEUP);
document.onmouseup = clickHandler;
}
else if (document.attachEvent)
{
document.attachEvent('onclick', clickHandler);
}
else if (document.addEventListener)
{
document.addEventListener('click', clickHandler, false);
}
else
document.onclick = clickHandler;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 B

Binary file not shown.
+4
View File
@@ -0,0 +1,4 @@
*.makefrag
*.response
*.stamp
*.was_signed
+6 -20
View File
@@ -2,13 +2,9 @@
#
# The rules for building a program.
base_prog = $(notdir $(PROGRAM))
prog_dir := $(filter-out . ./, $(dir $(PROGRAM)))
base_prog = $(shell basename $(PROGRAM))
sourcefile = $(base_prog).sources
base_prog_config := $(wildcard $(base_prog).config.$(PROFILE))
ifndef base_prog_config
base_prog_config := $(wildcard $(base_prog).config)
endif
ifdef base_prog_config
PROGRAM_config := $(PROGRAM).config
endif
@@ -22,12 +18,6 @@ response = $(depsdir)/$(base_prog).response
executable_CLEAN_FILES += $(response)
endif
ifdef KEEP_OUTPUT_FILE_COPY
COPY_CMD = cp
else
COPY_CMD = mv
endif
makefrag = $(depsdir)/$(PROFILE)_$(base_prog).makefrag
pdb = $(patsubst %.exe,%.pdb,$(PROGRAM))
mdb = $(patsubst %.exe,%.mdb,$(PROGRAM))
@@ -87,17 +77,17 @@ ifndef PROGRAM_COMPILE
PROGRAM_COMPILE = $(CSCOMPILE)
endif
$(PROGRAM): $(BUILT_SOURCES) $(EXTRA_SOURCES) $(response) $(prog_dir:=/.stamp)
$(PROGRAM): $(BUILT_SOURCES) $(EXTRA_SOURCES) $(response)
$(PROGRAM_COMPILE) -target:exe -out:$(base_prog) $(BUILT_SOURCES) $(EXTRA_SOURCES) @$(response)
ifneq ($(base_prog),$(PROGRAM))
$(COPY_CMD) $(base_prog) $(PROGRAM)
test ! -f $(base_prog).mdb || $(COPY_CMD) $(base_prog).mdb $(PROGRAM).mdb
mv $(base_prog) $(PROGRAM)
test ! -f $(base_prog).mdb || mv $(base_prog).mdb $(PROGRAM).mdb
endif
ifdef PROGRAM_config
ifneq ($(base_prog_config),$(PROGRAM_config))
executable_CLEAN_FILES += $(PROGRAM_config)
$(PROGRAM_config): $(base_prog_config) $(dir $(PROGRAM_config))/.stamp
$(PROGRAM_config): $(base_prog_config)
cp $(base_prog_config) $(PROGRAM_config)
endif
endif
@@ -115,8 +105,4 @@ endif
-include $(makefrag)
all-local: $(makefrag)
ifneq ($(response),$(sourcefile))
$(response): $(topdir)/build/executable.make $(depsdir)/.stamp
endif
$(makefrag): $(topdir)/build/executable.make $(depsdir)/.stamp
$(makefrag): $(topdir)/build/executable.make
+39 -63
View File
@@ -14,9 +14,8 @@ sourcefile = $(LIBRARY).sources
PROFILE_sources = $(PROFILE)_$(LIBRARY).sources
ifeq ($(wildcard $(PROFILE_sources)), $(PROFILE_sources))
PROFILE_excludes = $(wildcard $(PROFILE)_$(LIBRARY).exclude.sources)
COMMON_sourcefile := $(sourcefile)
sourcefile = $(depsdir)/$(PROFILE)_$(LIBRARY).sources
$(sourcefile): $(PROFILE_sources) $(PROFILE_excludes) $(COMMON_sourcefile)
$(sourcefile): $(PROFILE_sources) $(PROFILE_excludes)
@echo Creating the per profile list $@ ...
$(topdir)/tools/gensources.sh $(PROFILE_sources) $(PROFILE_excludes) > $@
endif
@@ -38,22 +37,14 @@ ifndef LIBRARY_NAME
LIBRARY_NAME = $(LIBRARY)
endif
ifdef LIBRARY_COMPAT
lib_dir = compat
else
lib_dir = lib
endif
makefrag = $(depsdir)/$(PROFILE)_$(LIBRARY).makefrag
the_libdir = $(topdir)/class/$(lib_dir)/$(PROFILE)/
the_lib = $(the_libdir)$(LIBRARY_NAME)
the_lib = $(topdir)/class/lib/$(PROFILE)/$(LIBRARY_NAME)
the_pdb = $(the_lib:.dll=.pdb)
the_mdb = $(the_lib).mdb
library_CLEAN_FILES += $(makefrag) $(the_lib) $(the_pdb) $(the_mdb)
ifdef LIBRARY_NEEDS_POSTPROCESSING
build_libdir = fixup/$(PROFILE)/
build_lib = $(build_libdir)$(LIBRARY_NAME)
build_lib = fixup/$(PROFILE)/$(LIBRARY_NAME)
library_CLEAN_FILES += $(build_lib) $(build_lib:.dll=.pdb)
else
build_lib = $(the_lib)
@@ -65,20 +56,33 @@ test_nunit_dep = $(test_nunit_lib:%=$(topdir)/class/lib/$(PROFILE)/%)
test_nunit_ref = $(test_nunit_dep:%=-r:%)
library_CLEAN_FILES += TestResult*.xml
ifndef test_against
test_against = $(the_lib)
test_dep = $(the_lib)
endif
ifndef test_lib
test_lib = $(LIBRARY:.dll=_test_$(PROFILE).dll)
test_sourcefile = $(LIBRARY:.dll=_test.dll.sources)
else
test_sourcefile = $(test_lib).sources
endif
test_pdb = $(test_lib:.dll=.pdb)
test_response = $(depsdir)/$(test_lib).response
test_makefrag = $(depsdir)/$(test_lib).makefrag
test_flags = -r:$(the_lib) $(test_nunit_ref) $(TEST_MCS_FLAGS)
test_flags = -r:$(test_against) $(test_nunit_ref) $(TEST_MCS_FLAGS)
library_CLEAN_FILES += $(LIBRARY:.dll=_test*.dll) $(LIBRARY:.dll=_test*.pdb) $(test_response) $(test_makefrag)
ifndef btest_lib
btest_lib = $(LIBRARY:.dll=_btest_$(PROFILE).dll)
btest_sourcefile = $(LIBRARY:.dll=_btest.dll.sources)
else
btest_sourcefile = $(btest_lib).sources
endif
btest_pdb = $(btest_lib:.dll=.pdb)
btest_response = $(depsdir)/$(btest_lib).response
btest_makefrag = $(depsdir)/$(btest_lib).makefrag
btest_flags = -r:$(the_lib) $(test_nunit_ref) $(TEST_MBAS_FLAGS)
btest_flags = -r:$(test_against) $(test_nunit_ref) $(TEST_MBAS_FLAGS)
library_CLEAN_FILES += $(LIBRARY:.dll=_btest*.dll) $(LIBRARY:.dll=_btest*.pdb) $(btest_response) $(btest_makefrag)
ifndef HAVE_CS_TESTS
@@ -90,6 +94,13 @@ endif
endif
ifdef NO_INSTALL
GACUTIL = :
else
gacutil = $(topdir)/class/lib/net_1_1_bootstrap/gacutil.exe
GACUTIL = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(gacutil)
endif
ifdef NO_SIGN_ASSEMBLY
SN = :
else
@@ -143,23 +154,11 @@ ifndef RUNTIME_HAS_CONSISTENT_GACDIR
gacdir_flag = /gacdir $(GACDIR)
endif
ifndef LIBRARY_PACKAGE
ifdef LIBRARY_COMPAT
LIBRARY_PACKAGE = compat-$(FRAMEWORK_VERSION)
else
LIBRARY_PACKAGE = $(FRAMEWORK_VERSION)
endif
endif
ifneq (none, $(LIBRARY_PACKAGE))
package_flag = /package $(LIBRARY_PACKAGE)
endif
install-local: $(gacutil)
$(GACUTIL) /i $(the_lib) /f $(gacdir_flag) /root $(GACROOT) $(package_flag)
$(GACUTIL) /i $(the_lib) /f $(gacdir_flag) /root $(GACROOT) /package $(FRAMEWORK_VERSION)
uninstall-local: $(gacutil)
-$(GACUTIL) /u $(LIBRARY_NAME:.dll=) $(gacdir_flag) /root $(GACROOT) $(package_flag)
-$(GACUTIL) /u $(LIBRARY_NAME:.dll=) $(gacdir_flag) /root $(GACROOT) /package $(FRAMEWORK_VERSION)
endif
endif
@@ -190,39 +189,25 @@ test_assemblies += $(btest_lib)
endif
ifdef test_assemblies
check: run-test
test-local: $(test_assemblies)
run-test-local: run-test-lib
run-test-ondotnet-local: run-test-ondotnet-lib
TEST_HARNESS_EXCLUDES = /exclude:NotWorking,ValueAdd,CAS,InetAccess
TEST_HARNESS_EXCLUDES_ONDOTNET = /exclude:NotDotNet,CAS
ifdef TEST_HARNESS_VERBOSE
TEST_HARNESS_OUTPUT = /labels
TEST_HARNESS_OUTPUT_ONDOTNET = /labels
TEST_HARNESS_POSTPROC = :
TEST_HARNESS_POSTPROC_ONDOTNET = :
else
TEST_HARNESS_OUTPUT = /output:TestResult-$(PROFILE).log
TEST_HARNESS_OUTPUT_ONDOTNET = /output:TestResult-ondotnet-$(PROFILE).log
TEST_HARNESS_POSTPROC = (echo ''; cat TestResult-$(PROFILE).log) | sed '1,/^Tests run: /d'
TEST_HARNESS_POSTPROC_ONDOTNET = (echo ''; cat TestResult-ondotnet-$(PROFILE).log) | sed '1,/^Tests run: /d'
endif
## FIXME: i18n problem in the 'sed' command below
run-test-lib: test-local
ok=:; \
MONO_REGISTRY_PATH="$(HOME)/.mono/registry" $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(TEST_HARNESS) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) $(TEST_HARNESS_EXCLUDES) $(TEST_HARNESS_OUTPUT) /xml:TestResult-$(PROFILE).xml $(test_assemblies) || ok=false; \
$(TEST_HARNESS_POSTPROC) ; $$ok
$(TEST_RUNTIME) $(TEST_HARNESS) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) /output:TestResult-$(PROFILE).log /exclude:NotWorking,ValueAdd,CAS,InetAccess /xml:TestResult-$(PROFILE).xml $(test_assemblies) || ok=false; \
sed '1,/^Tests run: /d' TestResult-$(PROFILE).log; \
$$ok
run-test-ondotnet-lib: test-local
ok=:; \
$(TEST_HARNESS) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_ONDOTNET_FLAGS) $(TEST_HARNESS_EXCLUDES_ONDOTNET) $(TEST_HARNESS_OUTPUT_ONDOTNET) /xml:TestResult-ondotnet-$(PROFILE).xml $(test_assemblies) || ok=false; \
$(TEST_HARNESS_POSTPROC_ONDOTNET) ; $$ok
$(TEST_HARNESS) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_ONDOTNET_FLAGS) /exclude=NotDotNet,CAS /output:TestResult-ondotnet-$(PROFILE).log /xml:TestResult-ondotnet-$(PROFILE).xml $(test_assemblies) || ok=false; \
sed '1,/^Tests run: /d' TestResult-ondotnet-$(PROFILE).log; \
$$ok
endif
DISTFILES = $(wildcard *$(LIBRARY)*.sources) $(EXTRA_DISTFILES)
DISTFILES = $(sourcefile) $(EXTRA_DISTFILES)
TEST_FILES =
@@ -235,10 +220,9 @@ TEST_FILES += `sed -e '/^$$/d' -e 's,^,Test/,' $(btest_sourcefile)`
DISTFILES += $(btest_sourcefile)
endif
# make dist will collect files in .sources files from all profiles
dist-local: dist-default
subs=' ' ; \
for f in `$(topdir)/tools/removecomments.sh $(wildcard *$(LIBRARY).sources)` $(TEST_FILES) ; do \
for f in `cat $(sourcefile)` $(TEST_FILES) ; do \
case $$f in \
../*) : ;; \
*) dest=`dirname $$f` ; \
@@ -291,9 +275,7 @@ endif
# The library
$(the_lib): $(the_libdir)/.stamp
$(build_lib): $(response) $(sn) $(BUILT_SOURCES) $(build_libdir:=/.stamp)
$(build_lib): $(response) $(sn) $(BUILT_SOURCES)
ifdef LIBRARY_USE_INTERMEDIATE_FILE
$(LIBRARY_COMPILE) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) -target:library -out:$(LIBRARY_NAME) $(BUILT_SOURCES_cmdline) @$(response)
$(SN) $(SNFLAGS) $(LIBRARY_NAME) $(LIBRARY_SNK)
@@ -322,7 +304,7 @@ endif
ifdef HAVE_CS_TESTS
$(test_lib): $(the_lib) $(test_response) $(test_nunit_dep)
$(test_lib): $(test_dep) $(test_response) $(test_nunit_dep)
$(TEST_COMPILE) -target:library -out:$@ $(test_flags) @$(test_response)
$(test_response): $(test_sourcefile)
@@ -339,7 +321,7 @@ endif
ifdef HAVE_VB_TESTS
$(btest_lib): $(the_lib) $(btest_response) $(test_nunit_dep)
$(btest_lib): $(test_dep) $(btest_response) $(test_nunit_dep)
$(BTEST_COMPILE) -target:library -out:$@ $(btest_flags) @$(btest_response)
$(btest_response): $(btest_sourcefile)
@@ -354,11 +336,5 @@ $(btest_makefrag): $(btest_response)
endif
## Include corcompare stuff
include $(topdir)/build/corcompare.make
all-local: $(makefrag) $(test_makefrag) $(btest_makefrag)
ifneq ($(response),$(sourcefile))
$(response): $(topdir)/build/library.make $(depsdir)/.stamp
endif
$(makefrag) $(test_response) $(test_makefrag) $(btest_response) $(btest_makefrag): $(topdir)/build/library.make $(depsdir)/.stamp
$(makefrag) $(test_makefrag) $(btest_makefrag): $(topdir)/build/library.make
+1 -1
View File
@@ -4,7 +4,7 @@
#
PLATFORM_DEBUG_FLAGS = -debug
PLATFORM_MCS_FLAGS = -optimize
PLATFORM_MCS_FLAGS =
PLATFORM_RUNTIME = $(RUNTIME)
PLATFORM_CORLIB = mscorlib.dll
Loaded 100 of 19082 files, more files were not shown because too many files have changed in this diff. Show more