* access-to-classwide has non-static size?
@ 2015-03-27 8:26 Simon Wright
2015-03-27 8:46 ` J-P. Rosen
2015-03-27 8:49 ` Simon Wright
0 siblings, 2 replies; 12+ messages in thread
From: Simon Wright @ 2015-03-27 8:26 UTC (permalink / raw)
I'm creating a PO which has a member which is a bounded vector of
pointer-to-classwide,
type Event_Base is abstract tagged limited private;
type Event_P is access all Event_Base'Class;
...
package Event_Queues is new Ada.Containers.Bounded_Vectors
(Index_Type => Positive,
Element_Type => Event_P);
...
protected type Dispatchable_Events is
...
private
...
The_Events : Event_Queues.Vector (Capacity => Capacity);
and when compiling with the Ravenscar profile (GNAT GPL 2014, GCC 4.9.1,
GCC 5.0.0 20150208) the compiler says
warning: component has non-static size
warning: creation of protected object of type "Dispatchable_Events"
will violate restriction No_Implicit_Heap_Allocations
Is this (the non-static size part!) right?
I tried declaring Event_P "with Size => 64"; no difference.
I think, studying the output of -gnatR, a pointer-to-classwide is a thin
pointer, i.e. 4 bytes on arm-eabi).
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: access-to-classwide has non-static size?
2015-03-27 8:26 access-to-classwide has non-static size? Simon Wright
@ 2015-03-27 8:46 ` J-P. Rosen
2015-03-27 8:53 ` Simon Wright
2015-03-27 8:49 ` Simon Wright
1 sibling, 1 reply; 12+ messages in thread
From: J-P. Rosen @ 2015-03-27 8:46 UTC (permalink / raw)
Le 27/03/2015 09:26, Simon Wright a écrit :
> protected type Dispatchable_Events is
> ...
> private
> ...
> The_Events : Event_Queues.Vector (Capacity => Capacity);
>
> and when compiling with the Ravenscar profile (GNAT GPL 2014, GCC 4.9.1,
> GCC 5.0.0 20150208) the compiler says
>
> warning: component has non-static size
> warning: creation of protected object of type "Dispatchable_Events"
> will violate restriction No_Implicit_Heap_Allocations
>
> Is this (the non-static size part!) right?
It's not the component of the Vector (Event_P) which is non static,
it's the component of the PO (i.e. The_Events).
--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: access-to-classwide has non-static size?
2015-03-27 8:26 access-to-classwide has non-static size? Simon Wright
2015-03-27 8:46 ` J-P. Rosen
@ 2015-03-27 8:49 ` Simon Wright
2015-03-27 8:53 ` Simon Wright
1 sibling, 1 reply; 12+ messages in thread
From: Simon Wright @ 2015-03-27 8:49 UTC (permalink / raw)
Simon Wright <simon@pushface.org> writes:
> type Event_Base is abstract tagged limited private;
> type Event_P is access all Event_Base'Class;
>
> ...
>
> package Event_Queues is new Ada.Containers.Bounded_Vectors
> (Index_Type => Positive,
> Element_Type => Event_P);
>
> ...
>
> protected type Dispatchable_Events is
> ...
> private
> ...
> The_Events : Event_Queues.Vector (Capacity => Capacity);
>
> and when compiling with the Ravenscar profile (GNAT GPL 2014, GCC 4.9.1,
> GCC 5.0.0 20150208) the compiler says
>
> warning: component has non-static size
> warning: creation of protected object of type "Dispatchable_Events"
> will violate restriction No_Implicit_Heap_Allocations
>
> Is this (the non-static size part!) right?
If I declare an Event_Queue.Vector at library level rather than in a PO
I don't get the warnings. So this is a GNAT problem, maybe?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: access-to-classwide has non-static size?
2015-03-27 8:46 ` J-P. Rosen
@ 2015-03-27 8:53 ` Simon Wright
2015-03-27 9:13 ` J-P. Rosen
0 siblings, 1 reply; 12+ messages in thread
From: Simon Wright @ 2015-03-27 8:53 UTC (permalink / raw)
"J-P. Rosen" <rosen@adalog.fr> writes:
> Le 27/03/2015 09:26, Simon Wright a écrit :
>> protected type Dispatchable_Events is
>> ...
>> private
>> ...
>> The_Events : Event_Queues.Vector (Capacity => Capacity);
>>
>> and when compiling with the Ravenscar profile (GNAT GPL 2014, GCC 4.9.1,
>> GCC 5.0.0 20150208) the compiler says
>>
>> warning: component has non-static size
>> warning: creation of protected object of type "Dispatchable_Events"
>> will violate restriction No_Implicit_Heap_Allocations
>>
>> Is this (the non-static size part!) right?
>
> It's not the component of the Vector (Event_P) which is non static,
> it's the component of the PO (i.e. The_Events).
Thanks, J-P. I need to do the allocation explicitly, then. I was hoping
to be able to do it at elaboration.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: access-to-classwide has non-static size?
2015-03-27 8:49 ` Simon Wright
@ 2015-03-27 8:53 ` Simon Wright
0 siblings, 0 replies; 12+ messages in thread
From: Simon Wright @ 2015-03-27 8:53 UTC (permalink / raw)
Simon Wright <simon@pushface.org> writes:
> If I declare an Event_Queue.Vector at library level rather than in a PO
> I don't get the warnings. So this is a GNAT problem, maybe?
No, it's a Simon problem :-)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: access-to-classwide has non-static size?
2015-03-27 8:53 ` Simon Wright
@ 2015-03-27 9:13 ` J-P. Rosen
2015-03-27 14:18 ` Simon Wright
0 siblings, 1 reply; 12+ messages in thread
From: J-P. Rosen @ 2015-03-27 9:13 UTC (permalink / raw)
Le 27/03/2015 09:53, Simon Wright a écrit :
>> It's not the component of the Vector (Event_P) which is non static,
>> > it's the component of the PO (i.e. The_Events).
> Thanks, J-P. I need to do the allocation explicitly, then. I was hoping
> to be able to do it at elaboration.
You didn't show where Capacity was declared. If it's a variable, it's
clearly non static. Did you try it with a constant?
--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: access-to-classwide has non-static size?
2015-03-27 9:13 ` J-P. Rosen
@ 2015-03-27 14:18 ` Simon Wright
2015-03-27 14:58 ` J-P. Rosen
2015-03-27 15:51 ` sbelmont700
0 siblings, 2 replies; 12+ messages in thread
From: Simon Wright @ 2015-03-27 14:18 UTC (permalink / raw)
"J-P. Rosen" <rosen@adalog.fr> writes:
> Le 27/03/2015 09:53, Simon Wright a écrit :
>>> It's not the component of the Vector (Event_P) which is non static,
>>> > it's the component of the PO (i.e. The_Events).
>> Thanks, J-P. I need to do the allocation explicitly, then. I was hoping
>> to be able to do it at elaboration.
>
> You didn't show where Capacity was declared. If it's a variable, it's
> clearly non static. Did you try it with a constant?
It's a constraint to the PO (sorry I left that out).
I've worked out how to do it at elaboration now:
The_Instance_Events : access Event_Queues.Vector :=
new Event_Queues.Vector (Capacity => Capacity);
(compiled but not yet executed - more challenges still to overcome!)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: access-to-classwide has non-static size?
2015-03-27 14:18 ` Simon Wright
@ 2015-03-27 14:58 ` J-P. Rosen
2015-03-27 15:08 ` Egil H H
2015-03-27 15:51 ` sbelmont700
1 sibling, 1 reply; 12+ messages in thread
From: J-P. Rosen @ 2015-03-27 14:58 UTC (permalink / raw)
Le 27/03/2015 15:18, Simon Wright a écrit :
> I've worked out how to do it at elaboration now:
>
> The_Instance_Events : access Event_Queues.Vector :=
> new Event_Queues.Vector (Capacity => Capacity);
So, you are avoiding No_Implicit_Heap_Allocation by having an explicit
heap allocation... ;-). Generally, you have No_Implicit_Heap_Allocation
if you want to be certain to have no dynamic allocation at all.
BTW, you started this thread explaining that you were aiming for the
Ravenscar profile, but No_Implicit_Heap_Allocation is not part of Ravenscar.
--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: access-to-classwide has non-static size?
2015-03-27 14:58 ` J-P. Rosen
@ 2015-03-27 15:08 ` Egil H H
2015-03-27 16:51 ` J-P. Rosen
0 siblings, 1 reply; 12+ messages in thread
From: Egil H H @ 2015-03-27 15:08 UTC (permalink / raw)
On Friday, March 27, 2015 at 3:58:42 PM UTC+1, J-P. Rosen wrote:
> but No_Implicit_Heap_Allocation is not part of Ravenscar.
>
According to the RM, it is:
http://www.adaic.org/resources/add_content/standards/12rm/html/RM-D-13.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: access-to-classwide has non-static size?
2015-03-27 14:18 ` Simon Wright
2015-03-27 14:58 ` J-P. Rosen
@ 2015-03-27 15:51 ` sbelmont700
2015-03-27 21:11 ` Simon Wright
1 sibling, 1 reply; 12+ messages in thread
From: sbelmont700 @ 2015-03-27 15:51 UTC (permalink / raw)
On Friday, March 27, 2015 at 10:18:51 AM UTC-4, Simon Wright wrote:
>
> I've worked out how to do it at elaboration now:
>
> The_Instance_Events : access Event_Queues.Vector :=
> new Event_Queues.Vector (Capacity => Capacity);
>
> (compiled but not yet executed - more challenges still to overcome!)
Don't forget the 2012 'bounded' vector, which I presume would be acceptable for your situation ("Bounded vector objects should be implemented without implicit pointers or dynamic allocation.")
-sb
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: access-to-classwide has non-static size?
2015-03-27 15:08 ` Egil H H
@ 2015-03-27 16:51 ` J-P. Rosen
0 siblings, 0 replies; 12+ messages in thread
From: J-P. Rosen @ 2015-03-27 16:51 UTC (permalink / raw)
Le 27/03/2015 16:08, Egil H H a écrit :
> On Friday, March 27, 2015 at 3:58:42 PM UTC+1, J-P. Rosen wrote:
>> but No_Implicit_Heap_Allocation is not part of Ravenscar.
>>
>
> According to the RM, it is:
> http://www.adaic.org/resources/add_content/standards/12rm/html/RM-D-13.html
>
Oops, I missed that one. Strange, since Ravenscar is supposed to address
only concurrency issues, and this one is not related to concurrency.
--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: access-to-classwide has non-static size?
2015-03-27 15:51 ` sbelmont700
@ 2015-03-27 21:11 ` Simon Wright
0 siblings, 0 replies; 12+ messages in thread
From: Simon Wright @ 2015-03-27 21:11 UTC (permalink / raw)
sbelmont700@gmail.com writes:
> On Friday, March 27, 2015 at 10:18:51 AM UTC-4, Simon Wright wrote:
>>
>> I've worked out how to do it at elaboration now:
>>
>> The_Instance_Events : access Event_Queues.Vector :=
>> new Event_Queues.Vector (Capacity => Capacity);
>>
>> (compiled but not yet executed - more challenges still to overcome!)
>
> Don't forget the 2012 'bounded' vector, which I presume would be
> acceptable for your situation ("Bounded vector objects should be
> implemented without implicit pointers or dynamic allocation.")
It is the 2012 bounded vector.
There are issues;
with Ada.Containers.Bounded_Vectors;
package V is new Ada.Containers.Bounded_Vectors
(Positive, Some_Access_Type);
is treated by GNAT GPL 2014 and FSF GCC 4.9.1 as if it violated
No_Implicit_Heap_Allocation (and in fact the generated code does indeed
call _gnat_malloc()). GCC 5.0.0 doesn't do this.
Still having similar problems with a big object with POs and tasks. You
would think that if the compiler was going to generate a .ali which says
the unit violates a restriction then it would also generate a warning
message, so I guess this is another example of the same bug as above -
or similar, anyway.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-03-27 21:11 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-27 8:26 access-to-classwide has non-static size? Simon Wright
2015-03-27 8:46 ` J-P. Rosen
2015-03-27 8:53 ` Simon Wright
2015-03-27 9:13 ` J-P. Rosen
2015-03-27 14:18 ` Simon Wright
2015-03-27 14:58 ` J-P. Rosen
2015-03-27 15:08 ` Egil H H
2015-03-27 16:51 ` J-P. Rosen
2015-03-27 15:51 ` sbelmont700
2015-03-27 21:11 ` Simon Wright
2015-03-27 8:49 ` Simon Wright
2015-03-27 8:53 ` Simon Wright
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox