summaryrefslogtreecommitdiff
path: root/cpu_ref
diff options
context:
space:
mode:
authorDavid Gross <dgross@google.com>2017-04-19 16:41:30 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-04-19 16:41:31 +0000
commit8e9f4c9bae60ddfb26d25d2d11a5ac5f7c63d606 (patch)
tree3d660099279659fcc73940d4228d2ca5f2d4af6d /cpu_ref
parent0919e8578e4f4bd0a7d48fb719b88a8b98a29aa9 (diff)
parent6e64e51a6a252bd88acfa72dac8372c863f524e0 (diff)
downloadrs-8e9f4c9bae60ddfb26d25d2d11a5ac5f7c63d606.tar.gz
Merge "[debugger] make the ScriptGroup inspection point weak"
Diffstat (limited to 'cpu_ref')
-rw-r--r--cpu_ref/rsCpuScriptGroup2.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/cpu_ref/rsCpuScriptGroup2.cpp b/cpu_ref/rsCpuScriptGroup2.cpp
index e42efe18..11393ff4 100644
--- a/cpu_ref/rsCpuScriptGroup2.cpp
+++ b/cpu_ref/rsCpuScriptGroup2.cpp
@@ -330,7 +330,22 @@ void generateSourceSlot(RsdCpuReferenceImpl* ctxt,
} // anonymous namespace
-extern __attribute__((noinline))
+// This function is used by the debugger to inspect ScriptGroup
+// compilations.
+//
+// "__attribute__((noinline))" and "__asm__" are used to prevent the
+// function call from being eliminated as a no-op (see the "noinline"
+// attribute in gcc documentation).
+//
+// "__attribute__((weak))" is used to prevent callers from recognizing
+// that this is guaranteed to be the function definition, recognizing
+// that certain arguments are unused, and optimizing away the passing
+// of those arguments (see the LLVM optimization
+// DeadArgumentElimination). Theoretically, the compiler could get
+// aggressive enough with link-time optimization that even marking the
+// entry point as a weak definition wouldn't solve the problem.
+//
+extern __attribute__((noinline)) __attribute__((weak))
void debugHintScriptGroup2(const char* groupName,
const uint32_t groupNameSize,
const ExpandFuncTy* kernel,
@@ -338,6 +353,7 @@ void debugHintScriptGroup2(const char* groupName,
ALOGV("group name: %d:%s\n", groupNameSize, groupName);
for (uint32_t i=0; i < kernelCount; ++i) {
const char* f1 = (const char*)(kernel[i]);
+ __asm__ __volatile__("");
ALOGV(" closure: %p\n", (const void*)f1);
}
// do nothing, this is just a hook point for the debugger.