[Mono-list] Mercury on Mono

Fergus Henderson fjh@cs.mu.oz.au
Mon, 7 Apr 2003 23:07:44 +1000


This is an S/MIME signed message

------8C1B659BDA9C52CEF3B6D846C17F32E1
Content-Type: multipart/mixed; boundary="IJpNTDwzlM2Ie8A6"
Content-Disposition: inline


--IJpNTDwzlM2Ie8A6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On 01-Mar-2003, Paolo Molaro <lupus@ximian.com> wrote:
> After a bunch of warnings about the missing type I get:
> lupus@luna:/tmp/mercury/mercury_dotnet_hello$ mono hello.exe 
> Hello, world
> 
> So, that's a good start, though I don't know how much real mercury code
> the test uses to run.

Using Mono 0.23 on Debian Linux, I have tested several cases by
hand, making use of Mercury features such as parametric polymorphism,
backtracking, and higher-order code, and they all work fine.  My next step
is running the full Mercury test suite... currently that is underway.
(The results so far look reasonably good, although there are still
quite a lot of failures -- of the first 185 tests, about 30% failed.
I haven't yet analyzed the causes of the failures.)
This is all using a version of the Mercury library for .NET that was built
on Windows, and using the Portable.NET version of ilasm to assemble each
test (because the Mono ilasm didn't work).

Some comments:

	- Attempting to run "mono" on a DLL rather than an EXE
	  results in a poor (confusing) error message -- in some
	  cases, an assertion failure.

	- The most recent version of Mono's "ilasm" that I could find
	  was "Mono ILasm compiler version 0.0.3.0".  Is that the
	  current version?  Is there a newer version?

	- Mono's ilasm 0.0.3.0 barfed on some constructs in the
	  Mercury-generated .il files, e.g. the `tak.il' file attached,
	  reporting the following error message:

Unhandled Exception: Mono.ILASM.ILSyntaxError: Bad number format!
in <0x00283> 00 Mono.ILASM.NumberHelper:Build ()
in <0x004b9> 00 Mono.ILASM.ILTokenizer:GetNextToken ()
in <0x00012> 00 Mono.ILASM.ILTokenizer:get_NextToken ()
in <0x00021> 00 Mono.ILASM.ScannerAdapter:advance ()
in <0x001fa> 00 Mono.ILASM.ILParser:yyparse (Mono.ILASM.yyParser.yyInput)
in <0x00053> 00 Mono.ILASM.ILParser:yyparse (Mono.ILASM.yyParser.yyInput,object)in <0x0016f> 00 .DriverMain:ProcessFile (string)
in <0x0017d> 00 .DriverMain:Run ()
in <0x0003f> 00 Mono.ILASM.Driver:Main (string[])                               

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

--IJpNTDwzlM2Ie8A6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tak.il"

//
// Automatically generated from `tak.m' by the
// Mercury compiler, version rotd-2003-04-05, configured for i686-pc-linux-gnu.
// Do not edit.



.assembly 'tak' { }

.assembly extern 'mercury'{
.ver 0:0:0:0
	.publickeytoken = ( 22 8C 16 7D 12 AA B B ) 
	
}


.assembly extern 'mscorlib'{
.ver 1:0:2411:0
	.publickeytoken = ( B7 7A 5C 56 19 34 E0 89 ) 
	
}


.assembly extern 'mscorlib'{

}


.namespace 'tak' {
.class public 'mercury_code' {
.field public static
	bool
	'rtti_initialized'
.method public static default 
	void
	.cctor()
{
	ldsfld	bool
		'tak'.'mercury_code'::'rtti_initialized'
	brfalse	l2
	ret
	l2:
	ldc.i4.1
	stsfld	bool
		'tak'.'mercury_code'::'rtti_initialized'
	call	void
		['mercury']'mercury'.'array'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'assoc_list'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'benchmarking'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'bintree'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'bintree_set'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'bool'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'builtin'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'char'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'construct'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'deconstruct'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'dir'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'enum'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'exception'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'float'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'int'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'integer'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'io'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'lexer'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'list'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'map'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'math'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'ops'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'parser'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'private_builtin'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'random'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'require'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'rtti_implementation'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'set'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'set_ordlist'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'set_unordlist'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'std_util'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'store'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'string'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'table_builtin'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'term'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'term_io'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'time'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'tree234'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'type_desc'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'varset'.'mercury_code'::.cctor()

	call	void
		['mercury']'mercury'.'private_builtin__cpp_code'.'mercury_code'::'init_runtime'()

	ret
}

.method public static default 
	void
	'tak_4'(
		int32 'X_5',
		int32 'Y_6',
		int32 'Z_7',
		int32& 'A_8'
	)
{
.maxstack 4
	
	.line 26 'tak.m'
	
	.line 26 'tak.m'
	{	// #1
	
	.line 31 'tak.m'
	{	// #2
	
	.line 31 'tak.m'
	
	.line 31 'tak.m'
	loop_top:
	
	.line 31 'tak.m'
	{	// #3
	
	.line 31 'tak.m'
	ldarg	'X_5'
	ldarg	'Y_6'
	cgt
	ldc.i4.0
	ceq
	
	.line 31 'tak.m'
	brfalse	l1
	
	.line 30 'tak.m'
	ldarg	'A_8'
	ldarg	'Z_7'
	stind.i4
	ret
	l1:
	
	.line 32 'tak.m'
	{	// #4
	.locals (
		int32 'A1_10',
		int32 'A2_12',
		int32 'A3_14'
	)

	
	.line 32 'tak.m'
	
	.line 32 'tak.m'
	ldarg	'X_5'
	ldc.i4.1
	sub
	
	.line 33 'tak.m'
	ldarg	'Y_6'
	ldarg	'Z_7'
	ldloca	'A1_10'
	call	void
		'tak'.'mercury_code'::'tak_4'(
			int32,
			int32,
			int32,
			int32&
		)
	
	.line 34 'tak.m'
	
	.line 34 'tak.m'
	ldarg	'Y_6'
	ldc.i4.1
	sub
	
	.line 35 'tak.m'
	ldarg	'Z_7'
	ldarg	'X_5'
	ldloca	'A2_12'
	call	void
		'tak'.'mercury_code'::'tak_4'(
			int32,
			int32,
			int32,
			int32&
		)
	
	.line 36 'tak.m'
	
	.line 36 'tak.m'
	ldarg	'Z_7'
	ldc.i4.1
	sub
	
	.line 37 'tak.m'
	ldarg	'X_5'
	ldarg	'Y_6'
	ldloca	'A3_14'
	call	void
		'tak'.'mercury_code'::'tak_4'(
			int32,
			int32,
			int32,
			int32&
		)
	
	.line 38 'tak.m'
	{	// #5
	
	.line 38 'tak.m'
	
	.line 38 'tak.m'
	{	// #6
	.locals (
		int32 'X__tmp_copy_5',
		int32 'Y__tmp_copy_6'
	)

	
	.line 38 'tak.m'
	ldloc	'A1_10'
	stloc	'X__tmp_copy_5'
	
	.line 38 'tak.m'
	ldloc	'A2_12'
	stloc	'Y__tmp_copy_6'
	
	.line 38 'tak.m'
	ldloc	'A3_14'
	
	.line 38 'tak.m'
	starg	'Z_7'
	
	.line 38 'tak.m'
	ldloc	'Y__tmp_copy_6'
	starg	'Y_6'
	
	.line 38 'tak.m'
	ldloc	'X__tmp_copy_5'
	starg	'X_5'
	}	// #6
	
	.line 38 'tak.m'
	br	loop_top
	}	// #5
	}	// #4
	l2:
	}	// #3
	}	// #2
	}	// #1
	ret
}

.method public static default 
	void
	'main1_1'(
		int32& 'Out_2'
	)
{
.maxstack 4
	
	.line 20 'tak.m'
	
	.line 20 'tak.m'
	{	// #1
	
	.line 22 'tak.m'
	{	// #2
	
	.line 22 'tak.m'
	ldc.i4.s	18
	
	.line 22 'tak.m'
	
	.line 22 'tak.m'
	
	.line 23 'tak.m'
	ldc.i4.s	12
	ldc.i4.6
	ldarg	'Out_2'
	tail.
	call	void
		'tak'.'mercury_code'::'tak_4'(
			int32,
			int32,
			int32,
			int32&
		)
	}	// #2
	}	// #1
	ret
}

.method public static default 
	void
	'main_2'()
{
.entrypoint 
.maxstack 4
	.try {	// #4
	.try {	// #3
	
	.line 8 'tak.m'
	
	.line 8 'tak.m'
	{	// #1
	
	.line 14 'tak.m'
	{	// #2
	.locals (
		int32 'Out_3'
	)

	
	.line 14 'tak.m'
	ldc.i4.s	18
	
	.line 14 'tak.m'
	
	.line 14 'tak.m'
	
	.line 23 'tak.m'
	ldc.i4.s	12
	ldc.i4.6
	ldloca	'Out_3'
	call	void
		'tak'.'mercury_code'::'tak_4'(
			int32,
			int32,
			int32,
			int32&
		)
	
	.line 16 'tak.m'
	ldloc	'Out_3'
	call	void
		['mercury']'mercury'.'io'.'mercury_code'::'write_int_3'(
			int32
		)
	
	.line 17 'tak.m'
	ldstr	"\n"
	
	.line 17 'tak.m'
	nop
	call	void
		['mercury']'mercury'.'io'.'mercury_code'::'write_string_3'(
			string
		)
	leave	l1
	}	// #2
	leave	l1
	}	// #1
	leave	l1
	}	// #3 (try block)
	catch ['mercury']'mercury'.'runtime'.'Exception' {	// #5
	ldfld	object[]
		['mercury']'mercury'.'runtime'.'Exception'::'mercury_exception'
	call	void
		['mercury']'mercury'.'exception'.'mercury_code'::'ML_report_uncaught_exception'(
			object[]
		)
	ldc.i4.1
	call	void
		['mscorlib']'System'.'Environment'::'set_ExitCode'(
			int32
		)
	leave	l1
	}	// #5 (catch block)
	leave	l1
	}	// #4 (try block)
	catch ['mscorlib']'System'.'Exception' {	// #6
	ldstr	"\nUncaught system exception: \n"
	call	void
		['mscorlib']'System'.'Console'::'Write'(
			string
		)
	call	void
		['mscorlib']'System'.'Console'::'Write'(
			object
		)
	ldc.i4.1
	call	void
		['mscorlib']'System'.'Environment'::'set_ExitCode'(
			int32
		)
	leave	l1
	}	// #6 (catch block)
	l1:
	ret
}

}

}


// End of module: tak. 

--IJpNTDwzlM2Ie8A6--

------8C1B659BDA9C52CEF3B6D846C17F32E1
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"

MIIMBwYJKoZIhvcNAQcCoIIL+DCCC/QCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3
DQEHAaCCCdowggJlMIIBzqADAgECAgEBMA0GCSqGSIb3DQEBBAUAMIGUMQswCQYD
VQQGEwJBVTERMA8GA1UECBMIVmljdG9yaWExEjAQBgNVBAcTCU1lbGJvdXJuZTEk
MCIGA1UEChMbVGhlIFVuaXZlcnNpdHkgb2YgTWVsYm91cm5lMRowGAYDVQQLExFU
aGUgTWVyY3VyeSBHcm91cDEcMBoGA1UEAxMTbWVyY3VyeS5jcy5tdS5vei5hdTAe
Fw0wMzAyMTIwNjQ0NDJaFw0wNTAy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