Bladeren bron

* add get_frame as an internal symbol for the jvm target because that target
defines INTERNAL_BACKTRACE (which assumes get_frame to be internal rather
than a system unit procedure)
* changed fpc_assert() declaration for jvm to be the same as for other
targets, so the same code can be used to call it in ninl now that's
called from the first pass

git-svn-id: trunk@21903 -

Jonas Maebe 13 jaren geleden
bovenliggende
commit
56fcc87cb2
6 gewijzigde bestanden met toevoegingen van 18 en 26 verwijderingen
  1. 4 12
      compiler/jvm/njvminl.pas
  2. 10 3
      compiler/ninl.pas
  3. 2 2
      compiler/psystem.pas
  4. 1 1
      rtl/java/jcompproc.inc
  5. 1 1
      rtl/java/jsystem.inc
  6. 0 7
      rtl/jvm/jvm.inc

+ 4 - 12
compiler/jvm/njvminl.pas

@@ -38,8 +38,7 @@ interface
 
           function first_copy: tnode; override;
           function first_assigned: tnode; override;
-
-          function first_assert: tnode; override;
+          function first_get_frame: tnode; override;
 
           function first_box: tnode; override;
           function first_unbox: tnode; override;
@@ -242,17 +241,10 @@ implementation
       end;
 
 
-    function tjvminlinenode.first_assert: tnode;
-      var
-        paras: tcallparanode;
+    function tjvminlinenode.first_get_frame: tnode;
       begin
-        paras:=tcallparanode(tcallparanode(left).right);
-        paras:=ccallparanode.create(cstringconstnode.createstr(current_module.sourcefiles.get_file_name(current_filepos.fileindex)),paras);
-        paras:=ccallparanode.create(genintconstnode(fileinfo.line),paras);
-        result:=cifnode.create(cnotnode.create(tcallparanode(left).left),
-           ccallnode.createintern('fpc_assert',paras),nil);
-        tcallparanode(left).left:=nil;
-        tcallparanode(left).right:=nil;
+        { no frame pointer on the JVM target }
+        result:=cnilnode.create;
       end;
 
 

+ 10 - 3
compiler/ninl.pas

@@ -66,6 +66,7 @@ interface
           function first_int_real: tnode; virtual;
           function first_abs_long: tnode; virtual;
           function first_IncludeExclude: tnode; virtual;
+          function first_get_frame: tnode; virtual;
           function first_setlength: tnode; virtual;
           function first_copy: tnode; virtual;
           { This one by default generates an internal error, because such
@@ -3436,8 +3437,7 @@ implementation
             end;
          in_get_frame:
             begin
-              include(current_procinfo.flags,pi_needs_stackframe);
-              expectloc:=LOC_CREGISTER;
+              result:=first_get_frame;
             end;
          in_get_caller_frame:
             begin
@@ -3613,6 +3613,13 @@ implementation
        end;
 
 
+     function tinlinenode.first_get_frame: tnode;
+       begin
+         include(current_procinfo.flags,pi_needs_stackframe);
+         expectloc:=LOC_CREGISTER;
+       end;
+
+
      function tinlinenode.first_setlength: tnode;
       var
         paras   : tnode;
@@ -3794,7 +3801,7 @@ implementation
          paras:=tcallparanode(tcallparanode(left).right);
          paras:=ccallparanode.create(cstringconstnode.createstr(current_module.sourcefiles.get_file_name(current_filepos.fileindex)),paras);
          paras:=ccallparanode.create(genintconstnode(fileinfo.line),paras);
-{$if defined(x86) or defined(arm)}
+{$if defined(x86) or defined(arm) or defined(jvm)}
          paras:=ccallparanode.create(geninlinenode(in_get_frame,false,nil),paras);
 {$else}
          paras:=ccallparanode.create(ccallnode.createinternfromunit('SYSTEM','GET_FRAME',nil),paras);

+ 2 - 2
compiler/psystem.pas

@@ -96,9 +96,9 @@ implementation
         systemunit.insert(tsyssym.create('Length',in_length_x));
         systemunit.insert(tsyssym.create('New',in_new_x));
         systemunit.insert(tsyssym.create('Dispose',in_dispose_x));
-{$if defined(x86) or defined(arm)}
+{$if defined(x86) or defined(arm) or defined(jvm)}
         systemunit.insert(tsyssym.create('Get_Frame',in_get_frame));
-{$endif defined(x86) or defined(arm)}
+{$endif defined(x86) or defined(arm) or defined(jvm)}
         systemunit.insert(tsyssym.create('Unaligned',in_unaligned_x));
         systemunit.insert(tsyssym.create('ObjCSelector',in_objc_selector_x)); { objc only }
         systemunit.insert(tsyssym.create('ObjCEncode',in_objc_encode_x)); { objc only }

+ 1 - 1
rtl/java/jcompproc.inc

@@ -640,7 +640,7 @@ Procedure fpc_HandleError (Errno : longint); compilerproc;
 
 procedure fpc_AbstractErrorIntern;compilerproc;
 *)
-procedure fpc_assert(Const Msg,FName:unicodestring;LineNo:Longint{;ErrorAddr:Pointer}); compilerproc;
+procedure fpc_assert(Const Msg,FName:unicodestring;LineNo:Longint;ErrorAddr:Pointer); compilerproc;
 
 {$ifdef FPC_HAS_FEATURE_FILEIO}
 Procedure fpc_reset_typed(var f : TypedFile;Size : Longint); compilerproc;

+ 1 - 1
rtl/java/jsystem.inc

@@ -1308,7 +1308,7 @@ begin
 end;
 
 
-Procedure fpc_assert(Const Msg,FName:unicodestring;LineNo:Longint{;ErrorAddr:Pointer}); [Public,Alias : 'FPC_ASSERT']; compilerproc;
+Procedure fpc_assert(Const Msg,FName:unicodestring;LineNo:Longint;ErrorAddr:Pointer); [Public,Alias : 'FPC_ASSERT']; compilerproc;
 begin
 (*
   if pointer(AssertErrorProc)<>nil then

+ 0 - 7
rtl/jvm/jvm.inc

@@ -41,13 +41,6 @@ procedure fpc_cpuinit;
   end;
 
 
-{$define FPC_SYSTEM_HAS_GET_FRAME}
-function get_frame:pointer;
-  begin
-    result:=nil;
-  end;
-
-
 {$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
 function get_caller_addr(framebp:pointer;addr:pointer=nil):pointer;
   begin