File : sem_ch9.ads


   1 ------------------------------------------------------------------------------
   2 --                                                                          --
   3 --                         GNAT COMPILER COMPONENTS                         --
   4 --                                                                          --
   5 --                              S E M _ C H 9                               --
   6 --                                                                          --
   7 --                                 S p e c                                  --
   8 --                                                                          --
   9 --          Copyright (C) 1992-2014, Free Software Foundation, Inc.         --
  10 --                                                                          --
  11 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  12 -- terms of the  GNU General Public License as published  by the Free Soft- --
  13 -- ware  Foundation;  either version 3,  or (at your option) any later ver- --
  14 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  16 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  17 -- for  more details.  You should have  received  a copy of the GNU General --
  18 -- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
  19 -- http://www.gnu.org/licenses for a complete copy of the license.          --
  20 --                                                                          --
  21 -- GNAT was originally developed  by the GNAT team at  New York University. --
  22 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
  23 --                                                                          --
  24 ------------------------------------------------------------------------------
  25 
  26 with Table;
  27 with Types; use Types;
  28 
  29 package Sem_Ch9  is
  30    procedure Analyze_Abort_Statement                    (N : Node_Id);
  31    procedure Analyze_Accept_Alternative                 (N : Node_Id);
  32    procedure Analyze_Accept_Statement                   (N : Node_Id);
  33    procedure Analyze_Asynchronous_Select                (N : Node_Id);
  34    procedure Analyze_Conditional_Entry_Call             (N : Node_Id);
  35    procedure Analyze_Delay_Alternative                  (N : Node_Id);
  36    procedure Analyze_Delay_Relative                     (N : Node_Id);
  37    procedure Analyze_Delay_Until                        (N : Node_Id);
  38    procedure Analyze_Entry_Body                         (N : Node_Id);
  39    procedure Analyze_Entry_Body_Formal_Part             (N : Node_Id);
  40    procedure Analyze_Entry_Call_Alternative             (N : Node_Id);
  41    procedure Analyze_Entry_Declaration                  (N : Node_Id);
  42    procedure Analyze_Entry_Index_Specification          (N : Node_Id);
  43    procedure Analyze_Protected_Body                     (N : Node_Id);
  44    procedure Analyze_Protected_Definition               (N : Node_Id);
  45    procedure Analyze_Protected_Type_Declaration         (N : Node_Id);
  46    procedure Analyze_Requeue                            (N : Node_Id);
  47    procedure Analyze_Selective_Accept                   (N : Node_Id);
  48    procedure Analyze_Single_Protected_Declaration       (N : Node_Id);
  49    procedure Analyze_Single_Task_Declaration            (N : Node_Id);
  50    procedure Analyze_Task_Body                          (N : Node_Id);
  51    procedure Analyze_Task_Definition                    (N : Node_Id);
  52    procedure Analyze_Task_Type_Declaration              (N : Node_Id);
  53    procedure Analyze_Terminate_Alternative              (N : Node_Id);
  54    procedure Analyze_Timed_Entry_Call                   (N : Node_Id);
  55    procedure Analyze_Triggering_Alternative             (N : Node_Id);
  56 
  57    procedure Install_Declarations (Spec : Entity_Id);
  58    --  Make visible in corresponding body the entities defined in a task,
  59    --  protected type declaration, or entry declaration.
  60 
  61    ------------------------------
  62    -- Lock Free Data Structure --
  63    ------------------------------
  64 
  65    --  A lock-free subprogram is a protected routine which references a unique
  66    --  protected scalar component and does not contain statements that cause
  67    --  side effects. Due to this restricted behavior, all references to shared
  68    --  data from within the subprogram can be synchronized through the use of
  69    --  atomic operations rather than relying on locks.
  70 
  71    type Lock_Free_Subprogram is record
  72       Sub_Body : Node_Id;
  73       --  Reference to the body of a protected subprogram which meets the lock-
  74       --  free requirements.
  75 
  76       Comp_Id : Entity_Id;
  77       --  Reference to the scalar component referenced from within Sub_Body
  78    end record;
  79 
  80    --  This table establishes a relation between a protected subprogram body
  81    --  and a unique component it references. The table is used when building
  82    --  the lock-free versions of a protected subprogram body.
  83 
  84    package Lock_Free_Subprogram_Table is new Table.Table (
  85      Table_Component_Type => Lock_Free_Subprogram,
  86      Table_Index_Type     => Nat,
  87      Table_Low_Bound      => 1,
  88      Table_Initial        => 5,
  89      Table_Increment      => 5,
  90      Table_Name           => "Lock_Free_Subprogram_Table");
  91 end Sem_Ch9;