Re: [fpc-pascal] SPARC / Linux

2017-04-03 Thread Mark Morgan Lloyd

On 13/03/17 09:00, Pierre Free Pascal wrote:

-Message d'origine-> De : fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] De la> part de Mark Morgan 
Lloyd> Envoyé : lundi 13 mars 2017 09:11> À : fpc-pascal@lists.freepascal.org> Objet : Re: [fpc-pascal] SPARC / 
Linux> > On 13/03/17 06:30, Pierre Free Pascal wrote:> > Hi Mark,> > if you mean build a native installer for 
32-btsparc-linux, I can tell> you want you need to do:> > I'm used to building it for my own use. I'll take a look at 
your> instructions for versions later than 2.6.2, since even getting 2.6.4 or> 3.0.0 available would be progress. Time 
permitting :-(

  I would also be interested in those other versions,if you succeed in building them. > > a 
libgdb installation to enable GDB inside FP IDE,which (if you do> not have> > I've found 
libgdb to be a problem on several platforms, it's not> maintained actively.You are breaking my 
heart...I am trying to maintain the internal GDB support for FP IDE,but even if I am a member of 
the GDB maintainer team,this is a huge task, which I never really have time to fulfill.
  I have no access to any sparc machine, thus it is even moredifficult to 
maintain such targets.


For both SPARC/Linux and SPARC/Solaris I'm able to build the fpcsrc 
stuff without GDB. In both cases I can build the entire installation 
bundle, again without GDB.


For SPARC/Linux I can build fpcsrc with GDB_V607 which is the version of 
the library I've been using for many years. I've not tried this yet with 
SPARC/Solaris.


When I try to build the entire installation with GDB support I get

..
   Linking bin/sparc-linux/fp
The installer encountered the following error:
External command 
"/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/compiler/ppcsparc -Tlinux 
-FEbin/sparc-linux -FUunits/sparc-linux/ 
-Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/rtl/units/sparc-linux/ 
-Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/rtl-extra/units/sparc-linux/ 
-Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/fv/units/sparc-linux/ 
-Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/rtl-console/units/sparc-linux/ 
-Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/chm/units/sparc-linux/ 
-Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/fcl-xml/units/sparc-linux/ 
-Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/fcl-base/units/sparc-linux/ 
-Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/fcl-res/units/sparc-linux/ 
-Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/rtl-objpas/units/sparc-linux/ 
-Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/iconvenc/units/sparc-linux/ 
-Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/regexpr/units/sparc-linux/ 
-Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/gdbint/units/sparc-linux/ 
-Ficompiler -Fl -Ur -Xs -O2 -n -dRELEASE -Ur -dNOCATCH -dBrowserCol 
-dGDB -dsparc -Fu../compiler -Fu../compiler/sparc -Fu../compiler/targets 
-Fu../compiler/systems -Fi../compiler/sparc -Fi../compiler -Sg 
-Fl../libgdb/linux/sparc/ -Xd -viq fp.pas" failed with exit code 256. 
Console output:

Target OS: Linux for SPARC
Compiling fp.pas
..
Writing Resource String Table file: fp.rsj
Assembling fp
Linking bin/sparc-linux/fp
/usr/bin/ld: cannot find -lgcc
fp.pas(582) Error: Error while linking
fp.pas(582) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

make[3]: *** [all] Error 1
make[3]: Leaving directory `/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/ide'
make[2]: *** [ide_all] Error 2
make[2]: Leaving directory `/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc'
make[1]: *** [build-stamp.sparc-linux] Error 2
make[1]: Leaving directory `/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc'
make: *** [fpcsrc/build-stamp.sparc-linux] Error 2

I also tried

GDB_V607=1 install/makepack

Unless anybody (Martin?) has any suggestions, I propose to focus on 
building SPARC/Linux and SPARC/Solaris installation bundles without- for 
the moment at least- GDB, in the interest of making something available 
as quickly as possible.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] SPARC / Linux

2017-04-03 Thread Tomas Hajny
On Mon, April 3, 2017 11:29, Mark Morgan Lloyd wrote:
> On 13/03/17 09:00, Pierre Free Pascal wrote:
 .
 .
> When I try to build the entire installation with GDB support I get
>
> ..
> Linking bin/sparc-linux/fp
> The installer encountered the following error:
> External command
> "/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/compiler/ppcsparc -Tlinux
> -FEbin/sparc-linux -FUunits/sparc-linux/
> -Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/rtl/units/sparc-linux/
> -Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/rtl-extra/units/sparc-linux/
> -Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/fv/units/sparc-linux/
> -Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/rtl-console/units/sparc-linux/
> -Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/chm/units/sparc-linux/
> -Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/fcl-xml/units/sparc-linux/
> -Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/fcl-base/units/sparc-linux/
> -Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/fcl-res/units/sparc-linux/
> -Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/rtl-objpas/units/sparc-linux/
> -Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/iconvenc/units/sparc-linux/
> -Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/regexpr/units/sparc-linux/
> -Fu/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/packages/gdbint/units/sparc-linux/
> -Ficompiler -Fl -Ur -Xs -O2 -n -dRELEASE -Ur -dNOCATCH -dBrowserCol
> -dGDB -dsparc -Fu../compiler -Fu../compiler/sparc -Fu../compiler/targets
> -Fu../compiler/systems -Fi../compiler/sparc -Fi../compiler -Sg
> -Fl../libgdb/linux/sparc/ -Xd -viq fp.pas" failed with exit code 256.
> Console output:
> Target OS: Linux for SPARC
> Compiling fp.pas
> ..
> Writing Resource String Table file: fp.rsj
> Assembling fp
> Linking bin/sparc-linux/fp
> /usr/bin/ld: cannot find -lgcc
> fp.pas(582) Error: Error while linking
> fp.pas(582) Fatal: There were 1 errors compiling module, stopping
> Fatal: Compilation aborted
>
> make[3]: *** [all] Error 1
> make[3]: Leaving directory `/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc/ide'
> make[2]: *** [ide_all] Error 2
> make[2]: Leaving directory `/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc'
> make[1]: *** [build-stamp.sparc-linux] Error 2
> make[1]: Leaving directory `/usr/local/src/fpc/fpcbuild-3.0.2/fpcsrc'
> make: *** [fpcsrc/build-stamp.sparc-linux] Error 2
>
> I also tried
>
> GDB_V607=1 install/makepack
>
> Unless anybody (Martin?) has any suggestions, I propose to focus on
> building SPARC/Linux and SPARC/Solaris installation bundles without- for
> the moment at least- GDB, in the interest of making something available
> as quickly as possible.

Check where gcc.a is located and try to find out (by checking the passed
options / directories), why it is found when building fpcsrc but not when
doing the whole package? Possibly pass the respective -Fl to the build
process explicitly (depending on the used options, fpcsrc building might
use a reference in fpc.cfg)?

Tomas


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] SPARC / Linux

2017-04-03 Thread Nikolay Nikolov



On 03/13/2017 10:10 AM, Mark Morgan Lloyd wrote:

On 13/03/17 06:30, Pierre Free Pascal wrote:

Hi Mark,
if you mean build a native installer for 32-btsparc-linux, I can tell 
you want you need to do:


I'm used to building it for my own use. I'll take a look at your 
instructions for versions later than 2.6.2, since even getting 2.6.4 
or 3.0.0 available would be progress. Time permitting :-(


a libgdb installation to enable GDB inside FP IDE,which (if you do 
not have


I've found libgdb to be a problem on several platforms, it's not 
maintained actively.


If you need the IDE, you may try compiling FPC trunk, which no longer 
needs libgdb under Linux, since it now supports GDB/MI.


Nikolay
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Setting record values

2017-04-03 Thread Ryan Joseph
Thanks for the tips, I appreciate it.

This is all pretty trivial but it’s kind of annoying that using an inline class 
function is more efficient than a constructor despite having identical 
functionality. It's tempting to remove the constructors now and replace them 
with inline functions but it seems like the compiler should be smarter and make 
this optimization for me. 

> On Apr 2, 2017, at 10:51 PM, Sven Barth via fpc-pascal 
>  wrote:
> 
> The compiler keeps the assembler code with line information around if
> you pass "-al".
> 
> If you are so concerned about the differences in performance regarding
> using a setter and a construction function you should really learn at
> least in principle how typical assembler code generated by the compiler
> looks like (same for your query about dynamic arrays by the way, though
> there you should also take a look at the implementation of the RTL).
> 
> Here is an example compiled without optimizations aside from inline:
> 
> === code begin ===
> 
> # [47] p.&Set(42, 21);
>movq$U_$P$TRECFUNCS_$$_P,%rax
>movl$21,%edx
>movl$42,%esi
>movq%rax,%rdi
>callP$TRECFUNCS$_$TPOINT_$__$$_SET$LONGINT$LONGINT
> # [48] p := TPoint.Make(42, 21);
>leaq-8(%rbp),%rdi
>movl$21,%edx
>movl$42,%esi
>callP$TRECFUNCS$_$TPOINT_$__$$_MAKE$LONGINT$LONGINT$$TPOINT
>movq-8(%rbp),%rax
>movq%rax,U_$P$TRECFUNCS_$$_P
> # [49] p := TPoint.Make2(42, 21);
>movl$42,U_$P$TRECFUNCS_$$_P
>movl$21,U_$P$TRECFUNCS_$$_P+4
> # [50] p := MakePoint(42, 21);
>movl$21,%esi
>movl$42,%edi
>callP$TRECFUNCS_$$_MAKEPOINT$LONGINT$LONGINT$$TPOINT
>movq%rax,U_$P$TRECFUNCS_$$_P
> # [51] p := MakePoint2(42, 21);
>movl$42,U_$P$TRECFUNCS_$$_P
>movl$21,U_$P$TRECFUNCS_$$_P+4
> 
> === code end ===
> 
> "&Set" is essentially your "SetPoint" method. "Make" is a constructor.
> "Make2" is a static class function with "inline". "MakePoint" is your
> creation function and "MakePoint2" is the same with an inline modifier.
> 
> As you can see the two inline variants ("Make2" and "MakePoint2") are
> the most effective as there's no call and only the two loads of the values.

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Array clearing

2017-04-03 Thread Ryan Joseph

> On Apr 2, 2017, at 11:02 PM, Sven Barth via fpc-pascal 
>  wrote:
> 
> can be easily seen by looking at the implementation of SetLength() in
> $fpcdir/rtl/inc/dynarr.inc, fpc_dynarray_setlength().
> Especially since line 220 (at least in the current revision) contains a
> call to FillChar(), the whole ordeal can only be *more* complex than
> FillChar().

That’s good to know about SetLength.

Is it possible use FillChar on a multidimensional arrays?

arr: array of array of array of integer.
SetLength(arr, 3, 3, 3);
FillChar(arr[0], (3*3*3)*sizeof(integer), false);

I’m just getting crashes.

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal