public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "simon at pushface dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug ada/50934] Allocated address for new controlled object is offset by 16 bytes Date: Wed, 02 Nov 2011 20:58:00 -0000 [thread overview] Message-ID: <bug-50934-4-SG2LW9cb1v@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-50934-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50934 --- Comment #1 from simon at pushface dot org 2011-11-02 20:58:09 UTC --- I've now traced the reason for this. Controlled objects require some memory to be allocated to manage the chains of objects which are to be finalised when a scope is exited (this may not be strictly accurate, but is probably close enough for this PR). It used to be the case that System.Finalization_Root.Root_Controlled contained the necessary 2 pointers. At r177275 this was changed so that System.Finalization_Root.Root_Controlled is a null record; instead, System.Storage_Pools.Subpools.Allocate_Any_Controlled adds the necessary space to the allocated size and adjusts the returned pointer, to support Ada.Finalization.Heap_Managenent: Ada.Finalization.Heap_Management provides key functionality associated with controlled objects on the heap, their creation, finalization and reclamation. Type Finalization_Collection is effectively a wrapper which sits ontop of a storage pool and performs all necessary bookkeeping for all the objects it contains. Each access-to-controlled or access-to-class-wide type receives a collection as part of its expansion. The compiler generates buffer code and invokes Allocate / Deallocate to create and destroy allocated controlled objects. The trouble is that this means that the attribute Max_Size_In_Storage_Elements is now *wrong* for any controlled object. It seems to me that this new approach is a remarkably non-Ada way of addressing the problem; the original design is precisely the way that it should be addressed. Of course I have absolutely no objection to delegating this management to Ada.Finalization.Heap_Management (I think this should now in fact be System.Finalization_Masters). But System.Finalization_Root.Root_Controlled should contain a System.Finalization_Masters.FM_Node.
next prev parent reply other threads:[~2011-11-02 20:58 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-10-31 15:24 [Bug ada/50934] New: " simon at pushface dot org 2011-11-02 20:58 ` simon at pushface dot org [this message] 2011-11-02 21:03 ` [Bug ada/50934] Attribute Max_Size_In_Storage_Elements is wrong for controlled types simon at pushface dot org 2011-11-03 8:14 ` simon at pushface dot org 2011-11-03 17:34 ` simon at pushface dot org 2012-05-27 11:00 ` simon at pushface dot org 2012-05-27 11:20 ` ebotcazou at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-50934-4-SG2LW9cb1v@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).