diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index 91cf71ec3d..e922224155 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -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; diff --git a/ide/frames/compiler_codegen_options.lfm b/ide/frames/compiler_codegen_options.lfm index aac5ce1a16..00b57b80b8 100644 --- a/ide/frames/compiler_codegen_options.lfm +++ b/ide/frames/compiler_codegen_options.lfm @@ -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 diff --git a/ide/frames/compiler_codegen_options.pas b/ide/frames/compiler_codegen_options.pas index 111a36b32d..6fcb2f1acf 100644 --- a/ide/frames/compiler_codegen_options.pas +++ b/ide/frames/compiler_codegen_options.pas @@ -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 := ''; diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index d5c945a445..773ecda28b 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -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'; diff --git a/ideintf/compoptsintf.pas b/ideintf/compoptsintf.pas index 45ad0956bb..bcf13c00f3 100644 --- a/ideintf/compoptsintf.pas +++ b/ideintf/compoptsintf.pas @@ -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;