Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2008-05

Compiler limitations

10 messages · 7 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Miklos Cserzo

Hi Folks,

according the documentation "Arrays are limited to 2 GBytes in size in the default processor mode." Is there another mode allowing bigger arrays?

Cheers,

miklos

Reply by email

ik
to Miklos Cserzo

What about iterators, linked lists ? You can use them some of them. You can also create a temporary file that built in a way that you understand it as an "array". there are many ways to do work around over this issues.
I yet found a good reason to have such a big data for array. It's bed practice. you should use either iterators or linked list (while many times iterators are better).

Ido

Miklos Cserzo wrote 14 lines
Hi Folks, according the documentation "Arrays are limited to 2 GBytes in size in the default processor mode." Is there another mode allowing bigger arrays? Cheers, miklos _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Florian Klaempfl
to Miklos Cserzo: according the documentation "Arrays are limited to 2 GBytes in size in the default…
Show quoted text 5 lines
Hi Folks, according the documentation "Arrays are limited to 2 GBytes in size in the default processor mode." Is there another mode allowing bigger arrays?

64 Bit mode/compiler.

Show quoted text 9 lines
Cheers, miklos _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Jonas Maebe
to Vincent Snijders
Vincent Snijders wrote 14 lines
Florian Klaempfl schreef: > Miklos Cserzo schrieb: >> >> Hi Folks, >> >> according the documentation "Arrays are limited to 2 GBytes in >> size in the default processor mode." Is there another mode >> allowing bigger arrays? > 64 Bit mode/compiler. Except for darwin. Except it doesn't work: http://www.freepascal.org/testsuite/cgi-bin/testsuite.cgi?action=3&run1id=21737&testfileid=2417

Maybe Win64 doesn't support it either.

And note that this test (and the darwin remark) about statically allocated arrays. Dynamically allocated arrays don't have such limitations.

Jonas

Reply by email

Florian Klaempfl
to Vincent Snijders: Except for darwin. Except it doesn't work: http://www.freepascal.org/testsuite/cgi-bin/tes…
Show quoted text 16 lines
Florian Klaempfl schreef: > Miklos Cserzo schrieb: >> >> Hi Folks, >> >> according the documentation "Arrays are limited to 2 GBytes in size >> in the default processor mode." Is there another mode allowing bigger >> arrays? > > 64 Bit mode/compiler. > Except for darwin. Except it doesn't work: http://www.freepascal.org/testsuite/cgi-bin/testsuite.cgi?action=3&run1id=21737&testfileid=2417

This is operation system dependent also if you can declare static data structures of this size. Things like

type
   ta = array[0..$fffffffff] of byte;
var
   p : ^ta;
begin
   new(p);
end.

should work e.g. on linux.

Reply by email

Vincent Snijders
to Jonas Maebe: Maybe Win64 doesn't support it either. And note that this test (and the darwin remark)…
Jonas Maebe wrote 20 lines
On 09 May 2008, at 22:43, Vincent Snijders wrote: > Florian Klaempfl schreef: >> Miklos Cserzo schrieb: >>> >>> Hi Folks, >>> >>> according the documentation "Arrays are limited to 2 GBytes in size >>> in the default processor mode." Is there another mode allowing >>> bigger arrays? >> 64 Bit mode/compiler. > > Except for darwin. > > Except it doesn't work: > http://www.freepascal.org/testsuite/cgi-bin/testsuite.cgi?action=3&run1id=21737&testfileid=2417 > Maybe Win64 doesn't support it either.

Linux either:
http://www.freepascal.org/testsuite/cgi-bin/testsuite.cgi?action=3&run1id=21719&testfileid=2417

And note that this test (and the darwin remark) about statically allocated arrays. Dynamically allocated arrays don't have such limitations.

Good point.

Vincent

Reply by email

Marco van de Voort
to Florian Klaempfl: This is operation system dependent also if you can declare static data structures of this…
Show quoted text 18 lines
Vincent Snijders schrieb: > > Except it doesn't work: > http://www.freepascal.org/testsuite/cgi-bin/testsuite.cgi?action=3&run1id=21737&testfileid=2417 This is operation system dependent also if you can declare static data structures of this size. Things like type ta = array[0..$fffffffff] of byte; var p : ^ta; begin new(p); end. should work e.g. on linux.

Has sb meanwhile crafted an executable on win64 that actually uses >2GB ?

Reply by email

Daniël Mantione
to Florian Klaempfl: This is operation system dependent also if you can declare static data structures of this…

Op Fri, 9 May 2008, schreef Florian Klaempfl:

Show quoted text 31 lines
Vincent Snijders schrieb: > Florian Klaempfl schreef: >> Miklos Cserzo schrieb: >>> >>> Hi Folks, >>> >>> according the documentation "Arrays are limited to 2 GBytes in size in >>> the default processor mode." Is there another mode allowing bigger >>> arrays? >> >> 64 Bit mode/compiler. >> > > Except for darwin. > > Except it doesn't work: > http://www.freepascal.org/testsuite/cgi-bin/testsuite.cgi?action=3&run1id=21737&testfileid=2417 This is operation system dependent also if you can declare static data structures of this size. Things like type ta = array[0..$fffffffff] of byte; var p : ^ta; begin new(p); end. should work e.g. on linux.

Yes, this would work, but wrapping it in a record and adding a field to it might not work. The reason is that the x86_64 still uses singed 32-bit displacements in its operands. To support this, a different code generation is needed, which we don't have.

Many compilers have an mcmodel switch. FPC's x86_64 code generation compares to mcmodel=small.

Daniël

Reply by email

Florian Klaempfl
to Daniël Mantione
Show quoted text 40 lines
Op Fri, 9 May 2008, schreef Florian Klaempfl: > Vincent Snijders schrieb: >> Florian Klaempfl schreef: >>> Miklos Cserzo schrieb: >>>> >>>> Hi Folks, >>>> >>>> according the documentation "Arrays are limited to 2 GBytes in size >>>> in the default processor mode." Is there another mode allowing >>>> bigger arrays? >>> >>> 64 Bit mode/compiler. >>> >> >> Except for darwin. >> >> Except it doesn't work: >> http://www.freepascal.org/testsuite/cgi-bin/testsuite.cgi?action=3&run1id=21737&testfileid=2417 > > > This is operation system dependent also if you can declare static data > structures of this size. Things like > > type > ta = array[0..$fffffffff] of byte; > var > p : ^ta; > > begin > new(p); > end. > > should work e.g. on linux. Yes, this would work, but wrapping it in a record and adding a field to it might not work. The reason is that the x86_64 still uses singed 32-bit displacements in its operands.

This is only important for static data which requires relocation. For heap/stack the compiler simply generates the constants.

Show quoted text 5 lines
To support this, a different code generation is needed, which we don't have. Many compilers have an mcmodel switch. FPC's x86_64 code generation compares to mcmodel=small.

Reply by email