summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5796379)
raw | patch | inline | side by side (parent: 5796379)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 22 Aug 2017 17:28:48 +0000 (20:28 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 22 Aug 2017 17:28:48 +0000 (20:28 +0300) |
Test.obn | patch | blob | history | |
src/backends/jvm/generator-jvm-basic.c | patch | blob | history | |
src/backends/jvm/generator-jvm.c | patch | blob | history |
diff --git a/Test.obn b/Test.obn
index b9b14ae66be8abf069ff9c19ca678ff3e117694d..3c862c1d5917486426e84aa32439b268bb8baf88 100644 (file)
--- a/Test.obn
+++ b/Test.obn
MODULE Test;
TYPE
- Stream* = POINTER TO Handle;
- Handle = RECORD END;
-
- Writer* = RECORD END;
-
- Printer* = RECORD (Writer) END;
+ Object = RECORD
+ mth : PROCEDURE;
+ END;
VAR
- s : Stream;
- o : Writer;
- out : Printer;
+ p : PROCEDURE;
+ o, a : Object;
+
+PROCEDURE X;
+END X;
-PROCEDURE SetStream(VAR w : Writer; stream : Stream);
+PROCEDURE Z(VAR g : Object);
BEGIN
-END SetStream;
+ g.mth;
+END Z;
BEGIN
- SetStream(o, s);
- SetStream(out, s);
+ p := X;
+ ASSERT(p # NIL);
+ o.mth := X;
+ ASSERT(o.mth # NIL);
+ a := o;
+ ASSERT(a.mth # NIL);
+ Z(a);
END Test.
index e4c6c15635a591cefe9800074670bd34dc29f4cb..855a61722c677d750a8bd84ea2fe27a1652e2723 100644 (file)
case 'd':
return 2;
default:
- gen_error("jvm_cell_size_for_postfix: unk postfix %c", postfix);
+ gen_error("jvm_cell_size_for_postfix: unk postfix %c (%i)", postfix, postfix);
}
return -666;
index bf3b07b52aee0c728cf194e2fbb521b635500557..681b4df71ddf6ea5f4c4c885016b2f1557002fea 100644 (file)
jvm_generate_var_initialization(p, copy_dst);
jvm_generate_var_initialization(p, copy_src);
+ if(rec -> base)
+ {
+ jvm_generate_load(p, copy_dst);
+ jvm_generate_load(p, copy_src);
+ jvm_generate_copy_record(p, rec -> base);
+ }
+
num = rec -> num_decl;
field = rec -> decl;
for(int i = 0; i < num; i++)
@@ -1197,11 +1204,22 @@ jvm_generate_expr_new_pointer(gen_proc_t * p, oberon_type_t * type, int num, obe
static void
jvm_generate_cast_prefix(gen_proc_t * p, char prefix, char postfix)
{
+ if((prefix == 'b' || prefix == 's') && (postfix = 'l' || postfix == 'd'))
+ {
+ prefix = 'i';
+ }
+
if(prefix == postfix)
{
return;
}
+ if((prefix == 'l' || prefix == 'd') && (postfix == 'b' || postfix == 's'))
+ {
+ jvm_generate(p, 2, 1, "%c2i", prefix);
+ prefix = 'i';
+ }
+
int from_cell_size = jvm_cell_size_for_postfix(prefix);
int to_cell_size = jvm_cell_size_for_postfix(postfix);
jvm_generate(p, from_cell_size, to_cell_size, "%c2%c", prefix, postfix);