Ada-Rapporteur-Group / User-Community-Input

Ada User Community Input Working Group - Github Mirror Prototype
26 stars 1 forks source link

Specify storage size for environment task #73

Closed ARG-Editor closed 2 months ago

ARG-Editor commented 7 months ago

Following is a suggestion sent to Ada-Comment between the end of work on Ada 2022 and the setting up of this comment system. In order that it doesn't get lost, I'm reposting it here.

Randy Brukardt, ARG Editor.

From: Simon Wright Sent: Saturday, January 30, 2021 9:37 AM

!topic Specify storage size for environment task !reference Ada 2012 RM13.3(59) !from Simon Wright !discussion

D.1(18) allows specification of the environment task's priority by using the Priority aspect on the main program.

This is handy for embedded code where you don't want to waste the environment task's stack space but need to run its code at a non-default priority.

For similar reasons, it would be useful to be able to specify the environment task's storage size by using the Storage_Size aspect on the main program.

Suggested changes:

In RM 13.3, change (59) to allow a subprogram.

Add (61.1), Likewise, the storage size is associated with the environment task if the aspect is specified for the main subprogram.

If needed, add a Legality Rules section, with (61.2), If the Storage_Size aspect is specified for a subprogram, the expression shall be static.

[Addendum for AdaCore: same consideration applies for Secondary_Stack_Size.]


From: Tucker Taft Sent: Sunday, January 31, 2021 6:54 AM

Makes sense. One comment is that on many O/Ss, the main stack extends automatically (not Windows, alas), so it would be important to understand what the intent is in such an environment. Presumably you would consider the Storage_Size as a minimum, rather than a maximum.


From: Simon Wright Sent: Monday, February 1, 2021 9:09 AM

I guess I was trying to be helpful, and proposed changes in the wrong place: better in the section starting at (65.1)?

Yes, I'd want the Storage_Size specified to be a minimum. (66/3) already says "the Storage_Size attribute of the newly created task object is at least the value of the expression" - would this cover it? In GNAT/macOS, the minimum task stack size appears to be 16384.

ARG-Editor commented 2 months ago

AI22-0107-1 was created in response to this issue.

ARG-Editor commented 2 months ago

AI22-0107-1 was approved at ARG meeting #63D; this issue is completed.