[m-rev.] for review: fix bad references to type_ctor_infos in table_builtin.m
Zoltan Somogyi
zs at cs.mu.OZ.AU
Thu Sep 12 19:59:54 AEST 2002
To prevent tonight's tests from failing because of this problem, I am
committing this change now. I will address any review comments in a later
checkin.
Zoltan.
Estimated hours taken: 2
Fix improper references to the type_ctor_infos of builtin types.
runtime/mercury_builtin_types.h:
Declare the type_ctor_infos of builtin types even for the low level
backend.
runtime/mercury.h:
Avoid duplicating the declarations in mercury_builtin_types.h;
include mercury_builtin_types.h instead.
runtime/mercury_type_desc.h:
Include mercury_builtin_types.h, and refer to the type_ctor_infos
of the builtin variable-arity type constructors directly.
library/table_builtin.m:
Declare only the type_ctor_infos we need that aren't declared by
mercury_builtin_types.h.
cvs diff: Diffing .
cvs diff: Diffing bench
cvs diff: Diffing bench/progs
cvs diff: Diffing bench/progs/compress
cvs diff: Diffing bench/progs/icfp2000
cvs diff: Diffing bench/progs/icfp2001
cvs diff: Diffing bench/progs/nuc
cvs diff: Diffing bench/progs/ray
cvs diff: Diffing bench/progs/tree234
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing gcc
cvs diff: Diffing gcc/mercury
cvs diff: Diffing java
cvs diff: Diffing java/library
cvs diff: Diffing java/runtime
cvs diff: Diffing library
Index: library/table_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/table_builtin.m,v
retrieving revision 1.21
diff -u -b -r1.21 table_builtin.m
--- library/table_builtin.m 26 Jul 2002 04:20:11 -0000 1.21
+++ library/table_builtin.m 12 Sep 2002 07:37:12 -0000
@@ -1152,30 +1152,7 @@
#include ""mercury_type_info.h"" /* for MR_TypeCtorInfo_Struct; */
#include ""mercury_tabling.h"" /* for MR_TrieNode, etc. */
-#ifdef MR_HIGHLEVEL_CODE
- #define MR_TYPE_CTOR_INFO_INT \
- mercury__builtin__builtin__type_ctor_info_int_0
- #define MR_TYPE_CTOR_INFO_STRING \
- mercury__builtin__builtin__type_ctor_info_string_0
- #define MR_TYPE_CTOR_INFO_FLOAT \
- mercury__builtin__builtin__type_ctor_info_float_0
- #define MR_TYPE_CTOR_INFO_CHAR \
- mercury__builtin__builtin__type_ctor_info_character_0
- #define MR_TYPE_CTOR_INFO_IO_STATE \
- mercury__io__io__type_ctor_info_state_0
-#else
- #define MR_TYPE_CTOR_INFO_INT mercury_data___type_ctor_info_int_0
- #define MR_TYPE_CTOR_INFO_STRING mercury_data___type_ctor_info_string_0
- #define MR_TYPE_CTOR_INFO_FLOAT mercury_data___type_ctor_info_float_0
- #define MR_TYPE_CTOR_INFO_CHAR mercury_data___type_ctor_info_character_0
- #define MR_TYPE_CTOR_INFO_IO_STATE mercury_data_io__type_ctor_info_state_0
-#endif
-
-MR_DECLARE_TYPE_CTOR_INFO_STRUCT(MR_TYPE_CTOR_INFO_INT);
-MR_DECLARE_TYPE_CTOR_INFO_STRUCT(MR_TYPE_CTOR_INFO_STRING);
-MR_DECLARE_TYPE_CTOR_INFO_STRUCT(MR_TYPE_CTOR_INFO_FLOAT);
-MR_DECLARE_TYPE_CTOR_INFO_STRUCT(MR_TYPE_CTOR_INFO_CHAR);
-MR_DECLARE_TYPE_CTOR_INFO_STRUCT(MR_TYPE_CTOR_INFO_IO_STATE);
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(MR_TYPE_CTOR_INFO_NAME(io, state, 0));
").
@@ -1274,7 +1251,8 @@
MR_TrieNode table;
table = (MR_TrieNode) T;
- MR_TABLE_SAVE_ANSWER(table, Offset, I, &MR_TYPE_CTOR_INFO_INT);
+ MR_TABLE_SAVE_ANSWER(table, Offset, I,
+ &MR_TYPE_CTOR_INFO_NAME(builtin, int, 0));
").
:- pragma foreign_proc("C",
@@ -1284,7 +1262,8 @@
MR_TrieNode table;
table = (MR_TrieNode) T;
- MR_TABLE_SAVE_ANSWER(table, Offset, C, &MR_TYPE_CTOR_INFO_CHAR);
+ MR_TABLE_SAVE_ANSWER(table, Offset, C,
+ &MR_TYPE_CTOR_INFO_NAME(builtin, character, 0));
").
:- pragma foreign_proc("C",
@@ -1295,7 +1274,7 @@
table = (MR_TrieNode) T;
MR_TABLE_SAVE_ANSWER(table, Offset, (MR_Word) S,
- &MR_TYPE_CTOR_INFO_STRING);
+ &MR_TYPE_CTOR_INFO_NAME(builtin, string, 0));
").
:- pragma foreign_proc("C",
@@ -1307,10 +1286,10 @@
table = (MR_TrieNode) T;
#ifdef MR_HIGHLEVEL_CODE
MR_TABLE_SAVE_ANSWER(table, Offset, (MR_Word) MR_box_float(F),
- &MR_TYPE_CTOR_INFO_FLOAT);
+ &MR_TYPE_CTOR_INFO_NAME(builtin, float, 0));
#else
MR_TABLE_SAVE_ANSWER(table, Offset, MR_float_to_word(F),
- &MR_TYPE_CTOR_INFO_FLOAT);
+ &MR_TYPE_CTOR_INFO_NAME(builtin, float, 0));
#endif
").
@@ -1322,7 +1301,7 @@
table = (MR_TrieNode) T;
MR_TABLE_SAVE_ANSWER(table, Offset, (MR_Word) S,
- &MR_TYPE_CTOR_INFO_IO_STATE);
+ &MR_TYPE_CTOR_INFO_NAME(io, state, 0));
").
:- pragma foreign_proc("C",
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury.h,v
retrieving revision 1.63
diff -u -b -r1.63 mercury.h
--- runtime/mercury.h 5 Sep 2002 04:05:38 -0000 1.63
+++ runtime/mercury.h 12 Sep 2002 04:13:47 -0000
@@ -29,6 +29,7 @@
#include "mercury_thread.h" /* for the MR_*_GLOBAL_LOCK() macros */
#include "mercury_std.h" /* for the MR_CALL macro (and others) */
#include "mercury_type_info.h"
+#include "mercury_builtin_types.h"
#include "mercury_ho_call.h" /* for the `MR_Closure' type */
#include "mercury_bootstrap.h"
#include "mercury_memory.h" /* for memory allocation routines */
@@ -122,49 +123,15 @@
extern void *mercury__private_builtin__stack_chain;
#endif
-/* declare MR_TypeCtorInfo_Structs for the builtin types */
-extern const MR_TypeCtorInfo_Struct
- mercury__builtin__builtin__type_ctor_info_int_0,
- mercury__builtin__builtin__type_ctor_info_string_0,
- mercury__builtin__builtin__type_ctor_info_float_0,
- mercury__builtin__builtin__type_ctor_info_character_0,
- mercury__builtin__builtin__type_ctor_info_void_0,
- mercury__builtin__builtin__type_ctor_info_c_pointer_0,
- mercury__private_builtin__private_builtin__type_ctor_info_heap_pointer_0,
- mercury__builtin__builtin__type_ctor_info_pred_0,
- mercury__builtin__builtin__type_ctor_info_func_0,
- mercury__builtin__builtin__type_ctor_info_tuple_0,
- mercury__array__array__type_ctor_info_array_1,
- mercury__std_util__std_util__type_ctor_info_univ_0,
- mercury__type_desc__type_desc__type_ctor_info_type_ctor_desc_0,
- mercury__type_desc__type_desc__type_ctor_info_type_desc_0,
- mercury__private_builtin__private_builtin__type_ctor_info_type_ctor_info_1,
- mercury__private_builtin__private_builtin__type_ctor_info_type_info_1,
- mercury__private_builtin__private_builtin__type_ctor_info_typeclass_info_1,
- mercury__private_builtin__private_builtin__type_ctor_info_base_typeclass_info_1;
-
/*
-** XXX this is a bit of a hack: really we should change it so that
-** the generated MLDS code always qualifies things with `builtin:',
-** but currently it doesn't, so we use the following #defines as
-** a work-around.
+** Declare the TypeCtorInfos of the library types that are not already
+** declared in mercury_builtin_types.h
*/
-#define mercury__builtin____type_ctor_info_int_0 \
- mercury__builtin__builtin__type_ctor_info_int_0
-#define mercury__builtin____type_ctor_info_string_0 \
- mercury__builtin__builtin__type_ctor_info_string_0
-#define mercury__builtin____type_ctor_info_float_0 \
- mercury__builtin__builtin__type_ctor_info_float_0
-#define mercury__builtin____type_ctor_info_character_0 \
- mercury__builtin__builtin__type_ctor_info_character_0
-#define mercury__builtin____type_ctor_info_pred_0 \
- mercury__builtin__builtin__type_ctor_info_pred_0
-#define mercury__builtin____type_ctor_info_func_0 \
- mercury__builtin__builtin__type_ctor_info_func_0
-#define mercury__builtin____type_ctor_info_tuple_0 \
- mercury__builtin__builtin__type_ctor_info_tuple_0
-#define mercury__builtin____type_ctor_info_void_0 \
- mercury__builtin__builtin__type_ctor_info_void_0
+
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ mercury__array__array__type_ctor_info_array_1);
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ mercury__std_util__std_util__type_ctor_info_univ_0);
/*
** The compiler used to generate references to this constant.
Index: runtime/mercury_builtin_types.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_builtin_types.h,v
retrieving revision 1.1
diff -u -b -r1.1 mercury_builtin_types.h
--- runtime/mercury_builtin_types.h 9 Aug 2002 05:26:48 -0000 1.1
+++ runtime/mercury_builtin_types.h 12 Sep 2002 04:51:45 -0000
@@ -12,9 +12,6 @@
#ifndef MERCURY_BUILTIN_TYPES_H
#define MERCURY_BUILTIN_TYPES_H
-/* Everything in this file is specific to the high-level-code back-end */
-#ifdef MR_HIGHLEVEL_CODE
-
#include "mercury_types.h"
#include "mercury_std.h" /* for MR_CALL */
#include "mercury_float.h" /* for MR_Float etc */
@@ -27,29 +24,46 @@
*/
/* declare MR_TypeCtorInfo_Structs for the builtin types */
-extern const MR_TypeCtorInfo_Struct
- mercury__builtin__builtin__type_ctor_info_int_0,
- mercury__builtin__builtin__type_ctor_info_string_0,
- mercury__builtin__builtin__type_ctor_info_float_0,
- mercury__builtin__builtin__type_ctor_info_character_0,
- mercury__builtin__builtin__type_ctor_info_void_0,
- mercury__builtin__builtin__type_ctor_info_c_pointer_0,
- mercury__builtin__builtin__type_ctor_info_pred_0,
- mercury__builtin__builtin__type_ctor_info_func_0,
- mercury__builtin__builtin__type_ctor_info_tuple_0,
- mercury__private_builtin__private_builtin__type_ctor_info_heap_pointer_0,
- mercury__private_builtin__private_builtin__type_ctor_info_type_ctor_info_1,
- mercury__private_builtin__private_builtin__type_ctor_info_type_info_1,
- mercury__private_builtin__private_builtin__type_ctor_info_typeclass_info_1,
- mercury__private_builtin__private_builtin__type_ctor_info_base_typeclass_info_1,
- mercury__array__array__type_ctor_info_array_1,
- mercury__std_util__std_util__type_ctor_info_univ_0,
- mercury__type_desc__type_desc__type_ctor_info_type_ctor_desc_0,
- mercury__type_desc__type_desc__type_ctor_info_type_desc_0;
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ MR_TYPE_CTOR_INFO_NAME(builtin, int, 0));
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ MR_TYPE_CTOR_INFO_NAME(builtin, string, 0));
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ MR_TYPE_CTOR_INFO_NAME(builtin, float, 0));
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ MR_TYPE_CTOR_INFO_NAME(builtin, character, 0));
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ MR_TYPE_CTOR_INFO_NAME(builtin, void, 0));
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ MR_TYPE_CTOR_INFO_NAME(builtin, c_pointer, 0));
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ MR_TYPE_CTOR_INFO_NAME(builtin, pred, 0));
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ MR_TYPE_CTOR_INFO_NAME(builtin, func, 0));
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ MR_TYPE_CTOR_INFO_NAME(builtin, tuple, 0));
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ MR_TYPE_CTOR_INFO_NAME(private_builtin, heap_pointer, 0));
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ MR_TYPE_CTOR_INFO_NAME(private_builtin, type_ctor_info, 1));
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ MR_TYPE_CTOR_INFO_NAME(private_builtin, type_info, 1));
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ MR_TYPE_CTOR_INFO_NAME(private_builtin, typeclass_info, 1));
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ MR_TYPE_CTOR_INFO_NAME(private_builtin, base_typeclass_info, 1));
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ MR_TYPE_CTOR_INFO_NAME(type_desc, type_ctor_desc, 0));
+MR_DECLARE_TYPE_CTOR_INFO_STRUCT(
+ MR_TYPE_CTOR_INFO_NAME(type_desc, type_desc, 0));
/*---------------------------------------------------------------------------*/
+
+#ifdef MR_HIGHLEVEL_CODE
+
/*
-** Function declarations
+** Function declarations for manipulating builtin types. All these functions
+** are specific to the high-level-code back-end.
*/
MR_bool MR_CALL mercury__builtin____Unify____int_0_0(MR_Integer x,
Index: runtime/mercury_type_desc.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_desc.h,v
retrieving revision 1.3
diff -u -b -r1.3 mercury_type_desc.h
--- runtime/mercury_type_desc.h 27 Mar 2002 05:18:51 -0000 1.3
+++ runtime/mercury_type_desc.h 11 Sep 2002 03:54:33 -0000
@@ -11,9 +11,10 @@
#ifndef MERCURY_TYPE_DESC_H
#define MERCURY_TYPE_DESC_H
-#include "mercury_wrapper.h" /* for MR_address_of_type_ctor_info_for_pred ... */
#include "mercury_types.h"
#include "mercury_type_info.h"
+#include "mercury_builtin_types.h" /* for the type_ctor_infos of the */
+ /* variable arity type constructors */
/*
** Values of type `types:type_desc' are represented the same way as
@@ -107,11 +108,11 @@
(MR_ConstString) "builtin" )
#define MR_TYPECTOR_DESC_GET_VA_TYPE_CTOR_INFO(T) \
( MR_CHECK_EXPR_TYPE(T, MR_TypeCtorDesc), \
- ((MR_Unsigned) (T) % 4 == 0) \
- ? (MR_address_of_type_ctor_info_for_pred) \
+ (((MR_Unsigned) (T) % 4 == 0) \
+ ? &MR_TYPE_CTOR_INFO_NAME(builtin, pred, 0) \
: (((MR_Unsigned) (T) % 4 == 1) \
- ? (MR_address_of_type_ctor_info_for_func) \
- : (MR_address_of_type_ctor_info_for_tuple) ) )
+ ? &MR_TYPE_CTOR_INFO_NAME(builtin, func, 0) \
+ : &MR_TYPE_CTOR_INFO_NAME(builtin, tuple, 0))) )
#define MR_TYPECTOR_DESC_GET_TYPE_CTOR_INFO(T) \
( MR_TYPECTOR_DESC_IS_VARIABLE_ARITY(T) \
? MR_TYPECTOR_DESC_GET_VA_TYPE_CTOR_INFO(T) \
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list