Commit f20b3093 authored by John van Groningen's avatar John van Groningen
Browse files

in the generic representation use RECORD instead of OBJECT and CONS for records,

change GenericInfo
parent 36099dbf
......@@ -44,7 +44,7 @@ where
# initial_info =
{ gen_classes = createArray 32 []
, gen_var_kinds = []
, gen_OBJECT_CONS_FIELD_indices = createArray 3 {ocf_module = -1,ocf_index = -1,ocf_ident={id_name="",id_info=nilPtr}}
, gen_rep_conses = createArray 4 {gcf_module = -1,gcf_index = -1,gcf_ident={id_name="",id_info=nilPtr}}
}
# (gen_info_ptr, hp_generic_heap) = newPtr initial_info hp_generic_heap
= ( {gen_def & gen_info_ptr = gen_info_ptr},
......
This diff is collapsed.
......@@ -569,6 +569,7 @@ where
# (ok, {at_type=type}, pState) = trySimpleType TA_None pState
# (ident, pState) = stringToIdent name (IC_GenericCase type) pState
# (type_CONS_ident, pState) = stringToIdent "CONS" IC_Type pState
# (type_RECORD_ident, pState) = stringToIdent "RECORD" IC_Type pState
# (type_FIELD_ident, pState)= stringToIdent "FIELD" IC_Type pState
# (type_OBJECT_ident, pState)= stringToIdent "OBJECT" IC_Type pState
# (generic_ident, pState) = stringToIdent name IC_Generic pState
......@@ -599,14 +600,13 @@ where
-> case type_cons of
(TypeConsSymb {type_ident})
| type_ident == type_CONS_ident
# (cons_CONS_ident, pState) = stringToIdent "GenericConsInfo" IC_Expression pState
-> (PE_List [PE_Ident cons_CONS_ident, geninfo_arg], pState)
-> (geninfo_arg, pState)
| type_ident == type_RECORD_ident
-> (geninfo_arg, pState)
| type_ident == type_FIELD_ident
# (cons_FIELD_ident, pState) = stringToIdent "GenericFieldInfo" IC_Expression pState
-> (PE_List [PE_Ident cons_FIELD_ident, geninfo_arg], pState)
-> (geninfo_arg, pState)
| type_ident == type_OBJECT_ident
# (cons_OBJECT_ident, pState) = stringToIdent "GenericTypeDefInfo" IC_Expression pState
-> (PE_List [PE_Ident cons_OBJECT_ident, geninfo_arg], pState)
-> (geninfo_arg, pState)
_
| otherwise
-> (geninfo_arg, pState)
......
......@@ -170,35 +170,34 @@ PD_TypeEITHER :== 179
PD_TypePAIR :== 180
// for constructor info
PD_TypeCONS :== 181
PD_TypeFIELD :== 182
PD_TypeOBJECT :== 183
PD_GenericInfo :== 184
//PD_TGenericConsDescriptor :== 184
PD_TGenericFieldDescriptor :== 185
PD_TGenericTypeDefDescriptor :== 186
PD_TGenConsPrio :== 187
PD_TGenConsAssoc :== 188
PD_TGenType :== 189
PD_TypeGenericDict :== 190
PD_TypeRECORD :== 182
PD_TypeFIELD :== 183
PD_TypeOBJECT :== 184
PD_TGenericConsDescriptor :== 185
PD_TGenericRecordDescriptor :== 186
PD_TGenericFieldDescriptor :== 187
PD_TGenericTypeDefDescriptor :== 188
PD_TGenConsPrio :== 189
PD_TGenConsAssoc :== 190
PD_TGenType :== 191
PD_TypeGenericDict :== 192
// Generics fields
PD_map_to :== 191
PD_map_from :== 192
PD_map_to :== 193
PD_map_from :== 194
// Generics expression
PD_ConsBimap :== 193
PD_ConsUNIT :== 194
PD_ConsLEFT :== 195
PD_ConsRIGHT :== 196
PD_ConsPAIR :== 197
PD_ConsBimap :== 195
PD_ConsUNIT :== 196
PD_ConsLEFT :== 197
PD_ConsRIGHT :== 198
PD_ConsPAIR :== 199
// for constructor info
PD_ConsCONS :== 198
PD_ConsFIELD :== 199
PD_ConsOBJECT :== 200
PD_NoGenericInfo :== 201
PD_GenericConsInfo :== 202
PD_GenericFieldInfo :== 203
PD_GenericTypeInfo :== 204
PD_CGenericConsDescriptor :== 205
PD_ConsCONS :== 200
PD_ConsRECORD :== 201
PD_ConsFIELD :== 202
PD_ConsOBJECT :== 203
PD_CGenericConsDescriptor :== 204
PD_CGenericRecordDescriptor :== 205
PD_CGenericFieldDescriptor :== 206
PD_CGenericTypeDefDescriptor :== 207
PD_CGenConsNoPrio :== 208
......
......@@ -182,17 +182,16 @@ predefined_idents
[PD_ConsPAIR] = i "PAIR",
[PD_TypeCONS] = i "CONS",
[PD_ConsCONS] = i "CONS",
[PD_TypeRECORD] = i "RECORD",
[PD_ConsRECORD] = i "RECORD",
[PD_TypeFIELD] = i "FIELD",
[PD_ConsFIELD] = i "FIELD",
[PD_TypeOBJECT] = i "OBJECT",
[PD_ConsOBJECT] = i "OBJECT",
[PD_GenericInfo] = i "GenericInfo",
[PD_NoGenericInfo] = i "NoGenericInfo",
[PD_GenericConsInfo] = i "GenericConsInfo",
[PD_GenericFieldInfo] = i "GenericFieldInfo",
[PD_GenericTypeInfo] = i "GenericTypeDefInfo",
// [PD_TGenericConsDescriptor] = i "GenericConsDescriptor",
[PD_TGenericConsDescriptor] = i "GenericConsDescriptor",
[PD_CGenericConsDescriptor] = i "_GenericConsDescriptor",
[PD_TGenericRecordDescriptor] = i "GenericRecordDescriptor",
[PD_CGenericRecordDescriptor] = i "_GenericRecordDescriptor",
[PD_TGenericFieldDescriptor] = i "GenericFieldDescriptor",
[PD_CGenericFieldDescriptor] = i "_GenericFieldDescriptor",
[PD_TGenericTypeDefDescriptor] = i "GenericTypeDefDescriptor",
......@@ -248,7 +247,6 @@ predefined_idents
[PD_FromThenToU]= i "_from_then_to_u",
[PD_FromThenToUTS]= i "_from_then_to_uts",
[PD_FromThenToO]= i "_from_then_to_o"
}
=: idents
where
......
......@@ -412,13 +412,14 @@ cNameLocationDependent :== True
:: GenericInfo =
{ gen_classes :: !GenericClassInfos
, gen_var_kinds :: ![TypeKind] // kinds of all st_vars of the gen_type
, gen_OBJECT_CONS_FIELD_indices :: !{#OBJECT_CONS_FIELD_index}
, gen_rep_conses :: !{#GenericRepresentationConstructor}
// OBJECT, CONS, RECORD, FIELD
}
:: OBJECT_CONS_FIELD_index =
{ ocf_module :: !Int
, ocf_index :: !Int
, ocf_ident :: !Ident
:: GenericRepresentationConstructor =
{ gcf_module :: !Int
, gcf_index :: !Int
, gcf_ident :: !Ident
}
:: GenericInfoPtr :== Ptr GenericInfo
......@@ -576,6 +577,7 @@ NoGlobalIndex :== {gi_module=NoIndex,gi_index=NoIndex}
| GTSAppVar TypeVar [GenTypeStruct]
| GTSVar TypeVar
| GTSCons DefinedSymbol GenTypeStruct
| GTSRecord DefinedSymbol GenTypeStruct
| GTSField DefinedSymbol GenTypeStruct
| GTSObject DefinedSymbol GenTypeStruct
| GTSPair !GenTypeStruct !GenTypeStruct // for optimizing bimaps
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment