From 35e75d29be18a7355aaaea9e146f3fda1d91857f Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Mon, 21 Aug 2017 14:53:10 +0300 Subject: [PATCH] =?utf8?q?=D0=94=D0=BB=D1=8F=20=D0=BE=D0=B1=D1=8B=D1=87?= =?utf8?q?=D0=BD=D1=8B=D1=85=20=D0=BF=D1=80=D0=BE=D1=86=D0=B5=D0=B4=D1=83?= =?utf8?q?=D1=80=20=D0=B2=D1=81=D0=B5=D0=B3=D0=B4=D0=B0=20=D0=B3=D0=B5?= =?utf8?q?=D0=BD=D0=B5=D1=80=D0=B8=D1=80=D1=83=D0=B5=D1=82=D1=81=D1=8F=20r?= =?utf8?q?eturn?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- rtl/java/SYSTEM.java | 4 ++++ src/backends/jvm/generator-jvm-asm.c | 6 +++--- src/backends/jvm/generator-jvm.c | 2 ++ src/oberon.c | 3 +-- 4 files changed, 10 insertions(+), 5 deletions(-) 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); } -- 2.29.2