From: Simon Wright <simon@pushface.org>
Subject: [Bounded] Vectors, reference types, and the secondary stack
Date: Sun, 15 Feb 2015 16:21:43 +0000
Date: 2015-02-15T16:21:43+00:00 [thread overview]
Message-ID: <lyd25bcfhk.fsf@pushface.org> (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.
reply other threads:[~2015-02-15 16:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox