* de.po: Update.
[official-gcc.git] / libcilkrts / runtime / pedigrees.h
blob3f6ebb977f9f61d89df77f89ec81fd181674ce29
1 /* pedigrees.h -*-C++-*-
3 *************************************************************************
5 * @copyright
6 * Copyright (C) 2009-2013, Intel Corporation
7 * All rights reserved.
8 *
9 * @copyright
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * * Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in
18 * the documentation and/or other materials provided with the
19 * distribution.
20 * * Neither the name of Intel Corporation nor the names of its
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
24 * @copyright
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
32 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
33 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
35 * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 **************************************************************************/
39 #ifndef INCLUDED_PEDIGREES_DOT_H
40 #define INCLUDED_PEDIGREES_DOT_H
43 #include <cilk/common.h>
44 #include <internal/abi.h>
46 #include "rts-common.h"
47 #include "global_state.h"
48 #include "os.h"
50 __CILKRTS_BEGIN_EXTERN_C
52 /**
53 * @file pedigrees.h
55 * @brief pedigrees.h declares common routines related to pedigrees
56 * and the pedigree API.
60 /**
61 * @brief Sets the leaf pedigree node for the current user thread.
63 * A typical implementation stores this pedigree node in thread-local
64 * storage.
66 * Preconditions:
67 * - Current thread should be a user thread.
69 * @param leaf The pedigree node to store as a leaf.
71 COMMON_PORTABLE
72 void __cilkrts_set_pedigree_leaf(__cilkrts_pedigree* leaf);
75 /**
76 * Load the pedigree leaf node from thread-local storage into the
77 * current user worker. This method should execute as a part of
78 * binding the user thread to a worker.
80 * Preconditions:
82 * - w should be the worker for the current thread
83 * - w should be a user thread.
85 COMMON_PORTABLE
86 void load_pedigree_leaf_into_user_worker(__cilkrts_worker *w);
88 /**
89 * Save the pedigree leaf node from the worker into thread-local
90 * storage. This method should execute as part of unbinding a user
91 * thread from a worker.
93 * Preconditions:
95 * - w should be the worker for the current thread
96 * - w should be a user thread.
98 COMMON_PORTABLE
99 void save_pedigree_leaf_from_user_worker(__cilkrts_worker *w);
104 * Update pedigree for a worker when leaving a frame.
106 * If this is the frame of a spawn helper (indicated by the
107 * CILK_FRAME_DETACHED flag) we must update the pedigree. The
108 * pedigree points to nodes allocated on the stack. Failing to
109 * update it will result in a accvio/segfault if the pedigree is
110 * walked. This must happen for all spawn helper frames, even if
111 * we're processing an exception.
113 COMMON_PORTABLE
114 inline void update_pedigree_on_leave_frame(__cilkrts_worker *w,
115 __cilkrts_stack_frame *sf)
117 // Update the worker's pedigree information if this is an ABI 1 or later
118 // frame
119 if (CILK_FRAME_VERSION_VALUE(sf->flags) >= 1)
121 w->pedigree.rank = sf->spawn_helper_pedigree.rank + 1;
122 w->pedigree.parent = sf->spawn_helper_pedigree.parent;
128 __CILKRTS_END_EXTERN_C
130 #endif // ! defined(INCLUDED_PEDIGREES_DOT_H)