2
0
Эх сурвалжийг харах

* fixed popping the unused function results of methods returning implicit
function pointer type results (records, shorstrings, ...): always pop a
single stack slot in that case

git-svn-id: branches/jvmbackend@19598 -

Jonas Maebe 13 жил өмнө
parent
commit
1401c4e573

+ 15 - 16
compiler/jvm/njvmcal.pas

@@ -415,26 +415,25 @@ implementation
         if (tabstractprocdef(procdefinition).proctypeoption=potype_constructor) and
         if (tabstractprocdef(procdefinition).proctypeoption=potype_constructor) and
            (current_procinfo.procdef.proctypeoption=potype_constructor) then
            (current_procinfo.procdef.proctypeoption=potype_constructor) then
           exit;
           exit;
+        if is_void(resultdef) then
+          exit;
         if (location.loc=LOC_REFERENCE) then
         if (location.loc=LOC_REFERENCE) then
           tg.ungetiftemp(current_asmdata.CurrAsmList,location.reference);
           tg.ungetiftemp(current_asmdata.CurrAsmList,location.reference);
         if assigned(funcretnode) then
         if assigned(funcretnode) then
           exit;
           exit;
-        case resultdef.size of
-          0:
-            ;
-          1..4:
-            begin
-              current_asmdata.CurrAsmList.concat(taicpu.op_none(a_pop));
-              thlcgjvm(hlcg).decstack(current_asmdata.CurrAsmList,1);
-            end;
-          8:
-            begin
-              current_asmdata.CurrAsmList.concat(taicpu.op_none(a_pop2));
-              thlcgjvm(hlcg).decstack(current_asmdata.CurrAsmList,2);
-            end
-          else
-            internalerror(2011010305);
-        end;
+        if jvmimplicitpointertype(resultdef) or
+           (resultdef.size in [1..4]) then
+          begin
+            current_asmdata.CurrAsmList.concat(taicpu.op_none(a_pop));
+            thlcgjvm(hlcg).decstack(current_asmdata.CurrAsmList,1);
+          end
+        else if resultdef.size=8 then
+          begin
+            current_asmdata.CurrAsmList.concat(taicpu.op_none(a_pop2));
+            thlcgjvm(hlcg).decstack(current_asmdata.CurrAsmList,2);
+          end
+        else
+          internalerror(2011010305);
       end;
       end;