Browse Source

* some fixes for fake procvar support

git-svn-id: branches/jvmbackend@18680 -
Jonas Maebe 14 năm trước cách đây
mục cha
commit
085d0efead
2 tập tin đã thay đổi với 27 bổ sung1 xóa
  1. 25 0
      compiler/jvm/njvmcal.pas
  2. 2 1
      compiler/ncgcnv.pas

+ 25 - 0
compiler/jvm/njvmcal.pas

@@ -418,11 +418,36 @@ implementation
         realresdef: tdef;
         ppn: tjvmcallparanode;
         pararef: treference;
+{$ifndef nounsupported}
+        i: longint;
+{$endif}
       begin
         if not assigned(typedef) then
           realresdef:=tstoreddef(resultdef)
         else
           realresdef:=tstoreddef(typedef);
+{$ifndef nounsupported}
+        if assigned(right) then
+          begin
+            for i:=1 to pushedparasize do
+              current_asmdata.CurrAsmList.concat(taicpu.op_none(a_pop));
+            if (tabstractprocdef(procdefinition).proctypeoption<>potype_constructor) and
+               (realresdef<>voidtype) then
+              begin
+                case hlcg.def2regtyp(realresdef) of
+                  R_INTREGISTER,
+                  R_ADDRESSREGISTER:
+                    begin
+                      thlcgjvm(hlcg).a_load_const_stack(current_asmdata.CurrAsmList,realresdef,0,hlcg.def2regtyp(realresdef));
+                    end;
+                  R_FPUREGISTER:
+                    thlcgjvm(hlcg).a_loadfpu_const_stack(current_asmdata.CurrAsmList,realresdef,0.0);
+                end;
+                { calling code assumes this result was already put on the stack by the callee }
+                thlcgjvm(hlcg).decstack(current_asmdata.CurrAsmList,align(realresdef.size,4) shr 2);
+              end;
+          end;
+{$endif}
         { a constructor doesn't actually return a value in the jvm }
         if (tabstractprocdef(procdefinition).proctypeoption=potype_constructor) then
           totalremovesize:=pushedparasize

+ 2 - 1
compiler/ncgcnv.pas

@@ -525,7 +525,8 @@ interface
 {$ifdef jvm}
 {$ifndef nounsupported}
       tg.gethltemp(current_asmdata.currasmlist,java_jlobject,java_jlobject.size,tt_normal,r);
-      location_reset_ref(location,LOC_REFERENCE,def_cgsize(resultdef),0);
+      hlcg.a_load_const_ref(current_asmdata.CurrAsmList,java_jlobject,0,r);
+      location_reset_ref(location,LOC_REFERENCE,def_cgsize(resultdef),1);
       location.reference:=r;
       exit;
 {$endif}