[m-dev.] diff: fix bug with typeclass_infos

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Apr 3 00:54:16 AEST 2000


Oops, I committed my change to the RTTI code in the compiler
a little too hastily; it had passed bootcheck, but it didn't
pass the test cases.  Hence the following change.

--------------------

Estimated hours taken: 1

Fix a bug introduced by my previous change that broke lots of the test cases,
e.g. tests/debugger/implied_instance.

Previously there was a performance bug in the pseudo_type_info handling:
the generated code contained an extra level of indirection,
boxing type_ctor_infos even when they had no arguments.
My earlier change to pseudo_type_info.m fixed that.
However fixing the performance bug caused a problem:
the debugger was now crashing because the type_infos generated
for typeclass_info variables were not correctly formed.
The generated type_infos had a type_ctor_info marked with arity 1,
but no arguments.  Perviously the extra level of indirection had
prevented the runtime from crashing for these.

compiler/pseudo_type_info.m:
	For typeclass_info types, replace the argument type list
	with `[void]', rather than `[]', to match the arity of
	the type constructor.

Workspace: /home/mercury0/fjh/mercury
Index: compiler/pseudo_type_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pseudo_type_info.m,v
retrieving revision 1.2
diff -u -d -r1.2 pseudo_type_info.m
--- compiler/pseudo_type_info.m	2000/04/02 08:09:22	1.2
+++ compiler/pseudo_type_info.m	2000/04/02 09:27:58
@@ -87,13 +87,15 @@
 		(
 			% The argument to typeclass_info types is not
 			% a type - it encodes the class constraint.
+			% So we replace the argument with type `void'.
 			mercury_private_builtin_module(PrivateBuiltin),
-			TypeId = qualified(PrivateBuiltin, TName) - _,
+			TypeId = qualified(PrivateBuiltin, TName) - 1,
 			( TName = "typeclass_info"
 			; TName = "base_typeclass_info"
 			)
 		->
-			TypeArgs = []
+			construct_type(unqualified("void") - 0, [], ArgType),
+			TypeArgs = [ArgType]
 		;
 			TypeArgs = TypeArgs0
 		),

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- 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