IDE: Implement Stack size in compiler options. Issue #17790

git-svn-id: trunk@33620 -
This commit is contained in:
juha 2011-11-18 21:42:59 +00:00
parent 17c600c687
commit 2953423fdc
5 changed files with 91 additions and 10 deletions

View File

@ -1408,6 +1408,7 @@ begin
StackChecks := aXMLConfig.GetValue(p+'Checks/StackChecks/Value', false);
EmulatedFloatOpcodes := aXMLConfig.GetValue(p+'EmulateFloatingPointOpCodes/Value', false);
HeapSize := aXMLConfig.GetValue(p+'HeapSize/Value', 0);
StackSize := aXMLConfig.GetValue(p+'StackSize/Value', 0);
VerifyObjMethodCall := aXMLConfig.GetValue(p+'VerifyObjMethodCallValidity/Value', false);
ReadSmaller;
if FileVersion<7 then begin
@ -1630,6 +1631,7 @@ begin
aXMLConfig.SetDeleteValue(p+'Checks/StackChecks/Value', StackChecks,false);
aXMLConfig.SetDeleteValue(p+'EmulateFloatingPointOpCodes/Value', EmulatedFloatOpcodes,false);
aXMLConfig.SetDeleteValue(p+'HeapSize/Value', HeapSize,0);
aXMLConfig.SetDeleteValue(p+'StackSize/Value', StackSize,0);
aXMLConfig.SetDeleteValue(p+'VerifyObjMethodCallValidity/Value', VerifyObjMethodCall,false);
aXMLConfig.SetDeleteValue(p+'SmallerCode/Value', SmallerCode, false);
aXMLConfig.SetDeleteValue(p+'TargetProcessor/Value', TargetProcessor,'');
@ -2591,6 +2593,10 @@ begin
if (HeapSize > 0) then
switches := switches + ' ' + '-Ch' + IntToStr(HeapSize);
{ Stack Size }
if (StackSize > 0) then
switches := switches + ' ' + '-Cs' + IntToStr(StackSize);
{ Optimizations }
OptimizeSwitches:='';
if SmallerCode then
@ -3043,6 +3049,7 @@ begin
fOverflowChecks := false;
fStackChecks := false;
fHeapSize := 0;
fStackSize := 0;
FSmallerCode := false;
fTargetProc := '';
fTargetCPU := '';
@ -3159,6 +3166,7 @@ begin
fStackChecks := CompOpts.fStackChecks;
FEmulatedFloatOpcodes := CompOpts.fEmulatedFloatOpcodes;
fHeapSize := CompOpts.fHeapSize;
fStackSize := CompOpts.fStackSize;
fEmulatedFloatOpcodes := CompOpts.fEmulatedFloatOpcodes;
FSmallerCode := CompOpts.FSmallerCode;
fTargetProc := CompOpts.fTargetProc;
@ -3307,6 +3315,7 @@ begin
if Done(Tool.AddDiff('StackChecks',fStackChecks,CompOpts.fStackChecks)) then exit;
if Done(Tool.AddDiff('EmulatedFloatOpcodes',FEmulatedFloatOpcodes,CompOpts.FEmulatedFloatOpcodes)) then exit;
if Done(Tool.AddDiff('HeapSize',fHeapSize,CompOpts.fHeapSize)) then exit;
if Done(Tool.AddDiff('StackSize',fStackSize,CompOpts.fStackSize)) then exit;
if Done(Tool.AddDiff('EmulatedFloatOpcodes',fEmulatedFloatOpcodes,CompOpts.fEmulatedFloatOpcodes)) then exit;
if Done(Tool.AddDiff('SmallerCode',FSmallerCode,CompOpts.FSmallerCode)) then exit;
if Done(Tool.AddDiff('TargetProc',fTargetProc,CompOpts.fTargetProc)) then exit;

View File

@ -3,8 +3,8 @@ inherited CompilerCodegenOptionsFrame: TCompilerCodegenOptionsFrame
Width = 601
ClientHeight = 523
ClientWidth = 601
DesignLeft = 271
DesignTop = 89
DesignLeft = 290
DesignTop = 90
object grpUnitStyle: TGroupBox[0]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = grpChecks
@ -104,7 +104,7 @@ inherited CompilerCodegenOptionsFrame: TCompilerCodegenOptionsFrame
TabOrder = 4
end
end
object grpHeapSize: TGroupBox[2]
object grpHeapStackSize: TGroupBox[2]
AnchorSideLeft.Control = grpChecks
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = grpTargetPlatform
@ -121,20 +121,67 @@ inherited CompilerCodegenOptionsFrame: TCompilerCodegenOptionsFrame
AutoSize = True
BorderSpacing.Left = 6
BorderSpacing.Top = 6
Caption = 'grpHeapSize'
Caption = 'grpHeapStackSize'
ClientHeight = 56
ClientWidth = 423
TabOrder = 2
object edtHeapSize: TEdit
Left = 6
AnchorSideLeft.Control = lbHeapSize
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = grpHeapStackSize
AnchorSideRight.Control = grpHeapStackSize
AnchorSideRight.Side = asrBottom
Left = 82
Height = 20
Top = 6
Width = 411
Align = alTop
Width = 335
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Around = 6
TabOrder = 0
Text = 'edtHeapSize'
end
object lbHeapSize: TLabel
AnchorSideLeft.Control = grpHeapStackSize
AnchorSideTop.Control = edtHeapSize
AnchorSideTop.Side = asrCenter
Left = 6
Height = 15
Top = 9
Width = 64
BorderSpacing.Around = 6
Caption = 'lbHeapSize'
ParentColor = False
end
object edtStackSize: TEdit
AnchorSideLeft.Control = lbStackSize
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = edtHeapSize
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = grpHeapStackSize
AnchorSideRight.Side = asrBottom
Left = 82
Height = 20
Top = 32
Width = 335
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Around = 6
TabOrder = 1
Text = 'edtStackSize'
end
object lbStackSize: TLabel
AnchorSideLeft.Control = grpHeapStackSize
AnchorSideTop.Control = edtStackSize
AnchorSideTop.Side = asrCenter
Left = 6
Height = 15
Top = 35
Width = 64
BorderSpacing.Around = 6
Caption = 'lbStackSize'
ParentColor = False
end
end
object grpTargetPlatform: TGroupBox[3]
AnchorSideLeft.Control = grpChecks

View File

@ -27,11 +27,14 @@ type
chkRelocatableUnit: TCheckBox;
chkVerifyObjMethodCall: TCheckBox;
edtHeapSize: TEdit;
edtStackSize: TEdit;
grpChecks: TGroupBox;
grpHeapSize: TGroupBox;
grpHeapStackSize: TGroupBox;
grpOptimizations: TGroupBox;
grpUnitStyle: TGroupBox;
grpTargetPlatform: TGroupBox;
lbHeapSize: TLabel;
lbStackSize: TLabel;
lblTargetCPU: TLabel;
lblTargetOS: TLabel;
lblTargetProcessorProc: TLabel;
@ -121,8 +124,11 @@ begin
chkChecksStack.Caption := dlgCOStack + ' (-Ct)';
chkVerifyObjMethodCall.Caption := lisVerifyMethodCalls + ' (-CR)';
grpHeapSize.Caption := dlgHeapSize + ' (-Ch)';
grpHeapStackSize.Caption := dlgHeapAndStackSize;
lbHeapSize.Caption := dlgHeapSize + ' (-Ch)';
lbStackSize.Caption := dlgStackSize + ' (-Cs)';
edtHeapSize.Text := '';
edtStackSize.Text := '';
grpTargetPlatform.Caption := dlgTargetPlatform;
lblTargetOS.Caption := dlgTargetOS + ' (-T)';
@ -224,8 +230,9 @@ begin
chkChecksStack.Checked := StackChecks;
chkVerifyObjMethodCall.Checked := VerifyObjMethodCall;
grpHeapSize.Enabled := NeedsLinkerOpts;
grpHeapStackSize.Enabled := NeedsLinkerOpts;
edtHeapSize.Text := IntToStr(HeapSize);
edtStackSize.Text := IntToStr(StackSize);
i := TargetOSComboBox.Items.IndexOf(TargetOS);
if i < 0 then
@ -277,6 +284,12 @@ begin
else
HeapSize := hs;
Val(edtStackSize.Text, hs, code);
if (code <> 0) then
StackSize := 0
else
StackSize := hs;
NewTargetOS := TargetOSComboBox.Text;
if TargetOSComboBox.Items.IndexOf(NewTargetOS) <= 0 then
NewTargetOS := '';

View File

@ -1809,7 +1809,9 @@ resourcestring
dlgCORange = 'Range';
dlgCOOverflow = 'Overflow';
dlgCOStack = 'Stack';
dlgHeapAndStackSize = 'Heap and Stack sizes';
dlgHeapSize = 'Heap Size';
dlgStackSize = 'Stack Size';
dlgCONormal = 'Normal Code';
dlgCOFast = 'Faster Code';
dlgCOSmaller = 'Smaller Code';

View File

@ -118,6 +118,7 @@ type
procedure SetGenerateDwarf(const AValue: Boolean);
procedure SetGenGProfCode(const AValue: Boolean);
procedure SetHeapSize(const AValue: Integer);
procedure SetStackSize(const AValue: Integer);
procedure SetIncludeAssertionCode(const AValue: Boolean);
procedure SetInitConst(const AValue: Boolean);
procedure SetIOChecks(const AValue: Boolean);
@ -200,6 +201,7 @@ type
fStackChecks: Boolean;
FEmulatedFloatOpcodes: boolean;
fHeapSize: LongInt;
fStackSize: LongInt;
fVerifyObjMethodCall: boolean;
FSmallerCode: boolean;
fTargetProc: string;
@ -339,6 +341,7 @@ type
property EmulatedFloatOpcodes: boolean read SetEmulatedFloatOpcodes
write SetEmulatedFloatOpcodes;
property HeapSize: Integer read fHeapSize write SetHeapSize;
property StackSize: Integer read fStackSize write SetStackSize;
property VerifyObjMethodCall: boolean read FVerifyObjMethodCall
write SetVerifyObjMethodCall;
property SmallerCode: boolean read FSmallerCode write SetSmallerCode;
@ -731,6 +734,13 @@ begin
IncreaseChangeStamp;
end;
procedure TLazCompilerOptions.SetStackSize(const AValue: Integer);
begin
if fStackSize=AValue then exit;
fStackSize:=AValue;
IncreaseChangeStamp;
end;
procedure TLazCompilerOptions.SetIncludeAssertionCode(const AValue: Boolean);
begin
if fIncludeAssertionCode=AValue then exit;