AI22-0107-1

!standard 13.3(65.1/3)                                        24-08-02  AI22-0107-1/04

!standard 13.3(65.3/3)

!standard 13.3(66/3)

!class Amendment 24-04-25

!status Amendment 1-2022 24-05-02

!status WG9 Approved 24-10-10

!status ARG Approved 13-0-0  24-05-02

!status work item 24-04-25

!status received 24-01-28

!submitter Simon Wright

!priority Low

!difficulty Easy

!subject Specifying the Storage_Size for the environment task

!summary

The Storage_Size aspect can be used on the main subprogram to specify the Storage_Size for

the environment task.

!issue

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

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

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

!recommendation

(See Summary.)

!wording

Modify 13.3(65.1/3):

For a task type (including the anonymous type of a single_task_declaration){ or a subprogram}, the following language-defined representation aspect may be specified:

Add after 13.3(65.3/3):

If the Storage_Size aspect is specified for a subprogram, the expression shall be static.

AARM Reason: This value is needed when the environment task starts executing, which is before it could possibly be elaborated.

Modify 13.3(66/3):

When a task object is created, the expression [(if any) associated with]{specified for} the Storage_Size aspect of its type is evaluated; the Storage_Size attribute of the newly created task object is at least the value of the expression.{ For the environment task, the expression specified for the Storage_Size aspect of the main subprogram (if any) is evaluated instead.

The Storage_Size aspect has no effect if it is specified for a subprogram other than the main subprogram; the Storage_Size expression is not associated with any task.}

!discussion

These rules match as closely as possible the rules for specifying the Priority of the environment task.

!corrigendum 13.3(65.1/3)

@drepl

For a task type (including the anonymous type of a @fa{single_task_declaration}), the following language-defined representation aspect may be specified:

@dby

For a task type (including the anonymous type of a @fa{single_task_declaration}) or a subprogram, the following language-defined representation aspect may be specified:

!corrigendum 13.3(65.3/3)

@dinsa

The Storage_Size aspect shall not be specified for a task interface type.

@dinst

If the Storage_Size aspect is specified for a subprogram, the @fa{expression} shall be static.

!corrigendum 13.3(66/3)

@drepl

When a task object is created, the @fa{expression} (if any) associated with the Storage_Size aspect of its type is evaluated; the Storage_Size attribute of the newly created task object is at least the value of the @fa{expression}.

@dby

When a task object is created, the @fa{expression} specified for the Storage_Size aspect of its type is evaluated; the Storage_Size attribute of the newly created task object is at least the value of the @fa{expression}. For the environment task, the @fa{expression} specified for the Storage_Size aspect of the main subprogram (if any) is evaluated instead.

The Storage_Size aspect has no effect if it is specified for a subprogram other than the main subprogram; the Storage_Size @fa{expression} is not associated with any task.

!ACATS test

An ACATS C-Test could be built to try specifying the Storage_Size for the environment task, but there is no way to retrieve the Storage_Size of the environment task (unlike for a task object). Thus, such a test can only test that the aspect is allowed. Generally, such tests are considered out of bounds for the ACATS.

!appendix

See issue #73 on ARG GitHub issue list.


 

From: Randy Brukardt
Added: Friday, May 3, 2024

The last sentence of the additions to 13.3(66/3) said that the “Storage_Size value is not associated with any task”. But Storage_Size is an expression, not a value (as reflected in the other wording in this paragraph). I corrected the wording this way as part of my Editorial Review of this AI.