Change the meaning of member Script::mObjectType.
Script::mObjectType is The type of the object behind this script
after compilation. For example, after returning from a successful
call to prepareRelocatable(), the value of mObjectType will be
ScriptObject::Relocatable.
Change-Id: I82ae2990772a9fb424150d3711e31f13acc521e6
diff --git a/lib/ExecutionEngine/Script.cpp b/lib/ExecutionEngine/Script.cpp
index 6e3774b..ac231b4 100644
--- a/lib/ExecutionEngine/Script.cpp
+++ b/lib/ExecutionEngine/Script.cpp
@@ -186,6 +186,7 @@
CompilerOption option;
option.RelocModelOpt = RelocModel;
option.LoadAfterCompile = false;
+
int status = internalCompile(option);
if (status != 0) {
ALOGE("LLVM error message: %s\n", getCompilerErrorMessage());
@@ -206,6 +207,8 @@
return false;
}
+ mObjectType = ScriptObject::Relocatable;
+
return 0;
}
@@ -229,10 +232,7 @@
int status = -1;
#if USE_CACHE
- if (internalLoadCache(cacheDir, cacheName,
- ScriptObject::Executable, /* checkOnly */ false) == 0) {
- status = 0;
- }
+ status = internalLoadCache(cacheDir, cacheName, /* checkOnly */ false);
#endif
if (status != 0) {
@@ -254,15 +254,14 @@
// FIXME: Registration can be conditional on the presence of debug metadata
registerObjectWithGDB(getELF(), getELFSize()); // thread-safe registration
+ mObjectType = ScriptObject::Executable;
+
return status;
}
#if USE_CACHE
int Script::internalLoadCache(char const *cacheDir, char const *cacheName,
- ScriptObject::ObjectType objectType,
bool checkOnly) {
- mObjectType = objectType;
-
if ((cacheDir == NULL) || (cacheName == NULL)) {
return 1;
}