Browse Source

* Do not perform optimization of nested procedures for:
- targets which use a special struct to access parent's variables;
- pure assembler procedures (for compatibility with old code).

git-svn-id: trunk@45322 -

yury 5 years ago
parent
commit
254d0c0e2c
1 changed files with 10 additions and 4 deletions
  1. 10 4
      compiler/psub.pas

+ 10 - 4
compiler/psub.pas

@@ -2383,11 +2383,17 @@ implementation
          { parse the code ... }
          code:=block(current_module.islibrary);
 
-         if is_nested_pd(procdef) and not (pio_needs_parentfp in procdef.implprocoptions) then
+         { If this is a nested procedure which does not access its parent's frame
+           pointer, we can optimize it by removing the hidden $parentfp parameter.
+           Do not perform this for:
+             - targets which use a special struct to access parent's variables;
+             - pure assembler procedures (for compatibility with old code).
+         }
+         if not (target_info.system in systems_fpnestedstruct) and
+            is_nested_pd(procdef) and
+            not (pio_needs_parentfp in procdef.implprocoptions) and
+            not (po_assembler in procdef.procoptions) then
            begin
-             { If this nested procedure does not access its parent's frame pointer,
-               we can optimize it by removing the hidden $parentfp parameter.
-             }
              exclude(procdef.procoptions, po_delphi_nested_cc);
              parentfp_sym:=procdef.parast.Find('parentfp');
              if parentfp_sym = nil then