[m-dev.] IL back-end & --high-level-data

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Aug 11 22:30:51 AEST 2001


Previously I had tried building the standard library with --high-level-data,
and discovered that we need to do the following to get it to work:

	- fix the MC++ interface:
		- add #using directives to *__cpp_code. 
		- fix MR_Word casts

        - provide definitions for RTTI types (type_info, base_type_info, etc.)
        - provide definitions for undefined library types (c_pointer, type_desc)

I tried getting tests/benchmarks/queens.m to work with --high-level-data,
modifying it by adding a definition of the list type to make it more 
self-contained, so as to avoid needing to have the standard library built
woith --high-level-data.  I discovered that there are a bunch more things
that we need to do to get --high-level-data working:

	- fix the code that we generate for type definitions:
	    - MLDS problems
		- fix bogus references to ".tag_type" that occur when
		  compiling with "--high-level-data --tags none"
	    - IL problems
		- put type definitions before the code that uses them
		- generate constructors for all class types
		- use "/" separator (rather than ".") for references
		  to nested classes, e.g. "mercury.list.list_1/'[]_0'".
		- name-mangle names such as "._2"? (is this necessary?)

Even that wasn't enough, though, because after manually fixing all of those
by editing the generated IL code, I was left with a program which
when run reported

	Unhandled Exception: System.InvalidProgramException: Exception of type
	System.InvalidProgramException was thrown.
	   at queens.mercury_code.main_2()
	(null)

and this was a bit difficult to debug.  I think that one is due to
not downcasting the values properly, since PEVerify reports the following
error message (among other things):

	[IL]: Error: [queens.exe : queens.mercury_code::nodiag_3_p] [offset
	0x0000001D] [opcode ldfld] [found objref 'queens.list_1'] [expected
	objref 'cons_2'] Unexpected type on the stack.

Anyway, it looks like we still have a fair way to go to get --high-level-data
working for IL.

-- 
Fergus Henderson <fjh at 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.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list