PR libstdc++/79254 simplify exception-safety in copy assignment
[official-gcc.git] / libcilkrts / runtime / metacall_impl.h
blobd395c523570f8874afd4fddf12ab2e7a6e94b979
1 /* metacall_impl.h -*-C++-*-
3 *************************************************************************
5 * Copyright (C) 2010-2016, Intel Corporation
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
29 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
30 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
32 * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
35 * *********************************************************************
37 * PLEASE NOTE: This file is a downstream copy of a file mainitained in
38 * a repository at cilkplus.org. Changes made to this file that are not
39 * submitted through the contribution process detailed at
40 * http://www.cilkplus.org/submit-cilk-contribution will be lost the next
41 * time that a new version is released. Changes only submitted to the
42 * GNU compiler collection or posted to the git repository at
43 * https://bitbucket.org/intelcilkruntime/intel-cilk-runtime.git are
44 * not tracked.
46 * We welcome your contributions to this open source project. Thank you
47 * for your assistance in helping us improve Cilk Plus.
49 **************************************************************************/
51 /**
52 * @file metacall_impl.h
54 * @brief Meta-function calls to be used within the Cilk runtime system.
56 * These differ from the macros in cilkscreen.h and cilkview.h because they go
57 * through the __cilkrts_metacall interface, which ensures that the operation
58 * is performed even when instrumentation is disabled.
61 #ifndef INCLUDED_CILKRTS_METACALL_H
62 #define INCLUDED_CILKRTS_METACALL_H
64 #include "rts-common.h"
65 #include <internal/metacall.h>
66 #include <cilk/common.h>
68 __CILKRTS_BEGIN_EXTERN_C
70 /**
71 * This function is effectively an unconditional call from the runtime into
72 * a tool. It is used for operations that must be performed by the tool,
73 * even when the tool is not instrumenting. For example, Cilkscreen always
74 * recognizes the address of this function and performs the action specified
75 * in the contained metadata.
77 * Note that this function MUST NOT BE INLINED within the runtime. This must
78 * be the ONLY instance of the cilkscreen_metacall metadata.
80 CILK_API_VOID
81 __cilkrts_metacall(unsigned int tool, unsigned int code, void *data);
83 /**
84 * Return non-zero if running under Cilkscreen or Cilkview
86 COMMON_PORTABLE
87 int __cilkrts_running_under_sequential_ptool(void);
89 /**
90 * Disable Cilkscreen implementation
92 #define __cilkrts_cilkscreen_disable_instrumentation() \
93 __cilkrts_metacall(METACALL_TOOL_SYSTEM, HYPER_DISABLE_INSTRUMENTATION, 0)
95 /**
96 * Enable Cilkscreen implementation
98 #define __cilkrts_cilkscreen_enable_instrumentation() \
99 __cilkrts_metacall(METACALL_TOOL_SYSTEM, HYPER_ENABLE_INSTRUMENTATION, 0)
102 * Set the worker on entering runtime.
104 * @attention Deprecated in favor of __cilkrts_cilkscreen_ignore_block. The
105 * begin/enter pairs in the current metadata mean Cilkscreen no longer has to
106 * have improper knowledge of the __cilkrts_worker or __cilkrts_stack_frame
107 * structures.
109 #define __cilkrts_cilkscreen_establish_worker(w) \
110 __cilkrts_metacall(METACALL_TOOL_SYSTEM, HYPER_ESTABLISH_WORKER, w)
113 * Notify Cilkscreen of the extent of the stack.
115 * @param[in] begin Start (low address) of stack
116 * @param[in] end One past high address of stack
118 void __cilkrts_cilkscreen_establish_c_stack(char *begin, char *end);
121 * Tell tools to ignore a block of memory - currently the global state and
122 * memory allocated for workers.
124 #define __cilkrts_cilkscreen_ignore_block(_begin, _end) \
126 void *block[2] = {_begin, _end}; \
127 __cilkrts_metacall(METACALL_TOOL_SYSTEM, \
128 HYPER_IGNORE_MEMORY_BLOCK, \
129 block); \
132 __CILKRTS_END_EXTERN_C
134 #endif /* ! defined(INCLUDED_CILKRTS_METACALL_H) */