Switch to the separate RS loading path.
This change goes with a similar change to libbcc that separates compilation
from loading. We create our own symbol resolvers in the driver.
Change-Id: Ifdeed588d5935c49a1e19bdc46d0a8f0b9252e00
diff --git a/cpu_ref/rsCpuScript.cpp b/cpu_ref/rsCpuScript.cpp
index 70c9d8f..01a3e5a 100644
--- a/cpu_ref/rsCpuScript.cpp
+++ b/cpu_ref/rsCpuScript.cpp
@@ -418,8 +418,11 @@
return false;
}
- mCompilerDriver->setRSRuntimeLookupFunction(lookupRuntimeStub);
- mCompilerDriver->setRSRuntimeLookupContext(this);
+ // Configure symbol resolvers (via compiler-rt and the RS runtime).
+ mRSRuntime.setLookupFunction(lookupRuntimeStub);
+ mRSRuntime.setContext(this);
+ mResolver.chainResolver(mCompilerRuntime);
+ mResolver.chainResolver(mRSRuntime);
// Run any compiler setup functions we have been provided with.
RSSetupCompilerCallback setupCompilerCallback =
@@ -471,8 +474,8 @@
// Skip the cache lookup
} else if (!is_force_recompile()) {
// Attempt to just load the script from cache first if we can.
- exec = mCompilerDriver->loadScript(cacheDir, resName,
- (const char *)bitcode, bitcodeSize);
+ exec = bcc::RSCompilerDriver::loadScript(cacheDir, resName,
+ (const char *)bitcode, bitcodeSize, mResolver);
}
if (exec == NULL) {
@@ -480,9 +483,8 @@
bitcodeSize, core_lib, useRSDebugContext,
bccPluginName);
if (built) {
- exec = mCompilerDriver->loadScript(cacheDir, resName,
- (const char *)bitcode,
- bitcodeSize);
+ exec = bcc::RSCompilerDriver::loadScript(cacheDir, resName,
+ (const char *)bitcode, bitcodeSize, mResolver);
}
}
diff --git a/cpu_ref/rsCpuScript.h b/cpu_ref/rsCpuScript.h
index 4cc9d6d..fded347 100644
--- a/cpu_ref/rsCpuScript.h
+++ b/cpu_ref/rsCpuScript.h
@@ -20,6 +20,11 @@
#include <rs_hal.h>
#include <rsRuntime.h>
+#ifndef RS_COMPATIBILITY_LIB
+#include <bcc/ExecutionEngine/CompilerRTSymbolResolver.h>
+#include <bcc/ExecutionEngine/SymbolResolverProxy.h>
+#endif
+
#include "rsCpuCore.h"
namespace bcc {
@@ -113,6 +118,9 @@
bcc::BCCContext *mCompilerContext;
bcc::RSCompilerDriver *mCompilerDriver;
+ bcc::CompilerRTSymbolResolver mCompilerRuntime;
+ bcc::LookupFunctionSymbolResolver<void *> mRSRuntime;
+ bcc::SymbolResolverProxy mResolver;
bcc::RSExecutable *mExecutable;
#else
void *mScriptSO;