Commit a8376e8d authored by johnvg@science.ru.nl's avatar johnvg@science.ru.nl

store pointer to symbol definition of SYSRULE in ident_sys_rule_def, store the...

store pointer to symbol definition of SYSRULE in ident_sys_rule_def, store the pointer to the instructions in sdef_instructions of a SYSRULE SymbDef instead of ident_instructions of an Ident
parent d440d37d
......@@ -2360,16 +2360,17 @@ BEDeclareRuleType (int functionIndex, int moduleIndex, CleanString name)
Assert (functions != NULL);
Assert (functions [functionIndex].symb_kind == erroneous_symb);
if (module->bem_isSystemModule)
if (module->bem_isSystemModule){
/* for inline code */
newIdent = PutStringInHashTable (ConvertCleanString (name), FirstSystemModuleTable + moduleIndex);
else
{
newSymbDef = ConvertAllocType (SymbDefS);
newIdent->ident_sys_rule_def = newSymbDef;
} else {
newIdent = ConvertAllocType (IdentS);
newIdent->ident_name = ConvertCleanString (name);
newSymbDef = ConvertAllocType (SymbDefS);
}
newSymbDef = ConvertAllocType (SymbDefS);
newSymbDef->sdef_kind = NEWDEFINITION;
newSymbDef->sdef_exported = False;
newSymbDef->sdef_module = module->bem_name;
......
......@@ -2615,10 +2615,8 @@ static void FillSymbol (Node node,SymbDef sdef,int *asp_p,int *bsp_p,NodeId upda
*asp_p-=a_size;
*bsp_p-=b_size;
if (! (sdef->sdef_kind==SYSRULE
&& sdef->sdef_ident->ident_instructions!=NULL
&& *sdef->sdef_ident->ident_instructions!='\0'
&& *sdef->sdef_ident->ident_instructions!='.'))
if (! (sdef->sdef_kind==SYSRULE && (sdef->sdef_mark & SDEF_DEFRULE_INSTRUCTIONS)!=0
&& sdef->sdef_instructions!=NULL && *sdef->sdef_instructions!='\0' && *sdef->sdef_instructions!='.'))
{
cleanup_stack (asp_p,bsp_p,a_size,b_size,&code_gen_node_ids_p->a_node_ids,&code_gen_node_ids_p->b_node_ids,
&code_gen_node_ids_p->free_node_ids,code_gen_node_ids_p->moved_node_ids_l,
......@@ -2642,10 +2640,8 @@ static void FillSymbol (Node node,SymbDef sdef,int *asp_p,int *bsp_p,NodeId upda
*asp_p-=a_size+1;
*bsp_p-=b_size;
if (! (sdef->sdef_kind==SYSRULE
&& sdef->sdef_ident->ident_instructions!=NULL
&& *sdef->sdef_ident->ident_instructions!='\0'
&& *sdef->sdef_ident->ident_instructions!='.'))
if (! (sdef->sdef_kind==SYSRULE && (sdef->sdef_mark & SDEF_DEFRULE_INSTRUCTIONS)!=0
&& sdef->sdef_instructions!=NULL && *sdef->sdef_instructions!='\0' && *sdef->sdef_instructions!='.'))
{
cleanup_stack (asp_p,bsp_p,a_size+1,b_size,&code_gen_node_ids_p->a_node_ids,&code_gen_node_ids_p->b_node_ids,
&code_gen_node_ids_p->free_node_ids,code_gen_node_ids_p->moved_node_ids_l,
......@@ -2667,10 +2663,8 @@ static void FillSymbol (Node node,SymbDef sdef,int *asp_p,int *bsp_p,NodeId upda
*asp_p-=a_size;
*bsp_p-=b_size;
if (! (sdef->sdef_kind==SYSRULE
&& sdef->sdef_ident->ident_instructions!=NULL
&& *sdef->sdef_ident->ident_instructions!='\0'
&& *sdef->sdef_ident->ident_instructions!='.'))
if (! (sdef->sdef_kind==SYSRULE && (sdef->sdef_mark & SDEF_DEFRULE_INSTRUCTIONS)!=0
&& sdef->sdef_instructions!=NULL && *sdef->sdef_instructions!='\0' && *sdef->sdef_instructions!='.'))
{
cleanup_stack (asp_p,bsp_p,a_size,b_size,&code_gen_node_ids_p->a_node_ids,&code_gen_node_ids_p->b_node_ids,
&code_gen_node_ids_p->free_node_ids,code_gen_node_ids_p->moved_node_ids_l,
......@@ -4997,10 +4991,8 @@ static void FillUniqueNodeWithNode (NodeP update_node,int *asp_p,int *bsp_p,Code
*asp_p-=a_size;
*bsp_p-=b_size;
if (! (sdef->sdef_kind==SYSRULE
&& sdef->sdef_ident->ident_instructions!=NULL
&& *sdef->sdef_ident->ident_instructions!='\0'
&& *sdef->sdef_ident->ident_instructions!='.'))
if (! (sdef->sdef_kind==SYSRULE && (sdef->sdef_mark & SDEF_DEFRULE_INSTRUCTIONS)!=0
&& sdef->sdef_instructions!=NULL && *sdef->sdef_instructions!='\0' && *sdef->sdef_instructions!='.'))
{
cleanup_stack (asp_p,bsp_p,a_size,b_size,&code_gen_node_ids_p->a_node_ids,&code_gen_node_ids_p->b_node_ids,
&code_gen_node_ids_p->free_node_ids,code_gen_node_ids_p->moved_node_ids_l,
......
......@@ -1323,7 +1323,10 @@ static void CallFunction2 (Label label, SymbDef def, Bool isjsr, StateS root_sta
if (def->sdef_kind==SYSRULE){
char *instr;
instr= def->sdef_ident->ident_instructions;
if (def->sdef_mark & SDEF_DEFRULE_INSTRUCTIONS)
instr = def->sdef_instructions;
else
instr = NULL;
if (instr && *instr!='\0'){
char *tail;
......@@ -1338,7 +1341,7 @@ static void CallFunction2 (Label label, SymbDef def, Bool isjsr, StateS root_sta
if (!isjsr)
GenRtn (aout, bout, root_state);
} else {
if ((def->sdef_ident->ident_mark & WARNED_NO_INLINE_CODE)==0 && instr==NULL){
if ((def->sdef_mark & SDEF_WARNED_NO_INLINE_CODE)==0 && instr==NULL){
char *previous_module = CurrentModule;
char *previous_ext = CurrentExt;
......@@ -1350,7 +1353,7 @@ static void CallFunction2 (Label label, SymbDef def, Bool isjsr, StateS root_sta
CurrentModule = previous_module;
CurrentExt = previous_ext;
def->sdef_ident->ident_mark |= WARNED_NO_INLINE_CODE;
def->sdef_mark |= SDEF_WARNED_NO_INLINE_CODE;
}
GenDStackLayout (ain, bin, fun_args);
if (isjsr){
......
......@@ -43,7 +43,7 @@ NewIdentInTable (TableKind tableKind, char *name)
ident->ident_name = name;
ident->ident_next = NULL;
ident->ident_instructions = NULL;
ident->ident_sys_rule_def = NULL;
ident->ident_mark = 0;
return (ident);
......@@ -77,7 +77,7 @@ NewIdent (char *name)
ident->ident_table = LastSystemModuleTable;
ident->ident_next = NULL;
ident->ident_instructions = NULL;
ident->ident_sys_rule_def = NULL;
ident->ident_mark = 0;
return ident;
......@@ -294,6 +294,8 @@ void ScanInlineFile (char *fname,TableKind system_module_table_kind)
*tail = '\0';
if (! (instrid = RetrieveFromSymbolTable (instr,system_module_table_kind)))
continue;
if (instrid->ident_sys_rule_def==NULL)
continue;
if ((instrid->ident_mark & INLINE_MASK) != 0)
{
StaticMessage (True, "%s", "multiple .inline directives", instr);
......@@ -336,13 +338,12 @@ void ScanInlineFile (char *fname,TableKind system_module_table_kind)
}
/* save the list of inline instructions */
/* if (InlineBufferIndex != InlineBufferStart){ */
instrid->ident_instructions = &InlineCodeBuffer [InlineBufferStart];
InlineBufferStart = InlineBufferIndex+1;
instrid->ident_sys_rule_def->sdef_mark |= SDEF_DEFRULE_INSTRUCTIONS;
instrid->ident_sys_rule_def->sdef_instructions = &InlineCodeBuffer [InlineBufferStart];
InlineBufferStart = InlineBufferIndex+1;
/* close the list with the NULL character */
InlineCodeBuffer [InlineBufferIndex] = '\0';
/* } */
/* close the list with the NULL character */
InlineCodeBuffer [InlineBufferIndex] = '\0';
}
FClose (f);
......
......@@ -1177,7 +1177,6 @@ void ExamineTypesAndLhsOfSymbolDefinition (SymbDef def)
switch (def->sdef_kind){
case SYSRULE:
def->sdef_ident->ident_instructions = NULL;
case DEFRULE:
if (def->sdef_isused){
def->sdef_rule_type->rule_type_state_p = allocate_function_state (def->sdef_arity);
......
......@@ -159,14 +159,13 @@ STRUCT (symbol,Symbol) {
STRUCT(ident,Ident){
char * ident_name;
char * ident_instructions;
struct symbol_def * ident_sys_rule_def;
struct ident * ident_next;
unsigned char ident_table; /* TableKind */
unsigned char ident_mark;
};
#define INLINE_MASK 8
#define WARNED_NO_INLINE_CODE 16
/*
The order in which the annotationkinds appear in the enum type
......@@ -551,6 +550,7 @@ STRUCT (symbol_def,SymbDef){
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 */
char * typeinfo_instructions; /* for DEFRULE or SYSRULE if SDEF_DEFRULE_INSTRUCTIONS */
} sdef_typeinfo;
unsigned sdef_number;
......@@ -609,6 +609,8 @@ STRUCT (symbol_def,SymbDef){
#define SDEF_INSTANCE_RULE_WITH_FIELD_P 16384
#define SDEF_RULE_INSTANCE_RULE_P 32768
#define SDEF_HAS_SPECIAL_ARRAY_FUNCTION 512
#define SDEF_DEFRULE_INSTRUCTIONS 16
#define SDEF_WARNED_NO_INLINE_CODE 65536
/* some macros to reuse bit fields */
......@@ -627,6 +629,7 @@ STRUCT (symbol_def,SymbDef){
#define sdef_dictionary_field sdef_typeinfo.typeinfo_dictionary_field
#define sdef_instance_rule sdef_typeinfo.typeinfo_instance_rule
#define sdef_instructions sdef_typeinfo.typeinfo_instructions
#if IMPORT_OBJ_AND_LIB
struct string_list {
......
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