blob: 889e00859db31463e8409defb6c1117966f81a76 [file] [log] [blame]
Jason Sams709a0972012-11-15 18:18:04 -08001/*
2 * Copyright (C) 2011-2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "rsContext.h"
18#include "rsScriptC.h"
19#include "rsMatrix4x4.h"
20#include "rsMatrix3x3.h"
21#include "rsMatrix2x2.h"
22#include "rsRuntime.h"
23
Jason Sams709a0972012-11-15 18:18:04 -080024#include "rsCpuCore.h"
25#include "rsCpuScript.h"
26
27#include <time.h>
28
Tim Murray0b575de2013-03-15 15:56:43 -070029#ifndef RS_SERVER
30#include "utils/Timers.h"
31#endif
32
Jason Sams709a0972012-11-15 18:18:04 -080033using namespace android;
34using namespace android::renderscript;
35
36typedef float float2 __attribute__((ext_vector_type(2)));
37typedef float float3 __attribute__((ext_vector_type(3)));
38typedef float float4 __attribute__((ext_vector_type(4)));
39typedef char char2 __attribute__((ext_vector_type(2)));
40typedef char char3 __attribute__((ext_vector_type(3)));
41typedef char char4 __attribute__((ext_vector_type(4)));
42typedef unsigned char uchar2 __attribute__((ext_vector_type(2)));
43typedef unsigned char uchar3 __attribute__((ext_vector_type(3)));
44typedef unsigned char uchar4 __attribute__((ext_vector_type(4)));
45typedef short short2 __attribute__((ext_vector_type(2)));
46typedef short short3 __attribute__((ext_vector_type(3)));
47typedef short short4 __attribute__((ext_vector_type(4)));
48typedef unsigned short ushort2 __attribute__((ext_vector_type(2)));
49typedef unsigned short ushort3 __attribute__((ext_vector_type(3)));
50typedef unsigned short ushort4 __attribute__((ext_vector_type(4)));
51typedef int32_t int2 __attribute__((ext_vector_type(2)));
52typedef int32_t int3 __attribute__((ext_vector_type(3)));
53typedef int32_t int4 __attribute__((ext_vector_type(4)));
54typedef uint32_t uint2 __attribute__((ext_vector_type(2)));
55typedef uint32_t uint3 __attribute__((ext_vector_type(3)));
56typedef uint32_t uint4 __attribute__((ext_vector_type(4)));
57typedef long long long2 __attribute__((ext_vector_type(2)));
58typedef long long long3 __attribute__((ext_vector_type(3)));
59typedef long long long4 __attribute__((ext_vector_type(4)));
60typedef unsigned long long ulong2 __attribute__((ext_vector_type(2)));
61typedef unsigned long long ulong3 __attribute__((ext_vector_type(3)));
62typedef unsigned long long ulong4 __attribute__((ext_vector_type(4)));
63
64
65//////////////////////////////////////////////////////////////////////////////
66// Message routines
67//////////////////////////////////////////////////////////////////////////////
68
69
Jason Sams709a0972012-11-15 18:18:04 -080070static void SC_debugF(const char *s, float f) {
Jason Sams941a6172013-04-03 11:28:45 -070071 ALOGD("float %s %f, 0x%08x", s, f, *((int *) (&f)));
Jason Sams709a0972012-11-15 18:18:04 -080072}
73static void SC_debugFv2(const char *s, float f1, float f2) {
Jason Sams941a6172013-04-03 11:28:45 -070074 ALOGD("float x2 %s {%f, %f}", s, f1, f2);
Jason Sams709a0972012-11-15 18:18:04 -080075}
76static void SC_debugFv3(const char *s, float f1, float f2, float f3) {
Jason Sams941a6172013-04-03 11:28:45 -070077 ALOGD("float x3 %s {%f, %f, %f}", s, f1, f2, f3);
Jason Sams709a0972012-11-15 18:18:04 -080078}
79static void SC_debugFv4(const char *s, float f1, float f2, float f3, float f4) {
Jason Sams941a6172013-04-03 11:28:45 -070080 ALOGD("float x4 %s {%f, %f, %f, %f}", s, f1, f2, f3, f4);
Jason Sams709a0972012-11-15 18:18:04 -080081}
Jason Sams941a6172013-04-03 11:28:45 -070082static void SC_debugF2(const char *s, const float2 *f) {
83 ALOGD("float2 %s {%f, %f}", s, f->x, f->y);
Jason Sams709a0972012-11-15 18:18:04 -080084}
Jason Sams941a6172013-04-03 11:28:45 -070085static void SC_debugF3(const char *s, const float3 *f) {
86 ALOGD("float3 %s {%f, %f, %f}", s, f->x, f->y, f->z);
Jason Sams709a0972012-11-15 18:18:04 -080087}
Jason Sams941a6172013-04-03 11:28:45 -070088static void SC_debugF4(const char *s, const float4 *f) {
89 ALOGD("float4 %s {%f, %f, %f, %f}", s, f->x, f->y, f->z, f->w);
Jason Sams709a0972012-11-15 18:18:04 -080090}
91static void SC_debugD(const char *s, double d) {
Jason Sams941a6172013-04-03 11:28:45 -070092 ALOGD("double %s %f, 0x%08llx", s, d, *((long long *) (&d)));
Jason Sams709a0972012-11-15 18:18:04 -080093}
94static void SC_debugFM4v4(const char *s, const float *f) {
Jason Sams941a6172013-04-03 11:28:45 -070095 ALOGD("matrix4x4 %s {%f, %f, %f, %f", s, f[0], f[4], f[8], f[12]);
96 ALOGD(" %s %f, %f, %f, %f", s, f[1], f[5], f[9], f[13]);
97 ALOGD(" %s %f, %f, %f, %f", s, f[2], f[6], f[10], f[14]);
98 ALOGD(" %s %f, %f, %f, %f}", s, f[3], f[7], f[11], f[15]);
Jason Sams709a0972012-11-15 18:18:04 -080099}
100static void SC_debugFM3v3(const char *s, const float *f) {
Jason Sams941a6172013-04-03 11:28:45 -0700101 ALOGD("matrix3x3 %s {%f, %f, %f", s, f[0], f[3], f[6]);
102 ALOGD(" %s %f, %f, %f", s, f[1], f[4], f[7]);
103 ALOGD(" %s %f, %f, %f}",s, f[2], f[5], f[8]);
Jason Sams709a0972012-11-15 18:18:04 -0800104}
105static void SC_debugFM2v2(const char *s, const float *f) {
Jason Sams941a6172013-04-03 11:28:45 -0700106 ALOGD("matrix2x2 %s {%f, %f", s, f[0], f[2]);
107 ALOGD(" %s %f, %f}",s, f[1], f[3]);
Jason Sams709a0972012-11-15 18:18:04 -0800108}
109static void SC_debugI8(const char *s, char c) {
Jason Sams941a6172013-04-03 11:28:45 -0700110 ALOGD("char %s %hhd 0x%hhx", s, c, (unsigned char)c);
Jason Sams709a0972012-11-15 18:18:04 -0800111}
Jason Sams941a6172013-04-03 11:28:45 -0700112static void SC_debugC2(const char *s, const char2 *c) {
113 ALOGD("char2 %s {%hhd, %hhd} 0x%hhx 0x%hhx", s, c->x, c->y, (unsigned char)c->x, (unsigned char)c->y);
Jason Sams709a0972012-11-15 18:18:04 -0800114}
Jason Sams941a6172013-04-03 11:28:45 -0700115static void SC_debugC3(const char *s, const char3 *c) {
116 ALOGD("char3 %s {%hhd, %hhd, %hhd} 0x%hhx 0x%hhx 0x%hhx", s, c->x, c->y, c->z, (unsigned char)c->x, (unsigned char)c->y, (unsigned char)c->z);
Jason Sams709a0972012-11-15 18:18:04 -0800117}
Jason Sams941a6172013-04-03 11:28:45 -0700118static void SC_debugC4(const char *s, const char4 *c) {
119 ALOGD("char4 %s {%hhd, %hhd, %hhd, %hhd} 0x%hhx 0x%hhx 0x%hhx 0x%hhx", s, c->x, c->y, c->z, c->w, (unsigned char)c->x, (unsigned char)c->y, (unsigned char)c->z, (unsigned char)c->w);
Jason Sams709a0972012-11-15 18:18:04 -0800120}
121static void SC_debugU8(const char *s, unsigned char c) {
Jason Sams941a6172013-04-03 11:28:45 -0700122 ALOGD("uchar %s %hhu 0x%hhx", s, c, c);
Jason Sams709a0972012-11-15 18:18:04 -0800123}
Jason Sams941a6172013-04-03 11:28:45 -0700124static void SC_debugUC2(const char *s, const uchar2 *c) {
125 ALOGD("uchar2 %s {%hhu, %hhu} 0x%hhx 0x%hhx", s, c->x, c->y, c->x, c->y);
Jason Sams709a0972012-11-15 18:18:04 -0800126}
Jason Sams941a6172013-04-03 11:28:45 -0700127static void SC_debugUC3(const char *s, const uchar3 *c) {
128 ALOGD("uchar3 %s {%hhu, %hhu, %hhu} 0x%hhx 0x%hhx 0x%hhx", s, c->x, c->y, c->z, c->x, c->y, c->z);
Jason Sams709a0972012-11-15 18:18:04 -0800129}
Jason Sams941a6172013-04-03 11:28:45 -0700130static void SC_debugUC4(const char *s, const uchar4 *c) {
131 ALOGD("uchar4 %s {%hhu, %hhu, %hhu, %hhu} 0x%hhx 0x%hhx 0x%hhx 0x%hhx", s, c->x, c->y, c->z, c->w, c->x, c->y, c->z, c->w);
Jason Sams709a0972012-11-15 18:18:04 -0800132}
133static void SC_debugI16(const char *s, short c) {
Jason Sams941a6172013-04-03 11:28:45 -0700134 ALOGD("short %s %hd 0x%hx", s, c, c);
Jason Sams709a0972012-11-15 18:18:04 -0800135}
Jason Sams941a6172013-04-03 11:28:45 -0700136static void SC_debugS2(const char *s, const short2 *c) {
137 ALOGD("short2 %s {%hd, %hd} 0x%hx 0x%hx", s, c->x, c->y, c->x, c->y);
Jason Sams709a0972012-11-15 18:18:04 -0800138}
Jason Sams941a6172013-04-03 11:28:45 -0700139static void SC_debugS3(const char *s, const short3 *c) {
140 ALOGD("short3 %s {%hd, %hd, %hd} 0x%hx 0x%hx 0x%hx", s, c->x, c->y, c->z, c->x, c->y, c->z);
Jason Sams709a0972012-11-15 18:18:04 -0800141}
Jason Sams941a6172013-04-03 11:28:45 -0700142static void SC_debugS4(const char *s, const short4 *c) {
143 ALOGD("short4 %s {%hd, %hd, %hd, %hd} 0x%hx 0x%hx 0x%hx 0x%hx", s, c->x, c->y, c->z, c->w, c->x, c->y, c->z, c->w);
Jason Sams709a0972012-11-15 18:18:04 -0800144}
145static void SC_debugU16(const char *s, unsigned short c) {
Jason Sams941a6172013-04-03 11:28:45 -0700146 ALOGD("ushort %s %hu 0x%hx", s, c, c);
Jason Sams709a0972012-11-15 18:18:04 -0800147}
Jason Sams941a6172013-04-03 11:28:45 -0700148static void SC_debugUS2(const char *s, const ushort2 *c) {
149 ALOGD("ushort2 %s {%hu, %hu} 0x%hx 0x%hx", s, c->x, c->y, c->x, c->y);
Jason Sams709a0972012-11-15 18:18:04 -0800150}
Jason Sams941a6172013-04-03 11:28:45 -0700151static void SC_debugUS3(const char *s, const ushort3 *c) {
152 ALOGD("ushort3 %s {%hu, %hu, %hu} 0x%hx 0x%hx 0x%hx", s, c->x, c->y, c->z, c->x, c->y, c->z);
Jason Sams709a0972012-11-15 18:18:04 -0800153}
Jason Sams941a6172013-04-03 11:28:45 -0700154static void SC_debugUS4(const char *s, const ushort4 *c) {
155 ALOGD("ushort4 %s {%hu, %hu, %hu, %hu} 0x%hx 0x%hx 0x%hx 0x%hx", s, c->x, c->y, c->z, c->w, c->x, c->y, c->z, c->w);
Jason Sams709a0972012-11-15 18:18:04 -0800156}
157static void SC_debugI32(const char *s, int32_t i) {
Jason Sams941a6172013-04-03 11:28:45 -0700158 ALOGD("int %s %d 0x%x", s, i, i);
Jason Sams709a0972012-11-15 18:18:04 -0800159}
Jason Sams941a6172013-04-03 11:28:45 -0700160static void SC_debugI2(const char *s, const int2 *i) {
161 ALOGD("int2 %s {%d, %d} 0x%x 0x%x", s, i->x, i->y, i->x, i->y);
Jason Sams709a0972012-11-15 18:18:04 -0800162}
Jason Sams941a6172013-04-03 11:28:45 -0700163static void SC_debugI3(const char *s, const int3 *i) {
164 ALOGD("int3 %s {%d, %d, %d} 0x%x 0x%x 0x%x", s, i->x, i->y, i->z, i->x, i->y, i->z);
Jason Sams709a0972012-11-15 18:18:04 -0800165}
Jason Sams941a6172013-04-03 11:28:45 -0700166static void SC_debugI4(const char *s, const int4 *i) {
167 ALOGD("int4 %s {%d, %d, %d, %d} 0x%x 0x%x 0x%x 0x%x", s, i->x, i->y, i->z, i->w, i->x, i->y, i->z, i->w);
Jason Sams709a0972012-11-15 18:18:04 -0800168}
169static void SC_debugU32(const char *s, uint32_t i) {
Jason Sams941a6172013-04-03 11:28:45 -0700170 ALOGD("uint %s %u 0x%x", s, i, i);
Jason Sams709a0972012-11-15 18:18:04 -0800171}
Jason Sams941a6172013-04-03 11:28:45 -0700172static void SC_debugUI2(const char *s, const uint2 *i) {
173 ALOGD("uint2 %s {%u, %u} 0x%x 0x%x", s, i->x, i->y, i->x, i->y);
Jason Sams709a0972012-11-15 18:18:04 -0800174}
Jason Sams941a6172013-04-03 11:28:45 -0700175static void SC_debugUI3(const char *s, const uint3 *i) {
176 ALOGD("uint3 %s {%u, %u, %u} 0x%x 0x%x 0x%x", s, i->x, i->y, i->z, i->x, i->y, i->z);
Jason Sams709a0972012-11-15 18:18:04 -0800177}
Jason Sams941a6172013-04-03 11:28:45 -0700178static void SC_debugUI4(const char *s, const uint4 *i) {
179 ALOGD("uint4 %s {%u, %u, %u, %u} 0x%x 0x%x 0x%x 0x%x", s, i->x, i->y, i->z, i->w, i->x, i->y, i->z, i->w);
Jason Sams709a0972012-11-15 18:18:04 -0800180}
181static void SC_debugLL64(const char *s, long long ll) {
Jason Sams941a6172013-04-03 11:28:45 -0700182 ALOGD("long %s %lld 0x%llx", s, ll, ll);
Jason Sams709a0972012-11-15 18:18:04 -0800183}
Jason Sams941a6172013-04-03 11:28:45 -0700184static void SC_debugL2(const char *s, const long2 *ll) {
185 ALOGD("long2 %s {%lld, %lld} 0x%llx 0x%llx", s, ll->x, ll->y, ll->x, ll->y);
Jason Sams709a0972012-11-15 18:18:04 -0800186}
Jason Sams941a6172013-04-03 11:28:45 -0700187static void SC_debugL3(const char *s, const long3 *ll) {
188 ALOGD("long3 %s {%lld, %lld, %lld} 0x%llx 0x%llx 0x%llx", s, ll->x, ll->y, ll->z, ll->x, ll->y, ll->z);
Jason Sams709a0972012-11-15 18:18:04 -0800189}
Jason Sams941a6172013-04-03 11:28:45 -0700190static void SC_debugL4(const char *s, const long4 *ll) {
191 ALOGD("long4 %s {%lld, %lld, %lld, %lld} 0x%llx 0x%llx 0x%llx 0x%llx", s, ll->x, ll->y, ll->z, ll->w, ll->x, ll->y, ll->z, ll->w);
Jason Sams709a0972012-11-15 18:18:04 -0800192}
193static void SC_debugULL64(const char *s, unsigned long long ll) {
Jason Sams941a6172013-04-03 11:28:45 -0700194 ALOGD("ulong %s %llu 0x%llx", s, ll, ll);
Jason Sams709a0972012-11-15 18:18:04 -0800195}
Jason Sams941a6172013-04-03 11:28:45 -0700196static void SC_debugUL2(const char *s, const ulong2 *ll) {
197 ALOGD("ulong2 %s {%llu, %llu} 0x%llx 0x%llx", s, ll->x, ll->y, ll->x, ll->y);
Jason Sams709a0972012-11-15 18:18:04 -0800198}
Jason Sams941a6172013-04-03 11:28:45 -0700199static void SC_debugUL3(const char *s, const ulong3 *ll) {
200 ALOGD("ulong3 %s {%llu, %llu, %llu} 0x%llx 0x%llx 0x%llx", s, ll->x, ll->y, ll->z, ll->x, ll->y, ll->z);
Jason Sams709a0972012-11-15 18:18:04 -0800201}
Jason Sams941a6172013-04-03 11:28:45 -0700202static void SC_debugUL4(const char *s, const ulong4 *ll) {
203 ALOGD("ulong4 %s {%llu, %llu, %llu, %llu} 0x%llx 0x%llx 0x%llx 0x%llx", s, ll->x, ll->y, ll->z, ll->w, ll->x, ll->y, ll->z, ll->w);
Jason Sams709a0972012-11-15 18:18:04 -0800204}
205static void SC_debugP(const char *s, const void *p) {
Jason Sams941a6172013-04-03 11:28:45 -0700206 ALOGD("void * %s %p", s, p);
Jason Sams709a0972012-11-15 18:18:04 -0800207}
208
209
210//////////////////////////////////////////////////////////////////////////////
211// Stub implementation
212//////////////////////////////////////////////////////////////////////////////
213
214// llvm name mangling ref
215// <builtin-type> ::= v # void
216// ::= b # bool
217// ::= c # char
218// ::= a # signed char
219// ::= h # unsigned char
220// ::= s # short
221// ::= t # unsigned short
222// ::= i # int
223// ::= j # unsigned int
224// ::= l # long
225// ::= m # unsigned long
226// ::= x # long long, __int64
227// ::= y # unsigned long long, __int64
228// ::= f # float
229// ::= d # double
230
231static RsdCpuReference::CpuSymbol gSyms[] = {
232 { "memset", (void *)&memset, true },
233 { "memcpy", (void *)&memcpy, true },
234
235 // Debug
236 { "_Z7rsDebugPKcf", (void *)&SC_debugF, true },
237 { "_Z7rsDebugPKcff", (void *)&SC_debugFv2, true },
238 { "_Z7rsDebugPKcfff", (void *)&SC_debugFv3, true },
239 { "_Z7rsDebugPKcffff", (void *)&SC_debugFv4, true },
Jason Sams941a6172013-04-03 11:28:45 -0700240 { "_Z7rsDebugPKcPKDv2_f", (void *)&SC_debugF2, true },
241 { "_Z7rsDebugPKcPKDv3_f", (void *)&SC_debugF3, true },
242 { "_Z7rsDebugPKcPKDv4_f", (void *)&SC_debugF4, true },
Jason Sams709a0972012-11-15 18:18:04 -0800243 { "_Z7rsDebugPKcd", (void *)&SC_debugD, true },
244 { "_Z7rsDebugPKcPK12rs_matrix4x4", (void *)&SC_debugFM4v4, true },
245 { "_Z7rsDebugPKcPK12rs_matrix3x3", (void *)&SC_debugFM3v3, true },
246 { "_Z7rsDebugPKcPK12rs_matrix2x2", (void *)&SC_debugFM2v2, true },
247 { "_Z7rsDebugPKcc", (void *)&SC_debugI8, true },
Jason Sams941a6172013-04-03 11:28:45 -0700248 { "_Z7rsDebugPKcPKDv2_c", (void *)&SC_debugC2, true },
249 { "_Z7rsDebugPKcPKDv3_c", (void *)&SC_debugC3, true },
250 { "_Z7rsDebugPKcPKDv4_c", (void *)&SC_debugC4, true },
Jason Sams709a0972012-11-15 18:18:04 -0800251 { "_Z7rsDebugPKch", (void *)&SC_debugU8, true },
Jason Sams941a6172013-04-03 11:28:45 -0700252 { "_Z7rsDebugPKcPKDv2_h", (void *)&SC_debugUC2, true },
253 { "_Z7rsDebugPKcPKDv3_h", (void *)&SC_debugUC3, true },
254 { "_Z7rsDebugPKcPKDv4_h", (void *)&SC_debugUC4, true },
Jason Sams709a0972012-11-15 18:18:04 -0800255 { "_Z7rsDebugPKcs", (void *)&SC_debugI16, true },
Jason Sams941a6172013-04-03 11:28:45 -0700256 { "_Z7rsDebugPKcPKDv2_s", (void *)&SC_debugS2, true },
257 { "_Z7rsDebugPKcPKDv3_s", (void *)&SC_debugS3, true },
258 { "_Z7rsDebugPKcPKDv4_s", (void *)&SC_debugS4, true },
Jason Sams709a0972012-11-15 18:18:04 -0800259 { "_Z7rsDebugPKct", (void *)&SC_debugU16, true },
Jason Sams941a6172013-04-03 11:28:45 -0700260 { "_Z7rsDebugPKcPKDv2_t", (void *)&SC_debugUS2, true },
261 { "_Z7rsDebugPKcPKDv3_t", (void *)&SC_debugUS3, true },
262 { "_Z7rsDebugPKcPKDv4_t", (void *)&SC_debugUS4, true },
Jason Sams709a0972012-11-15 18:18:04 -0800263 { "_Z7rsDebugPKci", (void *)&SC_debugI32, true },
Jason Sams941a6172013-04-03 11:28:45 -0700264 { "_Z7rsDebugPKcPKDv2_i", (void *)&SC_debugI2, true },
265 { "_Z7rsDebugPKcPKDv3_i", (void *)&SC_debugI3, true },
266 { "_Z7rsDebugPKcPKDv4_i", (void *)&SC_debugI4, true },
Jason Sams709a0972012-11-15 18:18:04 -0800267 { "_Z7rsDebugPKcj", (void *)&SC_debugU32, true },
Jason Sams941a6172013-04-03 11:28:45 -0700268 { "_Z7rsDebugPKcPKDv2_j", (void *)&SC_debugUI2, true },
269 { "_Z7rsDebugPKcPKDv3_j", (void *)&SC_debugUI3, true },
270 { "_Z7rsDebugPKcPKDv4_j", (void *)&SC_debugUI4, true },
Jason Sams709a0972012-11-15 18:18:04 -0800271 // Both "long" and "unsigned long" need to be redirected to their
272 // 64-bit counterparts, since we have hacked Slang to use 64-bit
273 // for "long" on Arm (to be similar to Java).
274 { "_Z7rsDebugPKcl", (void *)&SC_debugLL64, true },
Jason Sams941a6172013-04-03 11:28:45 -0700275 { "_Z7rsDebugPKcPKDv2_l", (void *)&SC_debugL2, true },
276 { "_Z7rsDebugPKcPKDv3_l", (void *)&SC_debugL3, true },
277 { "_Z7rsDebugPKcPKDv4_l", (void *)&SC_debugL4, true },
Jason Sams709a0972012-11-15 18:18:04 -0800278 { "_Z7rsDebugPKcm", (void *)&SC_debugULL64, true },
Jason Sams941a6172013-04-03 11:28:45 -0700279 { "_Z7rsDebugPKcPKDv2_m", (void *)&SC_debugUL2, true },
280 { "_Z7rsDebugPKcPKDv3_m", (void *)&SC_debugUL3, true },
281 { "_Z7rsDebugPKcPKDv4_m", (void *)&SC_debugUL4, true },
Jason Sams709a0972012-11-15 18:18:04 -0800282 { "_Z7rsDebugPKcx", (void *)&SC_debugLL64, true },
Jason Sams941a6172013-04-03 11:28:45 -0700283 { "_Z7rsDebugPKcPKDv2_x", (void *)&SC_debugL2, true },
284 { "_Z7rsDebugPKcPKDv3_x", (void *)&SC_debugL3, true },
285 { "_Z7rsDebugPKcPKDv4_x", (void *)&SC_debugL4, true },
Jason Sams709a0972012-11-15 18:18:04 -0800286 { "_Z7rsDebugPKcy", (void *)&SC_debugULL64, true },
Jason Sams941a6172013-04-03 11:28:45 -0700287 { "_Z7rsDebugPKcPKDv2_y", (void *)&SC_debugUL2, true },
288 { "_Z7rsDebugPKcPKDv3_y", (void *)&SC_debugUL3, true },
289 { "_Z7rsDebugPKcPKDv4_y", (void *)&SC_debugUL4, true },
Jason Sams709a0972012-11-15 18:18:04 -0800290 { "_Z7rsDebugPKcPKv", (void *)&SC_debugP, true },
291
292 { NULL, NULL, false }
293};
294
295
296void * RsdCpuScriptImpl::lookupRuntimeStub(void* pContext, char const* name) {
297 RsdCpuScriptImpl *s = (RsdCpuScriptImpl *)pContext;
298 const RsdCpuReference::CpuSymbol *syms = gSyms;
299 const RsdCpuReference::CpuSymbol *sym = NULL;
300
301 sym = s->mCtx->symLookup(name);
302 if (!sym) {
303 sym = s->lookupSymbolMath(name);
304 }
305 if (!sym) {
306 while (syms->fnPtr) {
307 if (!strcmp(syms->name, name)) {
308 sym = syms;
309 }
310 syms++;
311 }
312 }
313
314 if (sym) {
315 s->mIsThreadable &= sym->threadable;
316 return sym->fnPtr;
317 }
318 ALOGE("ScriptC sym lookup failed for %s", name);
319 return NULL;
320}
321
322