public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] modula-2: Fix stack size request in initPreemptive [PR108405]
@ 2023-01-14 10:50 Iain Sandoe
  2023-01-23 15:34 ` Gaius Mulley
  0 siblings, 1 reply; 2+ messages in thread
From: Iain Sandoe @ 2023-01-14 10:50 UTC (permalink / raw)
  To: gcc-patches; +Cc: gaiusmod2

Given that, currently, this value is not configurable per target the
short-term solution is to avoid a bad request.

Tested on x86_64-darwin21, OK for trunk?
thanks
Iain

--- 8< ---

As noted in the PR, the problem is that we make a request for additional
stack that violates the constraints on some systems.

This patch chooses a value that is divisible by common OS page sizes.

TODO: the user value should be checked and then an exception thrown if it
is not suitable.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

	PR modula2/108405

gcc/m2/ChangeLog:

	* gm2-libs-iso/Preemptive.mod (initPreemptive): Use a value for
	extra space that is divisible by common OS pagesizes.
---
 gcc/m2/gm2-libs-iso/Preemptive.mod | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/m2/gm2-libs-iso/Preemptive.mod b/gcc/m2/gm2-libs-iso/Preemptive.mod
index 59940b6bae8..e747028d5be 100644
--- a/gcc/m2/gm2-libs-iso/Preemptive.mod
+++ b/gcc/m2/gm2-libs-iso/Preemptive.mod
@@ -33,6 +33,9 @@ FROM libc IMPORT printf ;
 
 CONST
    debugging = FALSE ;
+   (* The space we request becomes part of a stack request, which generally
+      has constraints on size and alignment.  *)
+   extraWorkSpace = 10 * 1024 * 1024 ;
 
 (*
    timer - the timer process which runs at maximum scheduling priority with
@@ -107,7 +110,7 @@ BEGIN
    IF NOT init
    THEN
       init := TRUE ;
-      Create (timer, 10000000, MAX (Urgency), NIL, timerId) ;
+      Create (timer, extraWorkSpace, MAX (Urgency), NIL, timerId) ;
       Activate (timerId)
    END
 END initPreemptive ;
-- 
2.37.1 (Apple Git-137.1)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] modula-2: Fix stack size request in initPreemptive [PR108405]
  2023-01-14 10:50 [PATCH] modula-2: Fix stack size request in initPreemptive [PR108405] Iain Sandoe
@ 2023-01-23 15:34 ` Gaius Mulley
  0 siblings, 0 replies; 2+ messages in thread
From: Gaius Mulley @ 2023-01-23 15:34 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: gcc-patches, iain

Iain Sandoe <iains.gcc@gmail.com> writes:

> Given that, currently, this value is not configurable per target the
> short-term solution is to avoid a bad request.
>
> Tested on x86_64-darwin21, OK for trunk?
> thanks
> Iain

Hi Iain,

yes this is fine.  LGTM - thanks

regards,
Gaius

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-23 15:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-14 10:50 [PATCH] modula-2: Fix stack size request in initPreemptive [PR108405] Iain Sandoe
2023-01-23 15:34 ` Gaius Mulley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).