From: DeaDDooMER Date: Wed, 30 Aug 2017 15:00:05 +0000 (+0300) Subject: JVM: исправлен вызов локальных процедур вложенностью больше одного X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=f4a67f6ba1dc6b2780e1cda553a1411469bf8b33;p=dsw-obn.git JVM: исправлен вызов локальных процедур вложенностью больше одного --- diff --git a/Test.obn b/Test.obn index a704f0d..6fae529 100644 --- a/Test.obn +++ b/Test.obn @@ -1,23 +1,3 @@ MODULE Test; - TYPE - CPinfo = RECORD - tag : INTEGER; - index : ARRAY 2 OF LONGINT; - int : LONGINT; - float : REAL; - long : HUGEINT; - double : LONGREAL; - utf8 : POINTER TO ARRAY OF CHAR; - END; - - CPool = POINTER TO ARRAY OF CPinfo; - - VAR - i : HUGEINT; - cpool : CPool; - -BEGIN - i := 16; - NEW(cpool, i); END Test. diff --git a/count.sh b/count.sh index 1e5db9d..57fabce 100755 --- a/count.sh +++ b/count.sh @@ -1,16 +1,40 @@ #!/bin/sh +CompilerSources() +{ + find src -name '*.c' -or -name '*.h' +} + +RuntimeSources() +{ + find rtl -name '*.java' -or -name '*.obn' +} + +TestsSources() +{ + find tests -name '*.obn' +} + +OctaoxygenSources() +{ + find octaoxygen -name '*.obn' -or -name '*.Mod' +} + echo Compiler Sources: -wc -l $(find . -name '*.c' -or -name '*.h') +wc -l $(CompilerSources) echo echo Runtime Library: -wc -l $(find rtl -name '*.java' -or -name '*.obn') +wc -l $(RuntimeSources) echo echo Tests: -wc -l $(find tests -name '*.obn') +wc -l $(TestsSources) + +echo +echo Octaoxygen: +wc -l $(OctaoxygenSources) echo echo Total: -wc -l $(find . -name '*.c' -or -name '*.h' -or -name '*.java' -or -name '*.obn') | grep total +wc -l $(CompilerSources) $(RuntimeSources) $(TestsSources) $(OctaoxygenSources) | grep total diff --git a/obn-run-tests.sh b/obn-run-tests.sh index 57756c3..813e6e5 100755 --- a/obn-run-tests.sh +++ b/obn-run-tests.sh @@ -95,3 +95,5 @@ maketest Test22 makecomp Test23A makefail Test23B + +maketest Test24 diff --git a/src/backends/jvm/generator-jvm-abi.c b/src/backends/jvm/generator-jvm-abi.c index f277188..353ce21 100644 --- a/src/backends/jvm/generator-jvm-abi.c +++ b/src/backends/jvm/generator-jvm-abi.c @@ -623,7 +623,7 @@ jvm_generate_staticlinks(oberon_object_t * proc) p = proc -> gen_proc; - jvm_generate_staticlinks_recursive(p, proc -> parent, p -> level); + jvm_generate_staticlinks_recursive(p, proc -> parent, p -> level - 1); } static void @@ -655,10 +655,11 @@ jvm_create_static_links(oberon_object_t * proc) size_t sz = sizeof(*p -> reg_frame) * max_frames; p -> max_frames = max_frames; p -> reg_frame = GC_MALLOC(sz); - memset(p -> reg_frame, 0, sz); + memset(p -> reg_frame, 255, sz); p -> level = max_frames - 1; - jvm_create_staticlinks_recursive(p, proc -> parent, p -> level); + + jvm_create_staticlinks_recursive(p, proc -> parent, p -> level - 1); } static void diff --git a/tests/Test24.obn b/tests/Test24.obn new file mode 100644 index 0000000..599916c --- /dev/null +++ b/tests/Test24.obn @@ -0,0 +1,25 @@ +MODULE Test24; + +IMPORT Out; + +PROCEDURE W; + PROCEDURE Z; + PROCEDURE Y; + PROCEDURE X; + BEGIN (* X *) + X; Y; Z; W; + END X; + BEGIN (* Y *) + X; Y; Z; W; + END Y; + BEGIN (* Z *) + Y; Z; W; + END Z; +BEGIN (* W *) + Z; W; +END W; + +END Test24. + +Проверка вложенных процедур. +Должно как компилироваться, так и проходить верификацию в рантайме.