summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cgcode.c91
-rw-r--r--cgcodep.h3
-rw-r--r--cginput.c5
-rw-r--r--cgport.h3
4 files changed, 94 insertions, 8 deletions
diff --git a/cgcode.c b/cgcode.c
index dfedfd1..bdad684 100644
--- a/cgcode.c
+++ b/cgcode.c
@@ -19,10 +19,6 @@
#include "cgport.h"
-#ifdef I486
-# define NEW_DESCRIPTORS
-#endif
-
#if defined (G_POWER) || defined (I486)
# define PROFILE
# if defined (G_POWER)
@@ -3627,7 +3623,7 @@ void code_jmp (char label_name[])
tail_call_profile=1;
}
}
-
+
if (! tail_call_profile)
i_jmp_l_profile (label,0);
else
@@ -7962,7 +7958,7 @@ void code_desc (char label_name[],char node_entry_label_name[],char *code_label_
#if defined (NO_FUNCTION_NAMES) && defined (NO_CONSTRUCTOR_NAMES)
descriptor_name_length=0;
-#elif defined (NO_FUNCTION_NAMES) && defined (NO_CONSTRUCTOR_NAMES)
+#elif defined (NO_FUNCTION_NAMES)
if (strcmp (code_label_name,"__add__arg")!=0)
descriptor_name_length=0;
#endif
@@ -8046,7 +8042,7 @@ void code_descexp (char label_name[],char node_entry_label_name[],char *code_lab
#if defined (NO_FUNCTION_NAMES) && defined (NO_CONSTRUCTOR_NAMES)
descriptor_name_length=0;
-#elif defined (NO_FUNCTION_NAMES) && defined (NO_CONSTRUCTOR_NAMES)
+#elif defined (NO_FUNCTION_NAMES)
if (strcmp (code_label_name,"__add__arg")!=0)
descriptor_name_length=0;
#endif
@@ -8078,6 +8074,87 @@ void code_descexp (char label_name[],char node_entry_label_name[],char *code_lab
w_descriptor_string (descriptor_name,descriptor_name_length,string_code_label_id,string_label);
}
+#ifdef NEW_DESCRIPTORS
+void code_descs (char label_name[],char node_entry_label_name[],char *result_descriptor_name,
+ int offset1,int offset2,char descriptor_name[],int descriptor_name_length)
+{
+ LABEL *string_label,*label;
+ int string_code_label_id;
+
+#if defined (NO_FUNCTION_NAMES)
+ descriptor_name_length=0;
+#endif
+
+ string_code_label_id=next_label_id++;
+ string_label=new_local_label (0
+#ifdef G_POWER
+ | DATA_LABEL
+#endif
+ );
+
+ label=enter_label (label_name,LOCAL_LABEL | DATA_LABEL);
+
+ if (label->label_id>=0)
+ error_s ("Label %d defined twice\n",label_name);
+ label->label_id=next_label_id++;
+
+ label->label_descriptor=string_label;
+
+#ifdef FUNCTION_LEVEL_LINKING
+ as_new_data_module();
+ if (assembly_flag)
+ w_as_new_data_module();
+#endif
+
+ if (! (result_descriptor_name[0]=='_' && result_descriptor_name[1]=='_' && result_descriptor_name[2]=='\0')){
+ LABEL *result_descriptor_label;
+
+ result_descriptor_label=enter_label (result_descriptor_name,0);
+
+ if (result_descriptor_label->label_id<0)
+ result_descriptor_label->label_id=next_label_id++;
+
+#ifdef GEN_OBJ
+ store_descriptor_in_data_section (result_descriptor_label);
+#endif
+ if (assembly_flag)
+ w_as_descriptor_in_data_section (result_descriptor_label->label_name);
+ }
+
+#if ! (defined (NO_STRING_ADDRES_IN_DESCRIPTOR) && (defined (G_POWER) || defined (I486)))
+# ifdef GEN_OBJ
+ store_label_in_data_section (string_label);
+# endif
+ if (assembly_flag)
+ w_as_internal_label_value (string_code_label_id);
+#endif
+
+#ifdef GEN_OBJ
+ define_data_label (label);
+#endif
+ if (assembly_flag)
+ w_as_define_label (label);
+
+#ifdef GEN_OBJ
+ store_2_words_in_data_section (0,8);
+ store_2_words_in_data_section (offset1<<2,offset2<<2);
+ store_2_words_in_data_section (1,0);
+#endif
+ if (assembly_flag){
+ w_as_word_in_data_section (0);
+ w_as_word_in_data_section (8);
+ w_as_word_in_data_section (offset1<<2);
+ w_as_word_in_data_section (offset2<<2);
+ w_as_word_in_data_section (1);
+ w_as_word_in_data_section (0);
+ }
+
+ code_new_descriptor (1,0);
+
+ w_descriptor_string (descriptor_name,descriptor_name_length,string_code_label_id,string_label);
+}
+#endif
+
void code_record (char record_label_name[],char type[],int a_size,int b_size,char record_name[],int record_name_length)
{
LABEL *label;
diff --git a/cgcodep.h b/cgcodep.h
index edc3a78..88b3a05 100644
--- a/cgcodep.h
+++ b/cgcodep.h
@@ -283,6 +283,9 @@ void code_d (int da,int db,ULONG vector[]);
void code_desc (char *s1,char *s2,char *s3,int n,int lazy_record_flag,char *s4,int l);
void code_descn (char label_name[],char node_entry_label_name[],int arity,int lazy_record_flag,char descriptor_name[],int descriptor_name_length);
void code_descexp (char *s1,char *s2,char *s3,int n,int lazy_record_flag,char *s4,int l);
+#ifdef NEW_DESCRIPTORS
+void code_descs (char *s1,char *s2,char *s3,int offset1,int offset2,char *s4,int l);
+#endif
void code_record (char *s1,char *s2,int n1,int n2,char *s3,int s3_length);
void code_depend (char *module_name,int module_name_length);
void code_export (char *label_name);
diff --git a/cginput.c b/cginput.c
index 39b2851..15d5568 100644
--- a/cginput.c
+++ b/cginput.c
@@ -1854,7 +1854,7 @@ static void put_instructions_in_table (void)
put_instruction_name ("ItoP", parse_instruction, code_ItoP );
put_instruction_name ("ItoR", parse_instruction, code_ItoR );
put_instruction_name ("jmp", parse_instruction_a, code_jmp );
- put_instruction_name ("jmp_ap", parse_instruction_n, code_jmp_ap );
+ put_instruction_name ("jmp_ap", parse_instruction_n, code_jmp_ap );
put_instruction_name ("jmp_eval", parse_instruction, code_jmp_eval );
put_instruction_name ("jmp_eval_upd", parse_instruction, code_jmp_eval_upd );
put_instruction_name ("jmp_false", parse_instruction_a, code_jmp_false );
@@ -2010,6 +2010,9 @@ static void put_instructions_in_table2 (void)
put_instruction_name (".desc", parse_directive_desc, code_desc );
put_instruction_name (".descn", parse_directive_descn, code_descn );
put_instruction_name (".descexp", parse_directive_desc, code_descexp );
+#ifdef NEW_DESCRIPTORS
+ put_instruction_name (".descs", parse_directive_desc, code_descs );
+#endif
put_instruction_name (".end", parse_directive, code_dummy );
put_instruction_name (".endinfo", parse_directive, code_dummy );
put_instruction_name (".export", parse_directive_labels, code_export );
diff --git a/cgport.h b/cgport.h
index 952cc34..a0d17de 100644
--- a/cgport.h
+++ b/cgport.h
@@ -1,6 +1,9 @@
#define FINALIZERS
#define NEW_APPLY
+#ifdef I486
+# define NEW_DESCRIPTORS
+#endif
#if defined (__MWERKS__) || defined (__MRC__)
# define POWER