DEADSOFTWARE

Для обычных процедур всегда генерируется return
authorDeaDDooMER <deaddoomer@deadsoftware.ru>
Mon, 21 Aug 2017 11:53:10 +0000 (14:53 +0300)
committerDeaDDooMER <deaddoomer@deadsoftware.ru>
Mon, 21 Aug 2017 11:53:10 +0000 (14:53 +0300)
rtl/java/SYSTEM.java
src/backends/jvm/generator-jvm-asm.c
src/backends/jvm/generator-jvm.c
src/oberon.c

index 20cbe60f2115f1167d1076d32f81b2f7a3040386..bc824fa381d4b8068acb8543192b0311f4fabd36 100644 (file)
@@ -76,6 +76,10 @@ public class SYSTEM
                {
                        throw new RuntimeException("NOT IMPLEMENTED");
                }
                {
                        throw new RuntimeException("NOT IMPLEMENTED");
                }
+               else if(n == -4)
+               {
+                       throw new RuntimeException("RETURN TRAP");
+               }
                else
                {
                        throw new RuntimeException("TRAP CODE " + n);
                else
                {
                        throw new RuntimeException("TRAP CODE " + n);
index bd1812c00d0d74309faee20c12301a3102675f42..4d0e471bf5abc0ad7027da13c4c5d8c4f35819f1 100644 (file)
@@ -235,11 +235,11 @@ jvm_generate_push_float(gen_proc_t * p, double f, int size)
                {
                        jvm_generate(p, 0, 1, "fconst_0");
                }
                {
                        jvm_generate(p, 0, 1, "fconst_0");
                }
-               if(f == 1.0)
+               else if(f == 1.0)
                {
                        jvm_generate(p, 0, 1, "fconst_1");
                }
                {
                        jvm_generate(p, 0, 1, "fconst_1");
                }
-               if(f == 2.0)
+               else if(f == 2.0)
                {
                        jvm_generate(p, 0, 1, "fconst_2");
                }
                {
                        jvm_generate(p, 0, 1, "fconst_2");
                }
@@ -254,7 +254,7 @@ jvm_generate_push_float(gen_proc_t * p, double f, int size)
                {
                        jvm_generate(p, 0, 2, "dconst_0");
                }
                {
                        jvm_generate(p, 0, 2, "dconst_0");
                }
-               if(f == 1.0)
+               else if(f == 1.0)
                {
                        jvm_generate(p, 0, 2, "dconst_1");
                }
                {
                        jvm_generate(p, 0, 2, "dconst_1");
                }
index c389ebce731e08fd36d13c36fceff9083f2308b9..cb8eeef564ba2925b7eb5701002253f79cdd47d4 100644 (file)
@@ -9,6 +9,7 @@
 #include <gc.h>
 
 #include "../../oberon-internals.h"
 #include <gc.h>
 
 #include "../../oberon-internals.h"
+#include "../../generator.h"
 #include "generator-jvm.h"
 #include "generator-jvm-abi.h"
 #include "generator-jvm-asm.h"
 #include "generator-jvm.h"
 #include "generator-jvm-abi.h"
 #include "generator-jvm-asm.h"
@@ -981,6 +982,7 @@ oberon_generate_end_proc(oberon_context_t * ctx)
        m = ctx -> mod -> gen_mod;
        p = m -> class -> p;
 
        m = ctx -> mod -> gen_mod;
        p = m -> class -> p;
 
+       oberon_generate_trap(ctx, -4);
        jvm_generate_function_end(p);
 }
 
        jvm_generate_function_end(p);
 }
 
index 72bf1c68b5a1f774c8284b4cab65a17c6adfc788..437e7694205489c681c5da3757bdc7e58a42ad39 100644 (file)
@@ -2412,8 +2412,7 @@ oberon_proc_decl_body(oberon_context_t * ctx, oberon_object_t * proc)
                oberon_error(ctx, "procedure name not matched");
        }
 
                oberon_error(ctx, "procedure name not matched");
        }
 
-       if(proc -> type -> base -> class == OBERON_TYPE_NOTYPE
-               && proc -> has_return == 0)
+       if(proc -> type -> base -> class == OBERON_TYPE_NOTYPE)
        {
                oberon_make_return(ctx, NULL);
        }
        {
                oberon_make_return(ctx, NULL);
        }