PageRenderTime 45ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/cilkrtssuspend/runtime/metacall_impl.h

https://gitlab.com/wustl-pctg-pub/porridge
C Header | 134 lines | 26 code | 13 blank | 95 comment | 0 complexity | 902ad7c2f3ff1a3e1c3dae98e1c4a9dd MD5 | raw file
  1. /* metacall_impl.h -*-C++-*-
  2. *
  3. *************************************************************************
  4. *
  5. * Copyright (C) 2010-2015, 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:
  11. *
  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.
  21. *
  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.
  34. *
  35. * *********************************************************************
  36. *
  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/intelcilkplusruntime/itnel-cilk-runtime.git are
  44. * not tracked.
  45. *
  46. * We welcome your contributions to this open source project. Thank you
  47. * for your assistance in helping us improve Cilk Plus.
  48. *
  49. **************************************************************************/
  50. /**
  51. * @file metacall_impl.h
  52. *
  53. * @brief Meta-function calls to be used within the Cilk runtime system.
  54. *
  55. * These differ from the macros in cilkscreen.h and cilkview.h because they go
  56. * through the __cilkrts_metacall interface, which ensures that the operation
  57. * is performed even when instrumentation is disabled.
  58. */
  59. #ifndef INCLUDED_CILKRTS_METACALL_H
  60. #define INCLUDED_CILKRTS_METACALL_H
  61. #include "rts-common.h"
  62. #include <internal/metacall.h>
  63. #include <cilk/common.h>
  64. __CILKRTS_BEGIN_EXTERN_C
  65. /**
  66. * This function is effectively an unconditional call from the runtime into
  67. * a tool. It is used for operations that must be performed by the tool,
  68. * even when the tool is not instrumenting. For example, Cilkscreen always
  69. * recognizes the address of this function and performs the action specified
  70. * in the contained metadata.
  71. *
  72. * Note that this function MUST NOT BE INLINED within the runtime. This must
  73. * be the ONLY instance of the cilkscreen_metacall metadata.
  74. */
  75. CILK_API_VOID
  76. __cilkrts_metacall(unsigned int tool, unsigned int code, void *data);
  77. /**
  78. * Return non-zero if running under Cilkscreen or Cilkview
  79. */
  80. COMMON_PORTABLE
  81. int __cilkrts_running_under_sequential_ptool(void);
  82. /**
  83. * Disable Cilkscreen implementation
  84. */
  85. #define __cilkrts_cilkscreen_disable_instrumentation() \
  86. __cilkrts_metacall(METACALL_TOOL_SYSTEM, HYPER_DISABLE_INSTRUMENTATION, 0)
  87. /**
  88. * Enable Cilkscreen implementation
  89. */
  90. #define __cilkrts_cilkscreen_enable_instrumentation() \
  91. __cilkrts_metacall(METACALL_TOOL_SYSTEM, HYPER_ENABLE_INSTRUMENTATION, 0)
  92. /**
  93. * Set the worker on entering runtime.
  94. *
  95. * @attention Deprecated in favor of __cilkrts_cilkscreen_ignore_block. The
  96. * begin/enter pairs in the current metadata mean Cilkscreen no longer has to
  97. * have improper knowledge of the __cilkrts_worker or __cilkrts_stack_frame
  98. * structures.
  99. */
  100. #define __cilkrts_cilkscreen_establish_worker(w) \
  101. __cilkrts_metacall(METACALL_TOOL_SYSTEM, HYPER_ESTABLISH_WORKER, w)
  102. /**
  103. * Notify Cilkscreen of the extent of the stack.
  104. *
  105. * @param[in] begin Start (low address) of stack
  106. * @param[in] end One past high address of stack
  107. */
  108. void __cilkrts_cilkscreen_establish_c_stack(char *begin, char *end);
  109. /**
  110. * Tell tools to ignore a block of memory - currently the global state and
  111. * memory allocated for workers.
  112. */
  113. #define __cilkrts_cilkscreen_ignore_block(_begin, _end) \
  114. { \
  115. void *block[2] = {_begin, _end}; \
  116. __cilkrts_metacall(METACALL_TOOL_SYSTEM, \
  117. HYPER_IGNORE_MEMORY_BLOCK, \
  118. block); \
  119. }
  120. __CILKRTS_END_EXTERN_C
  121. #endif /* ! defined(INCLUDED_CILKRTS_METACALL_H) */