From: DeaDDooMER Date: Mon, 21 Aug 2017 11:53:10 +0000 (+0300) Subject: Для обычных процедур всегда генерируется return X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=35e75d29be18a7355aaaea9e146f3fda1d91857f;p=dsw-obn.git Для обычных процедур всегда генерируется return --- diff --git a/rtl/java/SYSTEM.java b/rtl/java/SYSTEM.java index 20cbe60..bc824fa 100644 --- a/rtl/java/SYSTEM.java +++ b/rtl/java/SYSTEM.java @@ -76,6 +76,10 @@ public class SYSTEM { throw new RuntimeException("NOT IMPLEMENTED"); } + else if(n == -4) + { + throw new RuntimeException("RETURN TRAP"); + } else { throw new RuntimeException("TRAP CODE " + n); diff --git a/src/backends/jvm/generator-jvm-asm.c b/src/backends/jvm/generator-jvm-asm.c index bd1812c..4d0e471 100644 --- a/src/backends/jvm/generator-jvm-asm.c +++ b/src/backends/jvm/generator-jvm-asm.c @@ -235,11 +235,11 @@ jvm_generate_push_float(gen_proc_t * p, double f, int size) { jvm_generate(p, 0, 1, "fconst_0"); } - if(f == 1.0) + else if(f == 1.0) { jvm_generate(p, 0, 1, "fconst_1"); } - if(f == 2.0) + else if(f == 2.0) { 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"); } - if(f == 1.0) + else if(f == 1.0) { jvm_generate(p, 0, 2, "dconst_1"); } diff --git a/src/backends/jvm/generator-jvm.c b/src/backends/jvm/generator-jvm.c index c389ebc..cb8eeef 100644 --- a/src/backends/jvm/generator-jvm.c +++ b/src/backends/jvm/generator-jvm.c @@ -9,6 +9,7 @@ #include #include "../../oberon-internals.h" +#include "../../generator.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; + oberon_generate_trap(ctx, -4); jvm_generate_function_end(p); } diff --git a/src/oberon.c b/src/oberon.c index 72bf1c6..437e769 100644 --- a/src/oberon.c +++ b/src/oberon.c @@ -2412,8 +2412,7 @@ oberon_proc_decl_body(oberon_context_t * ctx, oberon_object_t * proc) 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); }