Commit 0bb4e6f0 authored by johnvg@science.ru.nl's avatar johnvg@science.ru.nl
Browse files

add BESetDictionaryFieldOfMember and BESetInstanceFunctionOfFunction (not yet used)

parent d1530889
......@@ -3065,6 +3065,62 @@ BESetMemberTypeOfField (int fieldIndex, int moduleIndex, BETypeAltP typeAlt)
sdef = gBEState.be_modules [moduleIndex].bem_fields [fieldIndex].symb_def;
sdef->sdef_mark |= SDEF_FIELD_HAS_MEMBER_TYPE;
sdef->sdef_member_type_of_field = typeAlt;
sdef->sdef_member_states_of_field = NULL;
}
int
BESetDictionaryFieldOfMember (int function_index,int field_index, int field_module_index)
{
SymbolP function_symbol_p;
SymbDefP field_sdef,function_sdef;
function_symbol_p = &gBEState.be_modules[main_dcl_module_n].bem_functions[function_index];
if (function_symbol_p->symb_kind==erroneous_symb)
return 1;
field_sdef = gBEState.be_modules [field_module_index].bem_fields[field_index].symb_def;
/* in BEAdjustStrictListConsInstance symb_kind=cons_symb */
if (function_symbol_p->symb_kind==cons_symb)
function_sdef = function_symbol_p->symb_unboxed_cons_p->unboxed_cons_sdef_p;
else
function_sdef = function_symbol_p->symb_def;
if (! (function_sdef->sdef_kind==IMPRULE || function_sdef->sdef_kind==DEFRULE || function_sdef->sdef_kind==SYSRULE))
return 2;
function_sdef->sdef_mark |= SDEF_INSTANCE_RULE_WITH_FIELD_P;
function_sdef->sdef_dictionary_field = field_sdef;
return 0;
}
void
BESetInstanceFunctionOfFunction (int function_index,int instance_function_index)
{
SymbolP instance_function_symbol_p;
SymbDefP function_sdef,instance_function_sdef;
function_sdef = gBEState.be_modules[main_dcl_module_n].bem_functions[function_index].symb_def;
instance_function_symbol_p = &gBEState.be_modules[main_dcl_module_n].bem_functions[instance_function_index];
if (instance_function_symbol_p->symb_kind==erroneous_symb){
/* the instance function is not used any more, only specialized versions of it,
allocate empty SymbDef for BESetDictionaryFieldOfMember */
instance_function_sdef = ConvertAllocType (SymbDefS);
instance_function_sdef->sdef_kind = IMPRULE;
instance_function_sdef->sdef_mark = 0;
instance_function_sdef->sdef_isused = 0;
instance_function_symbol_p->symb_def=instance_function_sdef;
instance_function_symbol_p->symb_kind=instance_symb;
}
instance_function_sdef = instance_function_symbol_p->symb_def;
function_sdef->sdef_mark |= SDEF_RULE_INSTANCE_RULE_P;
function_sdef->sdef_instance_rule = instance_function_sdef;
}
BEFieldListP
......
......@@ -472,6 +472,12 @@ Clean (BEField :: Int Int BETypeNodeP BackEnd -> (BEFieldListP, BackEnd))
void BESetMemberTypeOfField (int fieldIndex, int moduleIndex, BETypeAltP typeAlt);
Clean (BESetMemberTypeOfField :: Int Int BETypeAltP BackEnd -> BackEnd)
int BESetDictionaryFieldOfMember (int function_index, int field_index, int field_module_index);
Clean (BESetDictionaryFieldOfMember :: Int Int Int BackEnd -> (Int,BackEnd))
void BESetInstanceFunctionOfFunction (int function_index,int instance_function_index);
Clean (BESetInstanceFunctionOfFunction :: Int Int BackEnd -> BackEnd)
BEFieldListP BEFields (BEFieldListP field, BEFieldListP fields);
Clean (BEFields:: BEFieldListP BEFieldListP BackEnd -> (BEFieldListP, BackEnd))
......
......@@ -565,12 +565,14 @@ STRUCT (symbol_def,SymbDef){
ImpRules u_rule;
} sdef_u;
union
{ StateS typeinfo_record_state;
{ StateS typeinfo_record_state; /* for RECORDTYPE */
struct
{ FieldList fieldinfo_sel_field;
int fieldinfo_sel_field_number;
} sdef_fieldinfo;
} sdef_fieldinfo; /* for FIELDSELECTOR */
struct constructor_list * typeinfo_constructor; /* for CONSTRUCTOR */
struct symbol_def *typeinfo_dictionary_field; /* for IMPRULE if SDEF_INSTANCE_RULE_WITH_FIELD_P */
struct symbol_def *typeinfo_instance_rule; /* for IMPRULE if SDEF_RULE_INSTANCE_RULE_P */
} sdef_typeinfo;
unsigned sdef_number;
......@@ -582,6 +584,7 @@ STRUCT (symbol_def,SymbDef){
#ifdef CLEAN2
SymbolP u3_unboxed_cons_symbol; /* backend.c */
#endif
struct state * u3_member_states_of_field; /* for FIELDSELECTOR if SDEF_FIELD_HAS_MEMBER_TYPE */
} sdef_u3;
struct symbol_def * sdef_dcl_icl; /* to dcl if sdef_exported, to icl if sdef_main_dcl */
......@@ -614,6 +617,7 @@ STRUCT (symbol_def,SymbDef){
#ifdef CLEAN2
#define sdef_unboxed_cons_symbol sdef_u3.u3_unboxed_cons_symbol
#endif
#define sdef_member_states_of_field sdef_u3.u3_member_states_of_field
#define SDEF_USED_LAZILY_MASK 1
#define SDEF_USED_STRICTLY_MASK 2
......@@ -623,7 +627,9 @@ STRUCT (symbol_def,SymbDef){
#define SDEF_HAS_IMP_RULE_VERSIONS_MASK 64
#define SDEF_OPTIMISED_FUNCTION_MASK 128
#define SDEF_INLINE_IS_CONSTRUCTOR 4096
#define SDEF_FIELD_HAS_MEMBER_TYPE 16384
#define SDEF_FIELD_HAS_MEMBER_TYPE 1024
#define SDEF_INSTANCE_RULE_WITH_FIELD_P 16384
#define SDEF_RULE_INSTANCE_RULE_P 32768
/* some macros to reuse bit fields */
......@@ -635,10 +641,13 @@ STRUCT (symbol_def,SymbDef){
#define sdef_constructor sdef_typeinfo.typeinfo_constructor
#define sdef_record_state sdef_typeinfo.typeinfo_record_state
#define sdef_sel_field sdef_typeinfo.sdef_fieldinfo.fieldinfo_sel_field
#define sdef_sel_field sdef_typeinfo.sdef_fieldinfo.fieldinfo_sel_field
#define sdef_sel_field_number sdef_typeinfo.sdef_fieldinfo.fieldinfo_sel_field_number
#define sdef_dictionary_field sdef_typeinfo.typeinfo_dictionary_field
#define sdef_instance_rule sdef_typeinfo.typeinfo_instance_rule
#if IMPORT_OBJ_AND_LIB
struct string_list {
char * sl_string;
......
......@@ -96,6 +96,8 @@
/EXPORT: BEDeclareField
/EXPORT: BEField
/EXPORT: BESetMemberTypeOfField
/EXPORT: BESetDictionaryFieldOfMember
/EXPORT: BESetInstanceFunctionOfFunction
/EXPORT: BEFields
/EXPORT: BENoFields
/EXPORT: BEDeclareConstructor
......
......@@ -94,6 +94,8 @@
/EXPORT:BEDeclareField
/EXPORT:BEField
/EXPORT:BESetMemberTypeOfField
/EXPORT:BESetDictionaryFieldOfMember
/EXPORT:BESetInstanceFunctionOfFunction
/EXPORT:BEFields
/EXPORT:BENoFields
/EXPORT:BEDeclareConstructor
......
Markdown is supported
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