Browse Source

* pass all .j files related to one unit in one go to Jasmin instead of
invoking Jasmin once for every generated .j file

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

Jonas Maebe 14 years ago
parent
commit
b0d050a490
1 changed files with 10 additions and 2 deletions
  1. 10 2
      compiler/agjasmin.pas

+ 10 - 2
compiler/agjasmin.pas

@@ -45,6 +45,8 @@ interface
       TJasminAssembler=class(texternalassembler)
       TJasminAssembler=class(texternalassembler)
        protected
        protected
         jasminjar: tcmdstr;
         jasminjar: tcmdstr;
+        asmfiles: TCmdStrList;
+
         procedure WriteExtraHeader(obj: tobjectdef);
         procedure WriteExtraHeader(obj: tobjectdef);
         procedure WriteInstruction(hp: tai);
         procedure WriteInstruction(hp: tai);
         procedure NewAsmFileForObjectDef(obj: tobjectdef);
         procedure NewAsmFileForObjectDef(obj: tobjectdef);
@@ -127,6 +129,7 @@ implementation
     destructor TJasminAssembler.Destroy;
     destructor TJasminAssembler.Destroy;
       begin
       begin
         InstrWriter.free;
         InstrWriter.free;
+        asmfiles.free;
         inherited destroy;
         inherited destroy;
       end;
       end;
 
 
@@ -428,6 +431,7 @@ implementation
      const
      const
        jasminjarname = 'jasmin.jar';
        jasminjarname = 'jasmin.jar';
      var
      var
+       filenames: tcmdstr;
        jasminjarfound: boolean;
        jasminjarfound: boolean;
      begin
      begin
        if jasminjar='' then
        if jasminjar='' then
@@ -446,7 +450,10 @@ implementation
              Message1(exec_t_using_assembler,jasminjar);
              Message1(exec_t_using_assembler,jasminjar);
          end;
          end;
        result:=target_asm.asmcmd;
        result:=target_asm.asmcmd;
-       Replace(result,'$ASM',maybequoted(ScriptFixFileName(AsmFileName)));
+       filenames:=maybequoted(ScriptFixFileName(AsmFileName));
+       while not asmfiles.empty do
+         filenames:=filenames+' '+asmfiles.GetFirst;
+       Replace(result,'$ASM',filenames);
        if (path<>'') then
        if (path<>'') then
          Replace(result,'$OBJDIR',maybequoted(ScriptFixFileName(path)))
          Replace(result,'$OBJDIR',maybequoted(ScriptFixFileName(path)))
        else
        else
@@ -463,7 +470,7 @@ implementation
         if AsmSize<>AsmStartSize then
         if AsmSize<>AsmStartSize then
           begin
           begin
             AsmClose;
             AsmClose;
-            DoAssemble;
+            asmfiles.Concat(maybequoted(ScriptFixFileName(AsmFileName)));
           end
           end
         else
         else
           AsmClear;
           AsmClear;
@@ -551,6 +558,7 @@ implementation
       begin
       begin
         inherited create(smart);
         inherited create(smart);
         InstrWriter:=TJasminInstrWriter.Create(self);
         InstrWriter:=TJasminInstrWriter.Create(self);
+        asmfiles:=TCmdStrList.Create;
       end;
       end;