[m-dev.] for review: rename tag varieties and simple vectors.
Tyson Dowd
trd at cs.mu.OZ.AU
Mon Apr 19 17:10:57 AEST 1999
Hi,
This change does some renaming to meet the new nomenclature introduced
in the RTTI paper.
===================================================================
Estimated hours taken: 5
Rename simple tags as unshared tags, complicated tags as shared
remote tags and complicated constant tags as shared local.
Also rename "simple vector" as "functor descriptor",
"functors vector" as "enum vector".
compiler/base_type_layout.m:
compiler/bytecode.m:
compiler/bytecode_gen.m:
compiler/hlds_data.m:
compiler/make_tags.m:
compiler/switch_gen.m:
compiler/tag_switch.m:
compiler/unify_gen.m:
Perform these renamings in the compiler, renaming a few
functors and data structures.
library/std_util.m:
runtime/mercury_deep_copy_body.h:
runtime/mercury_tabling.c:
runtime/mercury_type_info.c:
runtime/mercury_type_info.h:
Perform these renamings in the library and runtime, renaming
macros and variables.
Index: compiler/base_type_layout.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/base_type_layout.m,v
retrieving revision 1.41
diff -u -r1.41 base_type_layout.m
--- base_type_layout.m 1999/04/08 08:41:00 1.41
+++ base_type_layout.m 1999/04/18 12:56:06
@@ -73,16 +73,16 @@
% vector.
%
% enum vector:
-% - 1 or 0 (1 = enumeration, 0 = complicated constant)
+% - 1 or 0 (1 = enumeration, 0 = shared local)
% - S, the number of constants sharing this tag
% - S strings (functor names)
%
% Note that tag 0 value 0 is presently unassigned. This may be used
% in future for some common case optimization.
%
-% Tag 1 - SIMPLE Word = pointer to simple vector
+% Tag 1 - UNSHARED Word = pointer to functor descriptor
%
-% SIMPLE: Simple vector contains
+% UNSHARED: Functor descriptor contains
% - the arity of the functor (N)
% - N pointers to pseudo-typeinfos (of each argument),
% - a pointer to a string containing the name of this
@@ -100,14 +100,14 @@
% No further indexing is required. The data word points to a
% vector of its argument data.
%
-% Tag 2 - COMPLIC Word = pointer to multiple argument vector
+% Tag 2 - SHARED Word = pointer to functor descriptor vector
%
-% COMPLIC: Multi-argument vector contains F, the number of sharing
-% functors, then F pointers to argument vectors. Data word
-% contains a pointer to a secondary tag word, then argument
-% data. Use the secondary tag to index into the F argument
-% pointers, which point to an argument vector just as in
-% SIMPLE above.
+% SHARED: Multi-argument vector contains F, the number of sharing
+% functors, then F pointers to functor descriptors.
+% Data word contains a pointer to a secondary tag word, then
+% argument data. Use the secondary tag to index into the F
+% argument pointers, which point to a functors descriptors just
+% as in UNSHARED above.
%
% Tag 3 - VAR/EQ Word = type variable number, or pointer to
% indicator, equivalent type_ctor_info
@@ -134,8 +134,7 @@
% the same as an equivalence - the data word has a type
% given by the pseudo-typeinfo (it might be worth taking
% advantage of the fact that the vector for a no_tag type
-% is exactly the same vector that a simple tag type would
-% have - one argument, type of argument, functor).
+% is exactly the same as a functors descriptor).
%
% In any case, you need to look at the equivalent type
% to find out what the data word represents.
@@ -174,11 +173,11 @@
% For discriminated unions, the tables contain:
% - disc. union indicator
% - number of functors this type has
-% - vector of pointers to a simple vector, one for each functor
+% - vector of pointers to functor descriptors, one for each functor
%
% For no_tag types, the tables contain:
% - no_tag indicator
-% - pointers to a simple vector, for the functor
+% - pointers to a functor descriptor, for the functor
%
% For enumerations, the tables contain:
% - enumeration indicator
@@ -208,7 +207,7 @@
% etc).
%
% This means the only information needed in the layout tables is
-% the simple and complicated tag meanings for discriminated unions
+% the unshared and shared tag meanings for discriminated unions
% that don't fall into any of the above categories (not no_tag and
% not enum). In addition, the code for testing which category a
% particular type belongs to could be greatly simplified.
@@ -252,9 +251,9 @@
list(comp_gen_c_data) % generated data
).
-:- type tag_category ---> simple % tagged pointer
- ; complicated % shared tagged pointer
- ; comp_const % shared constants
+:- type tag_category ---> unshared % tagged pointer
+ ; shared_remote % shared tagged pointer
+ ; shared_local % shared constants
; no_tag % special case of equivalence
; unused. % unused tag
@@ -369,8 +368,8 @@
TypeBody = du_type(Ctors, ConsTagMap, Enum, _EqualityPred),
% sort list on tags, so that
- % enums, complicated constants and
- % complicated tags have their shared
+ % enums, shared local tag and
+ % shared remote tags have their shared
% functors in the right order.
map__to_assoc_list(ConsTagMap, UnsortedConsTags),
assoc_list__reverse_members(UnsortedConsTags, RevConsList),
@@ -479,9 +478,9 @@
% Tag values
:- pred base_type_layout__tag_value(tag_category::in, int::out) is det.
-base_type_layout__tag_value(comp_const, 0).
-base_type_layout__tag_value(simple, 1).
-base_type_layout__tag_value(complicated, 2).
+base_type_layout__tag_value(shared_local, 0).
+base_type_layout__tag_value(unshared, 1).
+base_type_layout__tag_value(shared_remote, 2).
base_type_layout__tag_value(no_tag, 3).
base_type_layout__tag_value(unused, 0).
@@ -547,7 +546,7 @@
"type_layout"))]
).
- % Encode a cons tag (simple or complicated) in rvals.
+ % Encode a cons tag (unshared or shared) in rvals.
:- pred base_type_layout__encode_cons_tag(cons_tag, list(maybe(rval)),
layout_info, layout_info).
@@ -555,20 +554,20 @@
base_type_layout__encode_cons_tag(ConsTag, ConsTagRval, LayoutInfo,
LayoutInfo) :-
(
- ConsTag = simple_tag(Tag0)
+ ConsTag = unshared_tag(Tag0)
->
SecTag = 0, Tag = Tag0
;
- ConsTag = complicated_tag(Tag0, SecTag0)
+ ConsTag = shared_remote_tag(Tag0, SecTag0)
->
SecTag = SecTag0, Tag = Tag0
;
- ConsTag = complicated_constant_tag(Tag0, SecTag0)
+ ConsTag = shared_local_tag(Tag0, SecTag0)
->
SecTag = SecTag0, Tag = Tag0
;
error(
- "type_ctor_layout: cons_tag not simple or complicated in du")
+ "type_ctor_layout: cons_tag not shared or unshared in du")
),
base_type_layout__encode_mkword(LayoutInfo, Tag,
const(int_const(SecTag)), ConsTagRval).
@@ -716,7 +715,7 @@
% since it's a no_tag, we'll give it a tag value of 0
% to be consistent, but this doesn't really have any
% meaning.
- base_type_layout__encode_cons_tag(simple_tag(0), ConsTagRvals,
+ base_type_layout__encode_cons_tag(unshared_tag(0), ConsTagRvals,
LayoutInfo1, LayoutInfo),
Rvals = [Rval0, Rval1, Rval2 | ConsTagRvals].
@@ -761,7 +760,7 @@
% For discriminated unions:
%
- % Mixture of simple, complicated and complicated_constant
+ % Mixture of unshared, shared_local and shared_remote
% tags. For each primary tag value, we have a word that
% describes what it represents. The list of words will
% form an array that can be indexed by primary tag.
@@ -799,19 +798,19 @@
base_type_layout__generate_rvals([Tag - ConsList | Rest], LayoutInfo0,
LayoutInfo, Rvals0, Rvals) :-
(
- Tag = simple,
- base_type_layout__handle_simple(ConsList, LayoutInfo0,
+ Tag = unshared,
+ base_type_layout__handle_unshared(ConsList, LayoutInfo0,
LayoutInfo1, Rval),
list__append(Rval, Rvals0, Rvals1)
;
- Tag = complicated,
- base_type_layout__handle_complicated(ConsList, LayoutInfo0,
+ Tag = shared_remote,
+ base_type_layout__handle_shared_remote(ConsList, LayoutInfo0,
LayoutInfo1, Rval),
list__append(Rval, Rvals0, Rvals1)
;
- Tag = comp_const,
- base_type_layout__handle_comp_const(ConsList, LayoutInfo0,
+ Tag = shared_local,
+ base_type_layout__handle_shared_local(ConsList, LayoutInfo0,
LayoutInfo1, Rval),
list__append(Rval, Rvals0, Rvals1)
;
@@ -830,20 +829,21 @@
Rvals1, Rvals).
- % For complicated constants:
+ % For shared local tags:
%
% tag is 0, rest of word is pointer to
% - enum indicator (no, this isn't an enum)
% - S, the number of constants sharing this tag
% - S strings of constant names
-:- pred base_type_layout__handle_comp_const(list(pair(cons_id, cons_tag)),
+:- pred base_type_layout__handle_shared_local(list(pair(cons_id, cons_tag)),
layout_info, layout_info, list(maybe(rval))).
-:- mode base_type_layout__handle_comp_const(in, in, out, out) is det.
+:- mode base_type_layout__handle_shared_local(in, in, out, out) is det.
-base_type_layout__handle_comp_const([], _, _, _) :-
- error("type_ctor_layout: no constructors for complicated constant tag").
-base_type_layout__handle_comp_const([C | Cs], LayoutInfo0, LayoutInfo, Rval) :-
+base_type_layout__handle_shared_local([], _, _, _) :-
+ error("type_ctor_layout: no constructors for shared local tag").
+base_type_layout__handle_shared_local([C | Cs], LayoutInfo0, LayoutInfo,
+ Rval) :-
list__length([C | Cs], NumCtors), % Number of sharers
Rval1 = yes(const(int_const(NumCtors))),
@@ -862,49 +862,49 @@
base_type_layout__get_next_cell_number(NextCellNumber, LayoutInfo0,
LayoutInfo),
- base_type_layout__tag_value(comp_const, Tag),
+ base_type_layout__tag_value(shared_local, Tag),
base_type_layout__encode_create(LayoutInfo, Tag,
[Rval0, Rval1 | CtorNameRvals], no, NextCellNumber, Rval).
- % For simple tags:
+ % For unshared tags:
%
- % Tag 1, with a pointer to a simple vector.
+ % Tag 1, with a pointer to a functor descriptor
-:- pred base_type_layout__handle_simple(list(pair(cons_id, cons_tag)),
+:- pred base_type_layout__handle_unshared(list(pair(cons_id, cons_tag)),
layout_info, layout_info, list(maybe(rval))).
-:- mode base_type_layout__handle_simple(in, in, out, out) is det.
+:- mode base_type_layout__handle_unshared(in, in, out, out) is det.
-base_type_layout__handle_simple(ConsList, LayoutInfo0, LayoutInfo, Rval) :-
- base_type_layout__simple_vector(ConsList, LayoutInfo0, LayoutInfo1,
+base_type_layout__handle_unshared(ConsList, LayoutInfo0, LayoutInfo, Rval) :-
+ base_type_layout__functor_descriptor(ConsList, LayoutInfo0, LayoutInfo1,
EndRvals),
base_type_layout__get_next_cell_number(NextCellNumber, LayoutInfo1,
LayoutInfo),
- base_type_layout__tag_value(simple, Tag),
+ base_type_layout__tag_value(unshared, Tag),
base_type_layout__encode_create(LayoutInfo, Tag, EndRvals, no,
NextCellNumber, Rval).
- % Create a simple vector.
+ % Create a functor descriptor.
%
% N - the arity of this functor
% N pseudo-typeinfos (of the arguments)
% - a string constant (the name of the functor)
% - tag information
-:- pred base_type_layout__simple_vector(list(pair(cons_id, cons_tag)),
+:- pred base_type_layout__functor_descriptor(list(pair(cons_id, cons_tag)),
layout_info, layout_info, list(maybe(rval))).
-:- mode base_type_layout__simple_vector(in, in, out, out) is det.
+:- mode base_type_layout__functor_descriptor(in, in, out, out) is det.
-base_type_layout__simple_vector([], _, _, _) :-
- error("type_ctor_layout: no constructors for simple tag").
-base_type_layout__simple_vector([ConsId - ConsTag | _], LayoutInfo0,
+base_type_layout__functor_descriptor([], _, _, _) :-
+ error("type_ctor_layout: no constructors for unshared tag").
+base_type_layout__functor_descriptor([ConsId - ConsTag | _], LayoutInfo0,
LayoutInfo, EndRvals) :-
(
ConsId = cons(SymName, _Arity)
->
unqualify_name(SymName, ConsString)
;
- error("type_ctor_layout: simple tag with no constructor")
+ error("type_ctor_layout: unshared tag with no constructor")
),
base_type_layout__get_cons_args(LayoutInfo0, ConsId, ConsArgs),
list__length(ConsArgs, NumArgs),
@@ -917,20 +917,20 @@
EndRvals).
- % For complicated tags:
+ % For shared remote tags:
%
% Tag 2, with a pointer to an array containing:
% F - the number of functors sharing this tag
- % F pointers to vectors, with the same info as
- % a functor with a simple tag.
+ % F pointers to functor descriptors
-:- pred base_type_layout__handle_complicated(list(pair(cons_id, cons_tag)),
+:- pred base_type_layout__handle_shared_remote(list(pair(cons_id, cons_tag)),
layout_info, layout_info, list(maybe(rval))).
-:- mode base_type_layout__handle_complicated(in, in, out, out) is det.
+:- mode base_type_layout__handle_shared_remote(in, in, out, out) is det.
-base_type_layout__handle_complicated([], _, _, _) :-
- error("type_ctor_layout: no constructors for complicated tag").
-base_type_layout__handle_complicated([C | Cs], LayoutInfo0, LayoutInfo, Rval) :-
+base_type_layout__handle_shared_remote([], _, _, _) :-
+ error("type_ctor_layout: no constructors for shared remote tag").
+base_type_layout__handle_shared_remote([C | Cs], LayoutInfo0, LayoutInfo,
+ Rval) :-
base_type_layout__get_next_cell_number(NextCellNumber, LayoutInfo0,
LayoutInfo1),
@@ -939,11 +939,11 @@
NumSharersRval = yes(const(int_const(NumCtors))),
% Create rvals for sharers
- % (just like a lot of simples)
+ % (just like a series of unshared tags)
list__foldr(
lambda([Cons::in, Acc::in, NewAcc::out] is det, (
Acc = Rvals0 - LayoutInfoA,
- base_type_layout__handle_simple([Cons], LayoutInfoA,
+ base_type_layout__handle_unshared([Cons], LayoutInfoA,
LayoutInfoB, Rval1),
list__append(Rval1, Rvals0, Rvals1),
NewAcc = Rvals1 - LayoutInfoB)),
@@ -951,7 +951,7 @@
[] - LayoutInfo1,
SharedRvals - LayoutInfo),
- base_type_layout__tag_value(complicated, Tag),
+ base_type_layout__tag_value(shared_remote, Tag),
base_type_layout__encode_create(LayoutInfo, Tag,
[NumSharersRval | SharedRvals], no, NextCellNumber, Rval).
@@ -1004,9 +1004,7 @@
% type_ctor_functors of a no_tag:
%
% - no_tag indicator
- % - pointer to simple vector (same as for simple tag functors
- % in type_ctor_layouts).
- % (the simple vector describes the functor).
+ % - pointer to functor descriptor
:- pred base_type_layout__functors_no_tag(sym_name, type, layout_info,
layout_info, list(maybe(rval))).
@@ -1031,9 +1029,7 @@
%
% - du indicator
% - number of functors
- % - vector of pointers to simple vector (same as for simple tag
- % functors in type_ctor_layouts).
- % (each simple vector describes a functor).
+ % - vector of pointers to functor descriptor
:- pred base_type_layout__functors_du(assoc_list(cons_id, cons_tag),
layout_info, layout_info, list(maybe(rval))).
@@ -1046,8 +1042,8 @@
list__foldr(
lambda([ConsPair::in, Acc::in, NewAcc::out] is det, (
Acc = Rvals0 - LayoutInfoA,
- base_type_layout__simple_vector([ConsPair], LayoutInfoA,
- LayoutInfoB, VectorRvalList),
+ base_type_layout__functor_descriptor([ConsPair],
+ LayoutInfoA, LayoutInfoB, VectorRvalList),
base_type_layout__get_next_cell_number(NextCellNumber,
LayoutInfoB, LayoutInfoC),
VectorRval = yes(create(0, VectorRvalList, no,
@@ -1216,10 +1212,11 @@
:- pred base_type_layout__tag_type_and_value(cons_tag, int, tag_category).
:- mode base_type_layout__tag_type_and_value(in, out, out) is det.
-base_type_layout__tag_type_and_value(simple_tag(Tag), Tag, simple).
-base_type_layout__tag_type_and_value(complicated_tag(Tag, _), Tag, complicated).
-base_type_layout__tag_type_and_value(complicated_constant_tag(Tag, _), Tag,
- comp_const).
+base_type_layout__tag_type_and_value(unshared_tag(Tag), Tag, unshared).
+base_type_layout__tag_type_and_value(shared_remote_tag(Tag, _), Tag,
+ shared_remote).
+base_type_layout__tag_type_and_value(shared_local_tag(Tag, _), Tag,
+ shared_local).
base_type_layout__tag_type_and_value(no_tag, -1, no_tag).
base_type_layout__tag_type_and_value(string_constant(_), -1, unused).
base_type_layout__tag_type_and_value(float_constant(_), -1, unused).
Index: compiler/bytecode.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/bytecode.m,v
retrieving revision 1.37
diff -u -r1.37 bytecode.m
--- bytecode.m 1999/03/22 08:07:03 1.37
+++ bytecode.m 1999/04/13 11:22:39
@@ -90,9 +90,9 @@
:- type byte_var_info ---> var_info(string, type).
:- type byte_cons_tag ---> no_tag
- ; simple_tag(tag_bits)
- ; complicated_tag(tag_bits, int)
- ; complicated_constant_tag(tag_bits, int)
+ ; unshared_tag(tag_bits)
+ ; shared_remote_tag(tag_bits, int)
+ ; shared_local_tag(tag_bits, int)
; enum_tag(int)
.
@@ -787,14 +787,14 @@
:- pred output_tag(byte_cons_tag, io__state, io__state).
:- mode output_tag(in, di, uo) is det.
-output_tag(simple_tag(Primary)) -->
+output_tag(unshared_tag(Primary)) -->
output_byte(0),
output_byte(Primary).
-output_tag(complicated_tag(Primary, Secondary)) -->
+output_tag(shared_remote_tag(Primary, Secondary)) -->
output_byte(1),
output_byte(Primary),
output_int(Secondary).
-output_tag(complicated_constant_tag(Primary, Secondary)) -->
+output_tag(shared_local_tag(Primary, Secondary)) -->
output_byte(2),
output_byte(Primary),
output_int(Secondary).
@@ -807,15 +807,15 @@
:- pred debug_tag(byte_cons_tag, io__state, io__state).
:- mode debug_tag(in, di, uo) is det.
-debug_tag(simple_tag(Primary)) -->
- debug_string("simple_tag"),
+debug_tag(unshared_tag(Primary)) -->
+ debug_string("unshared_tag"),
debug_int(Primary).
-debug_tag(complicated_tag(Primary, Secondary)) -->
- debug_string("complicated_tag"),
+debug_tag(shared_remote_tag(Primary, Secondary)) -->
+ debug_string("shared_remote_tag"),
debug_int(Primary),
debug_int(Secondary).
-debug_tag(complicated_constant_tag(Primary, Secondary)) -->
- debug_string("complicated_constant_tag"),
+debug_tag(shared_local_tag(Primary, Secondary)) -->
+ debug_string("shared_local_tag"),
debug_int(Primary),
debug_int(Secondary).
debug_tag(enum_tag(Enum)) -->
Index: compiler/bytecode_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/bytecode_gen.m,v
retrieving revision 1.41
diff -u -r1.41 bytecode_gen.m
--- bytecode_gen.m 1999/03/22 08:07:04 1.41
+++ bytecode_gen.m 1999/04/13 11:20:13
@@ -640,11 +640,11 @@
:- pred bytecode_gen__map_cons_tag(cons_tag::in, byte_cons_tag::out) is det.
bytecode_gen__map_cons_tag(no_tag, no_tag).
-bytecode_gen__map_cons_tag(simple_tag(Primary), simple_tag(Primary)).
-bytecode_gen__map_cons_tag(complicated_tag(Primary, Secondary),
- complicated_tag(Primary, Secondary)).
-bytecode_gen__map_cons_tag(complicated_constant_tag(Primary, Secondary),
- complicated_constant_tag(Primary, Secondary)).
+bytecode_gen__map_cons_tag(unshared_tag(Primary), unshared_tag(Primary)).
+bytecode_gen__map_cons_tag(shared_remote_tag(Primary, Secondary),
+ shared_remote_tag(Primary, Secondary)).
+bytecode_gen__map_cons_tag(shared_local_tag(Primary, Secondary),
+ shared_local_tag(Primary, Secondary)).
bytecode_gen__map_cons_tag(string_constant(_), _) :-
error("string_constant cons tag for non-string_constant cons id").
bytecode_gen__map_cons_tag(int_constant(IntVal), enum_tag(IntVal)).
Index: compiler/hlds_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_data.m,v
retrieving revision 1.33
diff -u -r1.33 hlds_data.m
--- hlds_data.m 1999/04/08 08:41:04 1.33
+++ hlds_data.m 1999/04/14 05:41:02
@@ -280,23 +280,27 @@
% represented as global data. The word just contains
% the address of the tabling pointer of the
% specified procedure.
- ; simple_tag(tag_bits)
- % This is for constants or functors which only
- % require a simple tag. (A "simple" tag is one
- % which fits on the bottom of a pointer - i.e.
- % two bits for 32-bit architectures, or three bits
- % for 64-bit architectures).
+ ; unshared_tag(tag_bits)
+ % This is for constants or functors which can be
+ % distinguished with just a primary tag.
+ % An "unshared" tag is one which fits on the
+ % bottom of a pointer - i.e. two bits for
+ % 32-bit architectures, or three bits for 64-bit
+ % architectures, and is used for just one
+ % functor).
% For constants we store a tagged zero, for functors
% we store a tagged pointer to the argument vector.
- ; complicated_tag(tag_bits, int)
+ ; shared_remote_tag(tag_bits, int)
% This is for functors or constants which
% require more than just a two-bit tag. In this case,
% we use both a primary and a secondary tag.
+ % Several functors share the primary tag and are
+ % distinguished by the secondary tag.
% The secondary tag is stored as the first word of
% the argument vector. (If it is a constant, then
% in this case there is an argument vector of size 1
% which just holds the secondary tag.)
- ; complicated_constant_tag(tag_bits, int)
+ ; shared_local_tag(tag_bits, int)
% This is for constants which require more than a
% two-bit tag. In this case, we use both a primary
% and a secondary tag, but this time the secondary
@@ -307,7 +311,7 @@
% In this case, we don't need to store the functor,
% and instead we store the argument directly.
- % The type `tag_bits' holds a simple tag value.
+ % The type `tag_bits' holds a primary tag value.
:- type tag_bits == int. % actually only 2 (or maybe 3) bits
Index: compiler/make_tags.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_tags.m,v
retrieving revision 1.28
diff -u -r1.28 make_tags.m
--- make_tags.m 1998/07/08 20:56:41 1.28
+++ make_tags.m 1999/04/13 12:28:21
@@ -86,10 +86,10 @@
NumTagBits = 0
->
( Ctors = [_SingleCtor] ->
- assign_simple_tags(Ctors, 0, 1,
+ assign_unshared_tags(Ctors, 0, 1,
CtorTags0, CtorTags)
;
- assign_complicated_tags(Ctors, 0, 0,
+ assign_shared_remote_tags(Ctors, 0, 0,
CtorTags0, CtorTags)
)
;
@@ -98,7 +98,7 @@
split_constructors(Ctors, Constants, Functors),
assign_constant_tags(Constants, CtorTags0,
CtorTags1, NextTag),
- assign_simple_tags(Functors, NextTag, MaxTag,
+ assign_unshared_tags(Functors, NextTag, MaxTag,
CtorTags1, CtorTags)
)
).
@@ -122,12 +122,12 @@
% If there's no constants, don't do anything. Otherwise,
% allocate the first tag for the constants, and give
- % them all complicated tags with that tag as the
+ % them all shared local tags with that tag as the
% primary tag, and different secondary tags starting from
% zero.
% Note that if there's a single constant, we still give it a
- % complicated_constant_tag rather than a simple_tag. That's
- % because deconstruction of the complicated_constant_tag
+ % shared_local_tag rather than a unshared_tag. That's
+ % because deconstruction of the shared_local_tag
% is more efficient.
assign_constant_tags(Constants, CtorTags0, CtorTags1, NextTag) :-
@@ -136,58 +136,58 @@
CtorTags1 = CtorTags0
;
NextTag = 1,
- assign_complicated_constant_tags(Constants,
+ assign_shared_local_tags(Constants,
0, 0, CtorTags0, CtorTags1)
).
-:- pred assign_simple_tags(list(constructor), int, int, cons_tag_values,
+:- pred assign_unshared_tags(list(constructor), int, int, cons_tag_values,
cons_tag_values).
-:- mode assign_simple_tags(in, in, in, in, out) is det.
+:- mode assign_unshared_tags(in, in, in, in, out) is det.
-assign_simple_tags([], _, _, CtorTags, CtorTags).
-assign_simple_tags([Ctor | Rest], Val, MaxTag, CtorTags0, CtorTags) :-
+assign_unshared_tags([], _, _, CtorTags, CtorTags).
+assign_unshared_tags([Ctor | Rest], Val, MaxTag, CtorTags0, CtorTags) :-
Ctor = ctor(_ExistQVars, _Constraints, Name, Args),
create_cons_id(Name, Args, ConsId),
- % if we're about to run out of simple tags, start assigning
- % complicated tags instead
+ % if we're about to run out of unshared tags, start assigning
+ % shared remote tags instead
( Val = MaxTag, Rest \= [] ->
- assign_complicated_tags([Ctor | Rest], MaxTag, 0,
+ assign_shared_remote_tags([Ctor | Rest], MaxTag, 0,
CtorTags0, CtorTags)
;
- Tag = simple_tag(Val),
+ Tag = unshared_tag(Val),
map__set(CtorTags0, ConsId, Tag, CtorTags1),
Val1 is Val + 1,
- assign_simple_tags(Rest, Val1, MaxTag, CtorTags1, CtorTags)
+ assign_unshared_tags(Rest, Val1, MaxTag, CtorTags1, CtorTags)
).
-:- pred assign_complicated_tags(list(constructor), int, int, cons_tag_values,
+:- pred assign_shared_remote_tags(list(constructor), int, int, cons_tag_values,
cons_tag_values).
-:- mode assign_complicated_tags(in, in, in, in, out) is det.
+:- mode assign_shared_remote_tags(in, in, in, in, out) is det.
-assign_complicated_tags([], _, _, CtorTags, CtorTags).
-assign_complicated_tags([Ctor | Rest], PrimaryVal, SecondaryVal,
+assign_shared_remote_tags([], _, _, CtorTags, CtorTags).
+assign_shared_remote_tags([Ctor | Rest], PrimaryVal, SecondaryVal,
CtorTags0, CtorTags) :-
Ctor = ctor(_ExistQVars, _Constraints, Name, Args),
create_cons_id(Name, Args, ConsId),
- Tag = complicated_tag(PrimaryVal, SecondaryVal),
+ Tag = shared_remote_tag(PrimaryVal, SecondaryVal),
map__set(CtorTags0, ConsId, Tag, CtorTags1),
SecondaryVal1 is SecondaryVal + 1,
- assign_complicated_tags(Rest, PrimaryVal, SecondaryVal1,
+ assign_shared_remote_tags(Rest, PrimaryVal, SecondaryVal1,
CtorTags1, CtorTags).
-:- pred assign_complicated_constant_tags(list(constructor), int, int,
+:- pred assign_shared_local_tags(list(constructor), int, int,
cons_tag_values, cons_tag_values).
-:- mode assign_complicated_constant_tags(in, in, in, in, out) is det.
+:- mode assign_shared_local_tags(in, in, in, in, out) is det.
-assign_complicated_constant_tags([], _, _, CtorTags, CtorTags).
-assign_complicated_constant_tags([Ctor | Rest], PrimaryVal, SecondaryVal,
+assign_shared_local_tags([], _, _, CtorTags, CtorTags).
+assign_shared_local_tags([Ctor | Rest], PrimaryVal, SecondaryVal,
CtorTags0, CtorTags) :-
Ctor = ctor(_ExistQVars, _Constraints, Name, Args),
create_cons_id(Name, Args, ConsId),
- Tag = complicated_constant_tag(PrimaryVal, SecondaryVal),
+ Tag = shared_local_tag(PrimaryVal, SecondaryVal),
map__set(CtorTags0, ConsId, Tag, CtorTags1),
SecondaryVal1 is SecondaryVal + 1,
- assign_complicated_constant_tags(Rest, PrimaryVal, SecondaryVal1,
+ assign_shared_local_tags(Rest, PrimaryVal, SecondaryVal1,
CtorTags1, CtorTags).
%-----------------------------------------------------------------------------%
Index: compiler/switch_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/switch_gen.m,v
retrieving revision 1.69
diff -u -r1.69 switch_gen.m
--- switch_gen.m 1999/03/22 08:07:42 1.69
+++ switch_gen.m 1999/04/13 13:17:01
@@ -204,10 +204,10 @@
switch_gen__priority(no_tag, 0). % should never occur
switch_gen__priority(int_constant(_), 1).
-switch_gen__priority(complicated_constant_tag(_, _), 1).
-switch_gen__priority(simple_tag(_), 2).
+switch_gen__priority(shared_local_tag(_, _), 1).
+switch_gen__priority(unshared_tag(_), 2).
switch_gen__priority(float_constant(_), 3).
-switch_gen__priority(complicated_tag(_, _), 4).
+switch_gen__priority(shared_remote_tag(_, _), 4).
switch_gen__priority(string_constant(_), 5).
switch_gen__priority(pred_closure_tag(_, _), 6). % should never occur
switch_gen__priority(code_addr_constant(_, _), 6). % should never occur
Index: compiler/tag_switch.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/tag_switch.m,v
retrieving revision 1.46
diff -u -r1.46 tag_switch.m
--- tag_switch.m 1998/11/20 04:09:19 1.46
+++ tag_switch.m 1999/04/13 14:18:30
@@ -1142,15 +1142,15 @@
tag_switch__get_ptag_counts_2([], Max, Max, PtagCountMap, PtagCountMap).
tag_switch__get_ptag_counts_2([ConsTag | TagList], MaxPrimary0, MaxPrimary,
PtagCountMap0, PtagCountMap) :-
- ( ConsTag = simple_tag(Primary) ->
+ ( ConsTag = unshared_tag(Primary) ->
int__max(MaxPrimary0, Primary, MaxPrimary1),
( map__search(PtagCountMap0, Primary, _) ->
- error("simple tag is shared")
+ error("unshared tag is shared")
;
map__det_insert(PtagCountMap0, Primary, none - (-1),
PtagCountMap1)
)
- ; ConsTag = complicated_tag(Primary, Secondary) ->
+ ; ConsTag = shared_remote_tag(Primary, Secondary) ->
int__max(MaxPrimary0, Primary, MaxPrimary1),
( map__search(PtagCountMap0, Primary, Target) ->
Target = TagType - MaxSoFar,
@@ -1166,7 +1166,7 @@
map__det_insert(PtagCountMap0, Primary,
remote - Secondary, PtagCountMap1)
)
- ; ConsTag = complicated_constant_tag(Primary, Secondary) ->
+ ; ConsTag = shared_local_tag(Primary, Secondary) ->
int__max(MaxPrimary0, Primary, MaxPrimary1),
( map__search(PtagCountMap0, Primary, Target) ->
Target = TagType - MaxSoFar,
@@ -1200,16 +1200,16 @@
tag_switch__group_cases_by_ptag([], PtagCaseMap, PtagCaseMap).
tag_switch__group_cases_by_ptag([Case0 | Cases0], PtagCaseMap0, PtagCaseMap) :-
Case0 = case(_Priority, Tag, _ConsId, Goal),
- ( Tag = simple_tag(Primary) ->
+ ( Tag = unshared_tag(Primary) ->
( map__search(PtagCaseMap0, Primary, _Group) ->
- error("simple tag is shared")
+ error("unshared tag is shared")
;
map__init(StagGoalMap0),
map__det_insert(StagGoalMap0, -1, Goal, StagGoalMap),
map__det_insert(PtagCaseMap0, Primary,
none - StagGoalMap, PtagCaseMap1)
)
- ; Tag = complicated_tag(Primary, Secondary) ->
+ ; Tag = shared_remote_tag(Primary, Secondary) ->
( map__search(PtagCaseMap0, Primary, Group) ->
Group = StagLoc - StagGoalMap0,
( StagLoc = remote ->
@@ -1228,7 +1228,7 @@
map__det_insert(PtagCaseMap0, Primary,
remote - StagGoalMap, PtagCaseMap1)
)
- ; Tag = complicated_constant_tag(Primary, Secondary) ->
+ ; Tag = shared_local_tag(Primary, Secondary) ->
( map__search(PtagCaseMap0, Primary, Group) ->
Group = StagLoc - StagGoalMap0,
( StagLoc = local ->
Index: compiler/unify_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unify_gen.m,v
retrieving revision 1.95
diff -u -r1.95 unify_gen.m
--- unify_gen.m 1999/04/16 06:04:59 1.95
+++ unify_gen.m 1999/04/19 01:50:39
@@ -236,17 +236,17 @@
error("Attempted tabling_pointer unification").
unify_gen__generate_tag_rval_2(no_tag, _Rval, TestRval) :-
TestRval = const(true).
-unify_gen__generate_tag_rval_2(simple_tag(SimpleTag), Rval, TestRval) :-
+unify_gen__generate_tag_rval_2(unshared_tag(UnsharedTag), Rval, TestRval) :-
TestRval = binop(eq, unop(tag, Rval),
- unop(mktag, const(int_const(SimpleTag)))).
-unify_gen__generate_tag_rval_2(complicated_tag(Bits, Num), Rval, TestRval) :-
+ unop(mktag, const(int_const(UnsharedTag)))).
+unify_gen__generate_tag_rval_2(shared_remote_tag(Bits, Num), Rval, TestRval) :-
TestRval = binop(and,
binop(eq, unop(tag, Rval),
unop(mktag, const(int_const(Bits)))),
binop(eq, lval(field(yes(Bits), Rval,
const(int_const(0)))),
const(int_const(Num)))).
-unify_gen__generate_tag_rval_2(complicated_constant_tag(Bits, Num), Rval,
+unify_gen__generate_tag_rval_2(shared_local_tag(Bits, Num), Rval,
TestRval) :-
TestRval = binop(eq, Rval,
mkword(Bits, unop(mkbody, const(int_const(Num))))).
@@ -293,7 +293,7 @@
{ error(
"unify_gen__generate_construction_2: no_tag: arity != 1") }
).
-unify_gen__generate_construction_2(simple_tag(SimpleTag),
+unify_gen__generate_construction_2(unshared_tag(UnsharedTag),
Var, Args, Modes, Code) -->
code_info__get_module_info(ModuleInfo),
code_info__get_next_cell_number(CellNo),
@@ -305,9 +305,9 @@
{ unify_gen__var_type_msg(VarType, VarTypeMsg) },
% XXX Later we will need to worry about
% whether the cell must be unique or not.
- { Expr = create(SimpleTag, RVals, no, CellNo, VarTypeMsg) },
+ { Expr = create(UnsharedTag, RVals, no, CellNo, VarTypeMsg) },
code_info__cache_expression(Var, Expr).
-unify_gen__generate_construction_2(complicated_tag(Bits0, Num0),
+unify_gen__generate_construction_2(shared_remote_tag(Bits0, Num0),
Var, Args, Modes, Code) -->
code_info__get_module_info(ModuleInfo),
code_info__get_next_cell_number(CellNo),
@@ -323,7 +323,7 @@
% whether the cell must be unique or not.
{ Expr = create(Bits0, RVals, no, CellNo, VarTypeMsg) },
code_info__cache_expression(Var, Expr).
-unify_gen__generate_construction_2(complicated_constant_tag(Bits1, Num1),
+unify_gen__generate_construction_2(shared_local_tag(Bits1, Num1),
Var, _Args, _Modes, Code) -->
{ Code = empty },
code_info__cache_expression(Var,
@@ -706,15 +706,15 @@
{ error("unify_gen__generate_det_deconstruction: no_tag: arity != 1") }
)
;
- { Tag = simple_tag(SimpleTag) },
+ { Tag = unshared_tag(UnsharedTag) },
{ Rval = var(Var) },
{ unify_gen__make_fields_and_argvars(Args, Rval, 0,
- SimpleTag, Fields, ArgVars) },
+ UnsharedTag, Fields, ArgVars) },
unify_gen__var_types(Args, ArgTypes),
unify_gen__generate_unify_args(Fields, ArgVars,
Modes, ArgTypes, Code)
;
- { Tag = complicated_tag(Bits0, _Num0) },
+ { Tag = shared_remote_tag(Bits0, _Num0) },
{ Rval = var(Var) },
{ unify_gen__make_fields_and_argvars(Args, Rval, 1,
Bits0, Fields, ArgVars) },
@@ -722,7 +722,7 @@
unify_gen__generate_unify_args(Fields, ArgVars,
Modes, ArgTypes, Code)
;
- { Tag = complicated_constant_tag(_Bits1, _Num1) },
+ { Tag = shared_local_tag(_Bits1, _Num1) },
{ Code = empty } % if this is det, then nothing happens
).
Index: library/std_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/std_util.m,v
retrieving revision 1.144
diff -u -r1.144 std_util.m
--- std_util.m 1999/04/16 06:05:19 1.144
+++ std_util.m 1999/04/19 05:18:01
@@ -1306,7 +1306,7 @@
typedef struct ML_Construct_Info_Struct {
int vector_type;
int arity;
- Word *functors_vector;
+ Word *functor_descriptor;
Word *argument_vector;
Word primary_tag;
Word secondary_tag;
@@ -1703,7 +1703,7 @@
term_vector = (Word) &new_data;
} else if (tag(layout_entry) ==
- TYPE_CTOR_LAYOUT_COMPLICATED_TAG) {
+ TYPE_CTOR_LAYOUT_SHARED_REMOTE_TAG) {
/*
** Create arity + 1 words, fill in the
@@ -1718,8 +1718,8 @@
/*
** If it's a du, and this tag is
- ** constant, it must be a complicated
- ** constant tag.
+ ** constant, it must be a shared local
+ ** tag.
*/
new_data = mkbody(info.secondary_tag);
@@ -1728,7 +1728,7 @@
} else {
/*
- ** A simple tagged word, just need to
+ ** An unshared tagged word, just need to
** create arguments.
*/
@@ -1797,42 +1797,48 @@
switch (info->vector_type) {
case MR_TYPE_CTOR_FUNCTORS_ENUM:
- info->functors_vector = MR_TYPE_CTOR_FUNCTORS_ENUM_FUNCTORS(
+ info->functor_descriptor = MR_TYPE_CTOR_FUNCTORS_ENUM_VECTOR(
type_ctor_functors);
info->arity = 0;
info->argument_vector = NULL;
info->primary_tag = 0;
info->secondary_tag = functor_number;
- info->functor_name = MR_TYPE_CTOR_LAYOUT_ENUM_VECTOR_FUNCTOR_NAME(
- info->functors_vector, functor_number);
+ info->functor_name =
+ MR_TYPE_CTOR_LAYOUT_ENUM_VECTOR_FUNCTOR_NAME(
+ info->functor_descriptor, functor_number);
break;
case MR_TYPE_CTOR_FUNCTORS_DU:
- info->functors_vector = MR_TYPE_CTOR_FUNCTORS_DU_FUNCTOR_N(
+ info->functor_descriptor =
+ MR_TYPE_CTOR_FUNCTORS_DU_FUNCTOR_N(
type_ctor_functors, functor_number);
- info->arity = MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_ARITY(
- info->functors_vector);
- info->argument_vector = MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_ARGS(
- info->functors_vector);
- info->primary_tag = tag(MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_TAG(
- info->functors_vector));
+ info->arity = MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_ARITY(
+ info->functor_descriptor);
+ info->argument_vector =
+ MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_ARGS(
+ info->functor_descriptor);
+ info->primary_tag = tag(
+ MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_TAG(
+ info->functor_descriptor));
info->secondary_tag = unmkbody(
- body(MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_TAG(
- info->functors_vector), info->primary_tag));
- info->functor_name = MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_FUNCTOR_NAME(
- info->functors_vector);
+ body(MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_TAG(
+ info->functor_descriptor), info->primary_tag));
+ info->functor_name =
+ MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_FUNCTOR_NAME(
+ info->functor_descriptor);
break;
case MR_TYPE_CTOR_FUNCTORS_NO_TAG:
- info->functors_vector = MR_TYPE_CTOR_FUNCTORS_NO_TAG_FUNCTOR(
+ info->functor_descriptor =
+ MR_TYPE_CTOR_FUNCTORS_NO_TAG_FUNCTOR(
type_ctor_functors);
info->arity = 1;
info->argument_vector = MR_TYPE_CTOR_LAYOUT_NO_TAG_VECTOR_ARGS(
- info->functors_vector);
+ info->functor_descriptor);
info->primary_tag = 0;
info->secondary_tag = 0;
info->functor_name = MR_TYPE_CTOR_LAYOUT_NO_TAG_VECTOR_FUNCTOR_NAME(
- info->functors_vector);
+ info->functor_descriptor);
break;
case MR_TYPE_CTOR_FUNCTORS_EQUIV: {
@@ -2245,7 +2251,7 @@
info->type_info_vector = NULL;
break;
- case MR_DATAREP_COMPLICATED_CONST:
+ case MR_DATAREP_SHARED_LOCAL:
data_value = unmkbody(data_value);
info->functor = MR_TYPE_CTOR_LAYOUT_ENUM_VECTOR_FUNCTOR_NAME(
entry_value, data_value);
@@ -2254,34 +2260,35 @@
info->type_info_vector = NULL;
break;
- case MR_DATAREP_COMPLICATED: {
+ case MR_DATAREP_SHARED_REMOTE: {
Word secondary_tag;
secondary_tag = ((Word *) data_value)[0];
/*
- * Look past the secondary tag, and get the simple vector,
- * then we can just use the code for simple tags.
+ * Look past the secondary tag, and get the functor
+ * descriptor, then we can just use the code for
+ * unshared tags.
*/
data_value = (Word) ((Word *) data_value + 1);
entry_value = (Word)
- MR_TYPE_CTOR_LAYOUT_COMPLICATED_VECTOR_GET_SIMPLE_VECTOR(
+ MR_TYPE_CTOR_LAYOUT_SHARED_REMOTE_VECTOR_GET_FUNCTOR_DESCRIPTOR(
entry_value, secondary_tag);
entry_value = strip_tag(entry_value);
} /* fallthru */
- case MR_DATAREP_SIMPLE: /* fallthru */
+ case MR_DATAREP_UNSHARED: /* fallthru */
{
int i;
- Word * simple_vector = (Word *) entry_value;
+ Word * functor_descriptor = (Word *) entry_value;
info->arity =
- MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_ARITY(simple_vector);
+ MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_ARITY(functor_descriptor);
if (info->need_functor) {
make_aligned_string(info->functor,
- MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_FUNCTOR_NAME(
- simple_vector));
+ MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_FUNCTOR_NAME(
+ functor_descriptor));
}
if (info->need_args) {
@@ -2293,7 +2300,8 @@
Word *arg_pseudo_type_info;
arg_pseudo_type_info = (Word *)
- MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_ARGS(simple_vector)[i];
+ MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_ARGS(
+ functor_descriptor)[i];
info->type_info_vector[i] = (Word) MR_create_type_info(
type_info, arg_pseudo_type_info);
}
@@ -2304,21 +2312,22 @@
case MR_DATAREP_NOTAG:
{
int i;
- Word * simple_vector = (Word *) entry_value;
+ Word * functor_descriptor = (Word *) entry_value;
data_value = (Word) data_word_ptr;
- info->arity = MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_ARITY(simple_vector);
+ info->arity = MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_ARITY(
+ functor_descriptor);
if (info->need_functor) {
make_aligned_string(info->functor,
- MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_FUNCTOR_NAME(
- simple_vector));
+ MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_FUNCTOR_NAME(
+ functor_descriptor));
}
if (info->need_args) {
/*
- * A NO_TAG is much like SIMPLE, but we use the
+ * A NO_TAG is much like UNSHARED, but we use the
* data_word_ptr here to simulate an argument
* vector.
*/
@@ -2330,7 +2339,8 @@
Word *arg_pseudo_type_info;
arg_pseudo_type_info = (Word *)
- MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_ARGS(simple_vector)[i];
+ MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_ARGS(
+ functor_descriptor)[i];
info->type_info_vector[i] = (Word) MR_create_type_info(
type_info, arg_pseudo_type_info);
}
Index: runtime/mercury_deep_copy_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_copy_body.h,v
retrieving revision 1.8
diff -u -r1.8 mercury_deep_copy_body.h
--- mercury_deep_copy_body.h 1999/03/25 09:46:23 1.8
+++ mercury_deep_copy_body.h 1999/04/18 10:10:55
@@ -51,11 +51,11 @@
switch (data_rep) {
case MR_DATAREP_ENUM: /* fallthru */
- case MR_DATAREP_COMPLICATED_CONST:
+ case MR_DATAREP_SHARED_LOCAL:
new_data = data; /* just a copy of the actual item */
break;
- case MR_DATAREP_COMPLICATED: {
+ case MR_DATAREP_SHARED_REMOTE: {
Word secondary_tag;
Word *new_entry;
Word *argument_vector, *type_info_vector;
@@ -69,10 +69,11 @@
secondary_tag = *data_value;
argument_vector = data_value + 1;
- new_entry = MR_TYPE_CTOR_LAYOUT_COMPLICATED_VECTOR_GET_SIMPLE_VECTOR(
+ new_entry = MR_TYPE_CTOR_LAYOUT_SHARED_REMOTE_VECTOR_GET_FUNCTOR_DESCRIPTOR(
entry_value, secondary_tag);
- arity = new_entry[TYPE_CTOR_LAYOUT_SIMPLE_ARITY_OFFSET];
- type_info_vector = new_entry + TYPE_CTOR_LAYOUT_SIMPLE_ARGS_OFFSET;
+ arity = new_entry[TYPE_CTOR_LAYOUT_UNSHARED_ARITY_OFFSET];
+ type_info_vector = new_entry +
+ TYPE_CTOR_LAYOUT_UNSHARED_ARGS_OFFSET;
/* allocate space for new args, and secondary tag */
incr_saved_hp(new_data, arity + 1);
@@ -98,15 +99,16 @@
break;
}
- case MR_DATAREP_SIMPLE: {
+ case MR_DATAREP_UNSHARED: {
int arity, i;
Word *argument_vector, *type_info_vector;
argument_vector = data_value;
/* If the argument vector is in range, copy the arguments */
if (in_range(argument_vector)) {
- arity = entry_value[TYPE_CTOR_LAYOUT_SIMPLE_ARITY_OFFSET];
- type_info_vector = entry_value + TYPE_CTOR_LAYOUT_SIMPLE_ARGS_OFFSET;
+ arity = entry_value[TYPE_CTOR_LAYOUT_UNSHARED_ARITY_OFFSET];
+ type_info_vector = entry_value +
+ TYPE_CTOR_LAYOUT_UNSHARED_ARGS_OFFSET;
/* allocate space for new args. */
incr_saved_hp(new_data, arity);
Index: runtime/mercury_tabling.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_tabling.c,v
retrieving revision 1.2
diff -u -r1.2 mercury_tabling.c
--- mercury_tabling.c 1999/03/22 08:09:06 1.2
+++ mercury_tabling.c 1999/04/19 05:18:41
@@ -494,22 +494,23 @@
MR_DEBUG_TABLE_ENUM(table, functors, data);
break;
}
- case MR_DATAREP_COMPLICATED_CONST: {
+ case MR_DATAREP_SHARED_LOCAL: {
int functors = MR_TYPE_CTOR_LAYOUT_ENUM_VECTOR_NUM_FUNCTORS(
layout_vector_for_tag);
MR_DEBUG_TABLE_TAG(table, data_tag);
MR_DEBUG_TABLE_ENUM(table, functors, unmkbody(data));
break;
}
- case MR_DATAREP_SIMPLE: {
+ case MR_DATAREP_UNSHARED: {
int arity, i;
Word *argument_vector, *type_info_vector, *new_type_info;
argument_vector = data_value;
- arity = layout_vector_for_tag[TYPE_CTOR_LAYOUT_SIMPLE_ARITY_OFFSET];
+ arity = layout_vector_for_tag[
+ TYPE_CTOR_LAYOUT_UNSHARED_ARITY_OFFSET];
type_info_vector = &layout_vector_for_tag[
- TYPE_CTOR_LAYOUT_SIMPLE_ARGS_OFFSET];
+ TYPE_CTOR_LAYOUT_UNSHARED_ARGS_OFFSET];
MR_DEBUG_TABLE_TAG(table, data_tag);
@@ -522,7 +523,7 @@
}
break;
}
- case MR_DATAREP_COMPLICATED: {
+ case MR_DATAREP_SHARED_REMOTE: {
int arity, i;
Word *argument_vector, *type_info_vector, *new_type_info;
Word secondary_tag, num_sharers, *new_layout_vector;
@@ -530,14 +531,14 @@
secondary_tag = *data_value;
argument_vector = data_value + 1;
- num_sharers = MR_TYPE_CTOR_LAYOUT_COMPLICATED_VECTOR_NUM_SHARERS(
+ num_sharers = MR_TYPE_CTOR_LAYOUT_SHARED_REMOTE_VECTOR_NUM_SHARERS(
layout_vector_for_tag);
new_layout_vector =
- MR_TYPE_CTOR_LAYOUT_COMPLICATED_VECTOR_GET_SIMPLE_VECTOR(
+ MR_TYPE_CTOR_LAYOUT_SHARED_REMOTE_VECTOR_GET_FUNCTOR_DESCRIPTOR(
layout_vector_for_tag, secondary_tag);
- arity = new_layout_vector[TYPE_CTOR_LAYOUT_SIMPLE_ARITY_OFFSET];
+ arity = new_layout_vector[TYPE_CTOR_LAYOUT_UNSHARED_ARITY_OFFSET];
type_info_vector =
- &new_layout_vector[TYPE_CTOR_LAYOUT_SIMPLE_ARGS_OFFSET];
+ &new_layout_vector[TYPE_CTOR_LAYOUT_UNSHARED_ARGS_OFFSET];
MR_DEBUG_TABLE_TAG(table, data_tag);
MR_DEBUG_TABLE_ENUM(table, num_sharers, secondary_tag);
Index: runtime/mercury_type_info.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_info.c,v
retrieving revision 1.18
diff -u -r1.18 mercury_type_info.c
--- mercury_type_info.c 1999/04/08 08:42:12 1.18
+++ mercury_type_info.c 1999/04/16 04:19:27
@@ -550,12 +550,12 @@
return MR_DATAREP_ENUM;
case MR_TYPE_CTOR_FUNCTORS_DU:
switch ((int) tag(layout_entry)) {
- case TYPE_CTOR_LAYOUT_SIMPLE_TAG:
- return MR_DATAREP_SIMPLE;
- case TYPE_CTOR_LAYOUT_COMPLICATED_TAG:
- return MR_DATAREP_COMPLICATED;
+ case TYPE_CTOR_LAYOUT_UNSHARED_TAG:
+ return MR_DATAREP_UNSHARED;
+ case TYPE_CTOR_LAYOUT_SHARED_REMOTE_TAG:
+ return MR_DATAREP_SHARED_REMOTE;
case TYPE_CTOR_LAYOUT_CONST_TAG:
- return MR_DATAREP_COMPLICATED_CONST;
+ return MR_DATAREP_SHARED_LOCAL;
default:
return MR_DATAREP_UNKNOWN;
}
Index: runtime/mercury_type_info.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_info.h,v
retrieving revision 1.18
diff -u -r1.18 mercury_type_info.h
--- mercury_type_info.h 1999/04/16 06:05:40 1.18
+++ mercury_type_info.h 1999/04/19 01:37:34
@@ -224,9 +224,9 @@
*/
#define TYPE_CTOR_LAYOUT_CONST_TAG 0
-#define TYPE_CTOR_LAYOUT_COMP_CONST_TAG 0
-#define TYPE_CTOR_LAYOUT_SIMPLE_TAG 1
-#define TYPE_CTOR_LAYOUT_COMPLICATED_TAG 2
+#define TYPE_CTOR_LAYOUT_SHARED_LOCAL_TAG 0
+#define TYPE_CTOR_LAYOUT_UNSHARED_TAG 1
+#define TYPE_CTOR_LAYOUT_SHARED_REMOTE_TAG 2
#define TYPE_CTOR_LAYOUT_EQUIV_TAG 3
#define TYPE_CTOR_LAYOUT_NO_TAG 3
@@ -314,17 +314,17 @@
** Constant and enumeration values start at 0, so the functor
** is at OFFSET + const/enum value.
**
-** Functors for simple tags are at OFFSET + arity (the functor is
+** Functors for unshared tags are at OFFSET + arity (the functor is
** stored after all the argument info.
**
*/
#define TYPE_CTOR_LAYOUT_CONST_FUNCTOR_OFFSET 2
#define TYPE_CTOR_LAYOUT_ENUM_FUNCTOR_OFFSET 2
-#define TYPE_CTOR_LAYOUT_SIMPLE_FUNCTOR_OFFSET 1
+#define TYPE_CTOR_LAYOUT_UNSHARED_FUNCTOR_OFFSET 1
-#define TYPE_CTOR_LAYOUT_SIMPLE_ARITY_OFFSET 0
-#define TYPE_CTOR_LAYOUT_SIMPLE_ARGS_OFFSET 1
+#define TYPE_CTOR_LAYOUT_UNSHARED_ARITY_OFFSET 0
+#define TYPE_CTOR_LAYOUT_UNSHARED_ARGS_OFFSET 1
/*---------------------------------------------------------------------------*/
@@ -506,45 +506,48 @@
/*
** Macros to access the data in a discriminated union
- ** type_functors, the number of functors, and the simple_vector
+ ** type_functors, the number of functors, and the functor descriptor
** for functor number N (where N starts at 1).
*/
#define MR_TYPE_CTOR_FUNCTORS_DU_OFFSET_FOR_NUM_FUNCTORS ((Integer) 1)
-#define MR_TYPE_CTOR_FUNCTORS_DU_OFFSET_FOR_FUNCTORS_VECTOR ((Integer) 2)
+#define MR_TYPE_CTOR_FUNCTORS_DU_OFFSET_FOR_FUNCTOR_DESCRIPTORS ((Integer) 2)
#define MR_TYPE_CTOR_FUNCTORS_DU_NUM_FUNCTORS(Functors) \
((Functors)[MR_TYPE_CTOR_FUNCTORS_DU_OFFSET_FOR_NUM_FUNCTORS])
#define MR_TYPE_CTOR_FUNCTORS_DU_FUNCTOR_N(Functor, N) \
((Word *) ((Functor)[ \
- MR_TYPE_CTOR_FUNCTORS_DU_OFFSET_FOR_FUNCTORS_VECTOR + N]))
+ MR_TYPE_CTOR_FUNCTORS_DU_OFFSET_FOR_FUNCTOR_DESCRIPTORS + N]))
/*
** Macros to access the data in a enumeration type_functors, the
** number of functors, and the enumeration vector.
*/
-#define MR_TYPE_CTOR_FUNCTORS_ENUM_OFFSET_FOR_FUNCTORS_VECTOR ((Integer) 1)
+#define MR_TYPE_CTOR_FUNCTORS_ENUM_OFFSET_FOR_ENUM_VECTOR \
+ ((Integer) 1)
-#define MR_TYPE_CTOR_FUNCTORS_ENUM_NUM_FUNCTORS(Functors) \
+#define MR_TYPE_CTOR_FUNCTORS_ENUM_NUM_FUNCTORS(Functors) \
MR_TYPE_CTOR_LAYOUT_ENUM_VECTOR_NUM_FUNCTORS( \
- MR_TYPE_CTOR_FUNCTORS_ENUM_FUNCTORS((Functors)))
+ MR_TYPE_CTOR_FUNCTORS_ENUM_VECTOR((Functors)))
-#define MR_TYPE_CTOR_FUNCTORS_ENUM_FUNCTORS(Functor) \
- ((Word *) ((Functor)[MR_TYPE_CTOR_FUNCTORS_ENUM_OFFSET_FOR_FUNCTORS_VECTOR]))
+#define MR_TYPE_CTOR_FUNCTORS_ENUM_VECTOR(Functor) \
+ ((Word *) ((Functor) \
+ [MR_TYPE_CTOR_FUNCTORS_ENUM_OFFSET_FOR_ENUM_VECTOR]))
/*
** Macros to access the data in a no_tag type_functors, the
- ** simple_vector for the functor (there can only be one functor
+ ** functor descriptor for the functor (there can only be one functor
** with no_tags).
*/
-#define MR_TYPE_CTOR_FUNCTORS_NO_TAG_OFFSET_FOR_FUNCTORS_VECTOR ((Integer) 1)
+#define MR_TYPE_CTOR_FUNCTORS_NO_TAG_OFFSET_FOR_FUNCTOR_DESCRIPTOR \
+ ((Integer) 1)
#define MR_TYPE_CTOR_FUNCTORS_NO_TAG_FUNCTOR(Functors) \
((Word *) ((Functors) \
- [MR_TYPE_CTOR_FUNCTORS_NO_TAG_OFFSET_FOR_FUNCTORS_VECTOR]))
+ [MR_TYPE_CTOR_FUNCTORS_NO_TAG_OFFSET_FOR_FUNCTOR_DESCRIPTOR]))
/*
** Macros to access the data in an equivalence type_functors,
@@ -553,16 +556,16 @@
#define MR_TYPE_CTOR_FUNCTORS_EQUIV_OFFSET_FOR_TYPE ((Integer) 1)
-#define MR_TYPE_CTOR_FUNCTORS_EQUIV_TYPE(Functors) \
+#define MR_TYPE_CTOR_FUNCTORS_EQUIV_TYPE(Functors) \
((Functors)[MR_TYPE_CTOR_FUNCTORS_EQUIV_OFFSET_FOR_TYPE])
/*---------------------------------------------------------------------------*/
/*
-** Macros and defintions for defining and dealing with the vectors
+** Macros and defintions for defining and dealing with the data structures
** created by type_ctor_layouts (these are the same vectors referred to
** by type_ctor_functors)
-** - the simple_vector, describing a single functor
+** - the functor descriptor, describing a single functor
** - the enum_vector, describing an enumeration
** - the no_tag_vector, describing a single functor
*/
@@ -584,7 +587,7 @@
#define MR_TYPE_CTOR_LAYOUT_ENUM_VECTOR_IS_ENUM(Vector) \
((MR_TypeLayout_EnumVector *) (Vector))->enum_or_comp_const
-#define MR_TYPE_CTOR_LAYOUT_ENUM_VECTOR_NUM_FUNCTORS(Vector) \
+#define MR_TYPE_CTOR_LAYOUT_ENUM_VECTOR_NUM_FUNCTORS(Vector) \
((MR_TypeLayout_EnumVector *) (Vector))->num_sharers
#define MR_TYPE_CTOR_LAYOUT_ENUM_VECTOR_FUNCTOR_NAME(Vector, N) \
@@ -592,48 +595,66 @@
/*
- ** Macros for dealing with simple vectors.
+ ** Macros for dealing with functor descriptors.
+ **
+ ** XXX we might like to re-organize this structure so the
+ ** variable length component isn't such a pain.
*/
-
-#define MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_OFFSET_FOR_ARITY ((Integer) 0)
-#define MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_OFFSET_FOR_ARGS ((Integer) 1)
- /* Note, these offsets are from the end of the args */
-#define MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_OFFSET_FOR_FUNCTOR_NAME ((Integer) 1)
-#define MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_OFFSET_FOR_FUNCTOR_TAG ((Integer) 2)
-
-#define MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_ARITY(V) \
- ((V)[MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_OFFSET_FOR_ARITY])
-#define MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_ARGS(V) \
- (V + MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_OFFSET_FOR_ARGS)
+typedef struct {
+ Integer arity;
+ Word arg1;
+/* other functors follow, arity of them.
+** Word arg2;
+** ...
+** ConstString functorname;
+** Word tagbits;
+*/
+} MR_TypeLayout_FunctorDescriptor;
-#define MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_FUNCTOR_NAME(V) \
- ((String) ((V)[MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_ARITY(V) + \
- MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_OFFSET_FOR_FUNCTOR_NAME]))
-
-#define MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_TAG(V) \
- ((Word) ((V)[MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_ARITY(V) + \
- MR_TYPE_CTOR_LAYOUT_SIMPLE_VECTOR_OFFSET_FOR_FUNCTOR_TAG]))
+#define MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_OFFSET_FOR_ARITY \
+ ((Integer) 0)
+#define MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_OFFSET_FOR_ARGS ((Integer) 1)
+ /* Note, these offsets are from the end of the args */
+#define MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_OFFSET_FOR_FUNCTOR_NAME \
+ ((Integer) 1)
+#define MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_OFFSET_FOR_FUNCTOR_TAG \
+ ((Integer) 2)
+
+#define MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_ARITY(V) \
+ ((V)[MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_OFFSET_FOR_ARITY])
+
+#define MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_ARGS(V) \
+ (V + MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_OFFSET_FOR_ARGS)
+
+#define MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_FUNCTOR_NAME(V) \
+ ((String) ((V)[MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_ARITY(V) + \
+ MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_OFFSET_FOR_FUNCTOR_NAME]))
+
+#define MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_TAG(V) \
+ ((Word) ((V)[MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_ARITY(V) + \
+ MR_TYPE_CTOR_LAYOUT_FUNCTOR_DESCRIPTOR_OFFSET_FOR_FUNCTOR_TAG]))
/*
- ** Macros for dealing with complicated vectors.
+ ** Macros for dealing with shared remote vectors.
*/
typedef struct {
Word num_sharers;
- Word simple_vector1;
-/* other simple_vectors follow, num_sharers of them.
-** Word simple_vector2;
+ Word functor_descriptor1;
+/* other functor descriptors follow, num_sharers of them.
+** Word functor_descriptor2;
** ...
*/
-} MR_TypeLayout_ComplicatedVector;
+} MR_TypeLayout_SharedRemoteVector;
-#define MR_TYPE_CTOR_LAYOUT_COMPLICATED_VECTOR_NUM_SHARERS(Vector) \
- ((MR_TypeLayout_ComplicatedVector *) (Vector))->num_sharers
+#define MR_TYPE_CTOR_LAYOUT_SHARED_REMOTE_VECTOR_NUM_SHARERS(Vector) \
+ (((MR_TypeLayout_SharedRemoteVector *) (Vector))->num_sharers)
-#define MR_TYPE_CTOR_LAYOUT_COMPLICATED_VECTOR_GET_SIMPLE_VECTOR(Vector, N) \
- ( (Word *) strip_tag((&((MR_TypeLayout_ComplicatedVector *) \
- (Vector))->simple_vector1) [N]) )
+#define MR_TYPE_CTOR_LAYOUT_SHARED_REMOTE_VECTOR_GET_FUNCTOR_DESCRIPTOR( \
+ Vector, N) \
+ ( (Word *) strip_tag((&((MR_TypeLayout_SharedRemoteVector *) \
+ (Vector))->functor_descriptor1) [N]) )
/*
** Macros for dealing with no_tag vectors
@@ -647,7 +668,7 @@
ConstString name;
} MR_TypeLayout_NoTagVector;
-#define MR_TYPE_CTOR_LAYOUT_NO_TAG_VECTOR_IS_NO_TAG(Vector) \
+#define MR_TYPE_CTOR_LAYOUT_NO_TAG_VECTOR_IS_NO_TAG(Vector) \
((MR_TypeLayout_NoTagVector *) (Vector))->is_no_tag
#define MR_TYPE_CTOR_LAYOUT_NO_TAG_VECTOR_ARITY(Vector) \
@@ -670,7 +691,7 @@
#define MR_TYPE_CTOR_LAYOUT_EQUIV_OFFSET_FOR_TYPE ((Integer) 1)
-#define MR_TYPE_CTOR_LAYOUT_EQUIV_IS_EQUIV(Vector) \
+#define MR_TYPE_CTOR_LAYOUT_EQUIV_IS_EQUIV(Vector) \
(!((MR_TypeLayout_EquivVector *) (Vector))->is_no_tag)
#define MR_TYPE_CTOR_LAYOUT_EQUIV_TYPE(Vector) \
@@ -684,16 +705,16 @@
** type_ctor_infos
*/
-#define MR_TYPEINFO_GET_TYPE_CTOR_INFO(TypeInfo) \
+#define MR_TYPEINFO_GET_TYPE_CTOR_INFO(TypeInfo) \
((*TypeInfo) ? (Word *) *TypeInfo : (Word *) (Word) TypeInfo)
#define MR_TYPEINFO_GET_HIGHER_ARITY(TypeInfo) \
((Integer) (Word *) (TypeInfo)[TYPEINFO_OFFSET_FOR_PRED_ARITY])
-#define MR_TYPE_CTOR_INFO_GET_TYPE_CTOR_FUNCTORS(BaseTypeInfo) \
+#define MR_TYPE_CTOR_INFO_GET_TYPE_CTOR_FUNCTORS(BaseTypeInfo) \
((Word *) (BaseTypeInfo)[OFFSET_FOR_BASE_TYPE_FUNCTORS])
-#define MR_TYPE_CTOR_INFO_GET_TYPE_CTOR_LAYOUT(BaseTypeInfo) \
+#define MR_TYPE_CTOR_INFO_GET_TYPE_CTOR_LAYOUT(BaseTypeInfo) \
((Word *) (BaseTypeInfo)[OFFSET_FOR_BASE_TYPE_LAYOUT])
#define MR_TYPE_CTOR_INFO_GET_TYPE_CTOR_LAYOUT_ENTRY(BaseTypeInfo, Tag) \
@@ -774,20 +795,6 @@
typedef struct {
Word arity;
- Word arg1;
-/* other arguments follow, there are arity of them,
-** then followed by functor name, and functor tag.
-** Word arg2;
-** ...
-** Word argarity;
-** ConstString functorname;
-** Word tag;
-*/
-} MR_TypeLayout_SimpleVector;
-
-
-typedef struct {
- Word arity;
Word arg_pseudo_type_infos[1]; /* variable-sized array */
/* actualy length is `arity', not 1 */
} MR_TypeLayout_part1;
@@ -906,9 +913,9 @@
*/
enum MR_DataRepresentation {
MR_DATAREP_ENUM,
- MR_DATAREP_COMPLICATED_CONST,
- MR_DATAREP_COMPLICATED,
- MR_DATAREP_SIMPLE,
+ MR_DATAREP_SHARED_LOCAL,
+ MR_DATAREP_SHARED_REMOTE,
+ MR_DATAREP_UNSHARED,
MR_DATAREP_NOTAG,
MR_DATAREP_EQUIV,
MR_DATAREP_EQUIV_VAR,
--
Tyson Dowd # There isn't any reason why Linux can't be
# implemented as an enterprise computing solution.
trd at cs.mu.oz.au # Find out what you've been missing while you've
http://www.cs.mu.oz.au/~trd # been rebooting Windows NT. -- InfoWorld, 1998.
--------------------------------------------------------------------------
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