* [Bounded] Vectors, reference types, and the secondary stack
@ 2015-02-15 16:21 Simon Wright
0 siblings, 0 replies; only message in thread
From: Simon Wright @ 2015-02-15 16:21 UTC (permalink / raw)
It turns out that (GCC 4.9.1) that if you have
package Interval_Containers
is new Ada.Containers.Bounded_Vectors
(Index_Type => Natural,
Element_Type => Ada.Real_Time.Time_Span,
"=" => Ada.Real_Time."=");
Intervals : Interval_Containers.Vector (5);
and then
Intervals.Insert_Space (0, 5);
Intervals (0) := Ada.Real_Time.Milliseconds (50);
then
function Reference
(Container : aliased in out Vector;
Index : Index_Type) return Reference_Type;
returns its result on the secondary stack!
Why would it need to do that? given the (private) definition
type Reference_Type
(Element : not null access Element_Type) is null record;
You ask why I would care. Well, in my STM32F4 RTS the environment task,
in which elaboration happens, isn't actually a task, and doesn't (yet)
have a secondary stack.
The reason it's not a task is that the way to kick off the FreeRTOS
sceduler is to call FreeRTOS.Tasks.Start_Scheduler (aka
vTaskStartScheduler()), which doesn't return unless the scheduler can't
be started; and I haven't found a way to get this behaviour into the
startup code generated by gnatbind, so the poor user has to call it at
the end of their main program.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-02-15 16:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-15 16:21 [Bounded] Vectors, reference types, and the secondary stack Simon Wright
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox