* stack related things (sizes, calculations, etc.) are now 64 bit on 64 bit platforms

* default stack size is now also 32k for Windows (allows the use of stack checking when using threads)

git-svn-id: trunk@1718 -
This commit is contained in:
tom_at_work 2005-11-10 17:06:25 +00:00
parent 54dee95053
commit 367df58016
20 changed files with 31 additions and 42 deletions

View File

@ -360,14 +360,14 @@ implementation
begin
{ stacksize can be specified and is now simulated }
maybe_new_object_file(asmlist[al_globals]);
new_section(asmlist[al_globals],sec_data,'__stklen',4);
asmlist[al_globals].concat(Tai_symbol.Createname_global('__stklen',AT_DATA,4));
asmlist[al_globals].concat(Tai_const.Create_32bit(stacksize));
new_section(asmlist[al_globals],sec_data,'__stklen', sizeof(aint));
asmlist[al_globals].concat(Tai_symbol.Createname_global('__stklen',AT_DATA,sizeof(aint)));
asmlist[al_globals].concat(Tai_const.Create_aint(stacksize));
{ Initial heapsize }
maybe_new_object_file(asmlist[al_globals]);
new_section(asmlist[al_globals],sec_data,'__heapsize',4);
asmlist[al_globals].concat(Tai_symbol.Createname_global('__heapsize',AT_DATA,4));
asmlist[al_globals].concat(Tai_const.Create_32bit(heapsize));
new_section(asmlist[al_globals],sec_data,'__heapsize',sizeof(aint));
asmlist[al_globals].concat(Tai_symbol.Createname_global('__heapsize',AT_DATA,sizeof(aint)));
asmlist[al_globals].concat(Tai_const.Create_aint(heapsize));
end;

View File

@ -181,7 +181,7 @@ end;
{ TThread }
constructor TThread.Create(CreateSuspended: Boolean;
const StackSize: DWord = DefaultStackSize);
const StackSize: SizeUInt = DefaultStackSize);
begin
// lets just hope that the user doesn't create a thread
// via BeginThread and creates the first TThread Object in there!

View File

@ -186,7 +186,7 @@ end;
{ TThread }
constructor TThread.Create(CreateSuspended: Boolean;
const StackSize: DWord = DefaultStackSize);
const StackSize: SizeUInt = DefaultStackSize);
begin
// lets just hope that the user doesn't create a thread
// via BeginThread and creates the first TThread Object in there!

View File

@ -46,7 +46,7 @@ begin
end;
constructor TThread.Create(CreateSuspended: Boolean; const StackSize: DWord = DefaultStackSize);
constructor TThread.Create(CreateSuspended: Boolean; const StackSize: SizeUInt = DefaultStackSize);
begin
{IsMultiThread := TRUE; }

View File

@ -43,7 +43,7 @@ const
{ Used by the ansistrings and maybe also other things in the future }
var
emptychar : char;public name 'FPC_EMPTYCHAR';
initialstklen : longint;external name '__stklen';
initialstklen : SizeUint;external name '__stklen';
@ -546,7 +546,7 @@ end;
{$DEFINE STACKCHECK}
{$ENDIF}
{$S-}
procedure fpc_stackcheck(stack_size:Cardinal);[public,alias:'FPC_STACKCHECK'];
procedure fpc_stackcheck(stack_size:SizeUInt);[public,alias:'FPC_STACKCHECK'];
var
c : Pointer;
begin

View File

@ -350,7 +350,7 @@ ThreadVar
InOutRes : Word;
{ Stack checking }
StackBottom : Pointer;
StackLength : Cardinal;
StackLength : SizeUInt;
{ Numbers for routines that have compiler magic }

View File

@ -21,7 +21,7 @@ Var
Threadvar initialization
*****************************************************************************}
procedure InitThread(stklen:cardinal);
procedure InitThread(stklen:SizeUInt);
begin
SysResetFPU;
{ ExceptAddrStack and ExceptObjectStack are threadvars }
@ -63,9 +63,9 @@ Var
end;
function BeginThread(ThreadFunction : tthreadfunc;p : pointer;
var ThreadId : TThreadID; const SS: DWord) : TThreadID;
var ThreadId : TThreadID; const stacksize: SizeUInt) : TThreadID;
begin
BeginThread:=BeginThread(nil,SS,ThreadFunction,p,0,ThreadId);
BeginThread:=BeginThread(nil,stacksize,ThreadFunction,p,0,ThreadId);
end;
procedure EndThread;
@ -73,13 +73,7 @@ Var
EndThread(0);
end;
function BeginThread(sa : Pointer;stacksize : dword; ThreadFunction : tthreadfunc;p : pointer;creationFlags : dword; var ThreadId : TThreadID) : TThreadID;
begin
Result:=CurrentTM.BeginThread(sa,stacksize,threadfunction,P,creationflags,ThreadID);
end;
function BeginThread(sa : Pointer;stacksize : qword; ThreadFunction : tthreadfunc;p : pointer;creationFlags : dword; var ThreadId : TThreadID) : TThreadID;
function BeginThread(sa : Pointer;stacksize : SizeUInt; ThreadFunction : tthreadfunc;p : pointer;creationFlags : dword; var ThreadId : TThreadID) : TThreadID;
begin
Result:=CurrentTM.BeginThread(sa,stacksize,threadfunction,P,creationflags,ThreadID);

View File

@ -15,13 +15,8 @@
**********************************************************************}
const
{$ifdef mswindows}
{ on windows, use stack size of starting process }
DefaultStackSize = 0;
{$else mswindows}
{ including 16384 margin for stackchecking }
DefaultStackSize = 32768;
{$endif mswindows}
type
PEventState = pointer;
@ -102,13 +97,13 @@ Procedure SetNoThreadManager;
{$endif DISABLE_NO_THREAD_MANAGER}
// Needs to be exported, so the manager can call it.
procedure InitThreadVars(RelocProc : Pointer);
procedure InitThread(stklen:cardinal);
procedure InitThread(stklen:SizeUInt);
{*****************************************************************************
Multithread Handling
*****************************************************************************}
function BeginThread(sa : Pointer;stacksize : dword;
function BeginThread(sa : Pointer;stacksize : SizeUInt;
ThreadFunction : tthreadfunc;p : pointer;creationFlags : dword;
var ThreadId : TThreadID) : TThreadID;
@ -118,7 +113,7 @@ function BeginThread(ThreadFunction : tthreadfunc) : TThreadID;
function BeginThread(ThreadFunction : tthreadfunc;p : pointer) : TThreadID;
function BeginThread(ThreadFunction : tthreadfunc;p : pointer; var ThreadId : TThreadID) : TThreadID;
function BeginThread(ThreadFunction : tthreadfunc;p : pointer;
var ThreadId : TThreadID; const SS: DWord) : TThreadID;
var ThreadId : TThreadID; const stacksize: SizeUInt) : TThreadID;
procedure EndThread(ExitCode : DWord);
procedure EndThread;

View File

@ -186,7 +186,7 @@ end;
{ TThread }
constructor TThread.Create(CreateSuspended: Boolean;
const StackSize: DWord = DefaultStackSize);
const StackSize: SizeUInt = DefaultStackSize);
begin
// lets just hope that the user doesn't create a thread
// via BeginThread and creates the first TThread Object in there!

View File

@ -112,7 +112,7 @@ begin
end;
constructor TThread.Create(CreateSuspended: Boolean;
const StackSize: DWord = DefaultStackSize);
const StackSize: SizeUInt = DefaultStackSize);
var
Flags: cardinal;
begin

View File

@ -177,7 +177,7 @@ end;
{ TThread }
constructor TThread.Create(CreateSuspended: Boolean;
const StackSize: DWord = DefaultStackSize);
const StackSize: SizeUInt = DefaultStackSize);
begin
// lets just hope that the user doesn't create a thread
// via BeginThread and creates the first TThread Object in there!

View File

@ -151,7 +151,7 @@ function ThreadMain(param : pointer) : dword; cdecl;
DoneThread;
end;
function SysBeginThread(sa : Pointer;stacksize : dword;
function SysBeginThread(sa : Pointer;stacksize : SizeUInt;
ThreadFunction : tthreadfunc;p : pointer;
creationFlags : dword; var ThreadId : DWord) : DWord;

View File

@ -150,7 +150,7 @@ end;
constructor TThread.Create(CreateSuspended: Boolean;
const StackSize: DWord = DefaultStackSize);
const StackSize: SizeUInt = DefaultStackSize);
var
Flags: Integer;
begin

View File

@ -126,7 +126,7 @@
end;
function SysBeginThread(sa : Pointer;stacksize : dword;
function SysBeginThread(sa : Pointer;stacksize : SizeUInt;
ThreadFunction : tthreadfunc;p : pointer;
creationFlags : dword; var ThreadId : THandle) : DWord;
var

View File

@ -252,7 +252,7 @@ end;
{ TThread }
constructor TThread.Create(CreateSuspended: Boolean;
const StackSize: DWord = DefaultStackSize);
const StackSize: SizeUInt = DefaultStackSize);
begin
// lets just hope that the user doesn't create a thread
// via BeginThread and creates the first TThread Object in there!

View File

@ -186,7 +186,7 @@ begin
end;
{ TThread }
constructor TThread.Create(CreateSuspended: Boolean; const StackSize: DWord = DefaultStackSize);
constructor TThread.Create(CreateSuspended: Boolean; const StackSize: SizeUInt = DefaultStackSize);
begin
// lets just hope that the user doesn't create a thread
// via BeginThread and creates the first TThread Object in there!

View File

@ -184,7 +184,7 @@ end;
end;
function SysBeginThread(sa : Pointer;stacksize : dword;
function SysBeginThread(sa : Pointer;stacksize : SizeUInt;
ThreadFunction : tthreadfunc;p : pointer;
creationFlags : dword; var ThreadId : TThreadID) : DWord;
var

View File

@ -174,7 +174,7 @@ begin
end;
constructor TThread.Create(CreateSuspended: Boolean;
const StackSize: DWord = DefaultStackSize);
const StackSize: SizeUInt = DefaultStackSize);
var
Flags: cardinal;
begin

View File

@ -115,7 +115,7 @@ begin
end;
constructor TThread.Create(CreateSuspended: Boolean;
const StackSize: DWord = DefaultStackSize);
const StackSize: SizeUInt = DefaultStackSize);
var
Flags: Integer;
begin

View File

@ -114,7 +114,7 @@ begin
if FreeThread then Thread.Free;
end;
constructor TThread.Create(CreateSuspended: Boolean; const StackSize: DWord = DefaultStackSize);
constructor TThread.Create(CreateSuspended: Boolean; const StackSize: SizeUInt = DefaultStackSize);
var
Flags: Integer;
begin