OSDN Git Service

* parser.c (cp_parser_class_specifier): Set class location to that
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-stchop.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                 GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                 --
4 --                                                                          --
5 --     S Y S T E M . S T A C K _ C H E C K I N G . O P E R A T I O N S      --
6 --                                                                          --
7 --                                  S p e c                                 --
8 --                                                                          --
9 --          Copyright (C) 1999-2009, Free Software Foundation, Inc.         --
10 --                                                                          --
11 -- GNARL 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.                                     --
17 --                                                                          --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception,   --
20 -- version 3.1, as published by the Free Software Foundation.               --
21 --                                                                          --
22 -- You should have received a copy of the GNU General Public License and    --
23 -- a copy of the GCC Runtime Library Exception along with this program;     --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
25 -- <http://www.gnu.org/licenses/>.                                          --
26 --                                                                          --
27 -- GNARL was developed by the GNARL team at Florida State University.       --
28 -- Extensive contributions were provided by Ada Core Technologies, Inc.     --
29 --                                                                          --
30 ------------------------------------------------------------------------------
31
32 --  This package provides a implementation of stack checking operations using
33 --  comparison with stack base and limit.
34
35 pragma Restrictions (No_Elaboration_Code);
36 --  We want to guarantee the absence of elaboration code because the binder
37 --  does not handle references to this package.
38
39 pragma Polling (Off);
40 --  Turn off polling, we do not want polling to take place during stack
41 --  checking operations. It causes infinite loops and other problems.
42
43 with System.Storage_Elements;
44
45 package System.Stack_Checking.Operations is
46    pragma Preelaborate;
47
48    procedure Update_Stack_Cache (Stack : Stack_Access);
49    --  Set the stack cache for the current task. Note that this is only for
50    --  optimization purposes, nothing can be assumed about the contents of the
51    --  cache at any time, see Set_Stack_Info.
52    --
53    --  The stack cache should contain the bounds of the current task.  But
54    --  because the RTS is not aware of task switches, the stack cache may be
55    --  incorrect.  So when the stack pointer is not within the bounds of the
56    --  stack cache, Stack_Check first update the cache (which is a costly
57    --  operation hence the need of a cache).
58
59    procedure Invalidate_Stack_Cache (Any_Stack : Stack_Access);
60    --  Invalidate cache entries for the task T that owns Any_Stack. This causes
61    --  the Set_Stack_Info function to be called during the next stack check
62    --  done by T. This can be used to interrupt task T asynchronously.
63    --  Stack_Check should be called in loops for this to work reliably.
64
65    function Stack_Check (Stack_Address : System.Address) return Stack_Access;
66    --  This version of Stack_Check should not be inlined
67
68    procedure Notify_Stack_Attributes
69      (Initial_SP : System.Address;
70       Size       : System.Storage_Elements.Storage_Offset);
71    --  Register Initial_SP as the initial stack pointer value for the current
72    --  task when it starts and Size as the associated stack area size. This
73    --  should be called once, after the soft-links have been initialized and
74    --  prior to the first "Stack_Check" call.
75
76 private
77    Cache : aliased Stack_Access := Null_Stack;
78
79    pragma Export (C, Cache, "_gnat_stack_cache");
80    pragma Export (C, Stack_Check, "_gnat_stack_check");
81
82 end System.Stack_Checking.Operations;