new handling of setjmp; now pass return address
authorceriel <none@none>
Wed, 20 Apr 1988 15:28:10 +0000 (15:28 +0000)
committerceriel <none@none>
Wed, 20 Apr 1988 15:28:10 +0000 (15:28 +0000)
lang/cem/cemcom/Makefile.erik
lang/cem/cemcom/eval.c

index dbbcc0c..ec701ae 100644 (file)
@@ -670,6 +670,7 @@ eval.o: nofloat.h
 eval.o: nopp.h
 eval.o: sizes.h
 eval.o: spec_arith.h
+eval.o: specials.h
 eval.o: stack.h
 eval.o: target_sizes.h
 eval.o: type.h
index 5bb66bf..5b3288b 100644 (file)
@@ -26,6 +26,7 @@
 #include       "align.h"
 #include       "mes.h"
 #include       "atw.h"
+#include       "specials.h"
 
 #define        CRASH()         crash("EVAL: CRASH at line %u", __LINE__)
 #define        toword(n)       ((n) < word_size ? word_size : (n))
@@ -445,7 +446,20 @@ EVAL(expr, val, code, true_label, false_label)
                {
                        register struct expr *ex;
                        arith ParSize = (arith)0;
+                       label setjmp_label = 0;
 
+                       if (left->ex_class == Value && left->VL_CLASS == Name) {
+                               if (left->VL_IDF->id_special == SP_SETJMP) {
+                                       label addr_label = data_label();
+
+                                       setjmp_label = text_label();
+                                       C_df_dlb(addr_label);
+                                       C_rom_ilb(setjmp_label);
+                                       C_lae_dlb(addr_label, (arith) 0);
+                                       C_loi(pointer_size);
+                                       ParSize += pointer_size;
+                               }
+                       }
                        if ((ex = right) != NILEXPR) {
                                /* function call with parameters*/
                                while ( ex->ex_class == Oper &&
@@ -464,6 +478,9 @@ EVAL(expr, val, code, true_label, false_label)
                        if (left->ex_class == Value && left->VL_CLASS == Name) {
                                /* e.g., main() { (*((int (*)())0))(); } */
                                C_cal(left->VL_IDF->id_text);
+                               if (setjmp_label) {
+                                       C_df_ilb(setjmp_label);
+                               }
 #ifdef DATAFLOW
                                {       extern char options[];
                                        if (options['d'])