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

View File

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

View File

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

View File

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

View File

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