Remove USE_CACHE support, since we only need MC support.
BUG=6051742
This change also removes the legacy bcc_cache.h header by moving any relevant
defines still there to bcc_mccache.h. These types/values are now renamed to
generally use "MCO" instead of "OBCC".
Change-Id: I6c611bd296c0335cacd82025933f36eb55bff72f
diff --git a/README.html b/README.html
index 0b8b447..447312a 100644
--- a/README.html
+++ b/README.html
@@ -419,24 +419,24 @@
table, and bcc context. Every section should be aligned to a word size.
Here is the brief description of each sections:</p>
<ul class="simple">
-<li><strong>Header</strong> (OBCC_Header) - The header of a cache file. It contains the
+<li><strong>Header</strong> (MCO_Header) - The header of a cache file. It contains the
magic word, version, machine integer type information (the endianness,
the size of off_t, size_t, and ptr_t), and the size
and offset of other sections. The header section is guaranteed
to be at the beginning of the cache file.</li>
-<li><strong>String Pool</strong> (OBCC_StringPool) - A collection of serialized variable
+<li><strong>String Pool</strong> (MCO_StringPool) - A collection of serialized variable
length strings. The strp_index in the other part of the cache file
represents the index of such string in this string pool.</li>
-<li><strong>Dependencies Table</strong> (OBCC_DependencyTable) - The dependencies table.
+<li><strong>Dependencies Table</strong> (MCO_DependencyTable) - The dependencies table.
This table stores the resource name (or file path), the resource
type (rather in APK or on the file system), and the SHA1 checksum.</li>
-<li><strong>Relocation Table</strong> (OBCC_RelocationTable) - <em>not enabled</em></li>
-<li><strong>Exported Variable List</strong> (OBCC_ExportVarList) -
+<li><strong>Relocation Table</strong> (MCO_RelocationTable) - <em>not enabled</em></li>
+<li><strong>Exported Variable List</strong> (MCO_ExportVarList) -
The list of the addresses of exported variables.</li>
-<li><strong>Exported Function List</strong> (OBCC_ExportFuncList) -
+<li><strong>Exported Function List</strong> (MCO_ExportFuncList) -
The list of the addresses of exported functions.</li>
-<li><strong>Pragma List</strong> (OBCC_PragmaList) - The list of pragma key-value pair.</li>
-<li><strong>Function Information Table</strong> (OBCC_FuncTable) - This is a table of
+<li><strong>Pragma List</strong> (MCO_PragmaList) - The list of pragma key-value pair.</li>
+<li><strong>Function Information Table</strong> (MCO_FuncTable) - This is a table of
function information, such as function name, function entry address,
and function binary size. Besides, the table should be ordered by
function name.</li>
diff --git a/README.rst b/README.rst
index cf40138..97070c0 100644
--- a/README.rst
+++ b/README.rst
@@ -138,31 +138,31 @@
table, and bcc context. Every section should be aligned to a word size.
Here is the brief description of each sections:
-* **Header** (OBCC_Header) - The header of a cache file. It contains the
+* **Header** (MCO_Header) - The header of a cache file. It contains the
magic word, version, machine integer type information (the endianness,
the size of off_t, size_t, and ptr_t), and the size
and offset of other sections. The header section is guaranteed
to be at the beginning of the cache file.
-* **String Pool** (OBCC_StringPool) - A collection of serialized variable
+* **String Pool** (MCO_StringPool) - A collection of serialized variable
length strings. The strp_index in the other part of the cache file
represents the index of such string in this string pool.
-* **Dependencies Table** (OBCC_DependencyTable) - The dependencies table.
+* **Dependencies Table** (MCO_DependencyTable) - The dependencies table.
This table stores the resource name (or file path), the resource
type (rather in APK or on the file system), and the SHA1 checksum.
-* **Relocation Table** (OBCC_RelocationTable) - *not enabled*
+* **Relocation Table** (MCO_RelocationTable) - *not enabled*
-* **Exported Variable List** (OBCC_ExportVarList) -
+* **Exported Variable List** (MCO_ExportVarList) -
The list of the addresses of exported variables.
-* **Exported Function List** (OBCC_ExportFuncList) -
+* **Exported Function List** (MCO_ExportFuncList) -
The list of the addresses of exported functions.
-* **Pragma List** (OBCC_PragmaList) - The list of pragma key-value pair.
+* **Pragma List** (MCO_PragmaList) - The list of pragma key-value pair.
-* **Function Information Table** (OBCC_FuncTable) - This is a table of
+* **Function Information Table** (MCO_FuncTable) - This is a table of
function information, such as function name, function entry address,
and function binary size. Besides, the table should be ordered by
function name.
diff --git a/include/bcc/bcc_cache.h b/include/bcc/bcc_cache.h
deleted file mode 100644
index 6809cce..0000000
--- a/include/bcc/bcc_cache.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright 2010-2012, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef BCC_CACHE_H
-#define BCC_CACHE_H
-
-#include <stdint.h>
-#include <sys/types.h>
-
-/* BCC Cache File Magic Word */
-#define OBCC_MAGIC "\0bcc"
-
-/* BCC Cache File Version, encoded in 4 bytes of ASCII */
-#define OBCC_VERSION "001\0"
-
-/* BCC Cache Header Structure */
-struct OBCC_Header {
- /* magic and version */
- uint8_t magic[4];
- uint8_t version[4];
-
- /* machine-dependent integer type size */
- uint8_t endianness;
- uint8_t sizeof_off_t;
- uint8_t sizeof_size_t;
- uint8_t sizeof_ptr_t;
-
- /* string pool section */
- off_t str_pool_offset;
- size_t str_pool_size;
-
- /* dependancy table */
- off_t depend_tab_offset;
- size_t depend_tab_size;
-
- /* relocation table section */
- off_t reloc_tab_offset;
- size_t reloc_tab_size;
-
- /* export variable list section */
- off_t export_var_list_offset;
- size_t export_var_list_size;
-
- /* export function list section */
- off_t export_func_list_offset;
- size_t export_func_list_size;
-
- /* pragma list section */
- off_t pragma_list_offset;
- size_t pragma_list_size;
-
- /* function table */
- off_t func_table_offset;
- size_t func_table_size;
-
- /* function table */
- off_t object_slot_list_offset;
- size_t object_slot_list_size;
-
- /* context section */
- char *context_cached_addr;
- uint32_t context_parity_checksum;
-
- /* dirty hack for libRS */
- /* TODO: This should be removed in the future */
- uint32_t libRS_threadable;
-
- /* export foreach list section */
- off_t export_foreach_list_offset;
- size_t export_foreach_list_size;
-};
-
-struct OBCC_String {
- size_t length; /* String length, without ending '\0' */
- off_t offset; /* Note: Offset related to string_pool_offset. */
-};
-
-struct OBCC_StringPool {
- size_t count;
- struct OBCC_String list[];
-};
-
-enum OBCC_ResourceType {
- BCC_APK_RESOURCE = 0,
- BCC_FILE_RESOURCE = 1,
-};
-
-struct OBCC_Dependency {
- size_t res_name_strp_index;
- uint32_t res_type; /* BCC_APK_RESOURCE or BCC_FILE_RESOURCE */
- unsigned char sha1[20];
-};
-
-struct OBCC_DependencyTable {
- size_t count;
- struct OBCC_Dependency table[];
-};
-
-struct OBCC_RelocationTable {
-/* TODO: Implement relocation table. */
-};
-
-struct OBCC_ExportVarList {
- size_t count;
- void *cached_addr_list[];
-};
-
-struct OBCC_ExportFuncList {
- size_t count;
- void *cached_addr_list[];
-};
-
-struct OBCC_ExportForEachList {
- size_t count;
- void *cached_addr_list[];
-};
-
-struct OBCC_Pragma {
- size_t key_strp_index;
- size_t value_strp_index;
-};
-
-struct OBCC_PragmaList {
- size_t count;
- struct OBCC_Pragma list[];
-};
-
-struct OBCC_ObjectSlotList {
- size_t count;
- uint32_t object_slot_list[];
-};
-
-struct OBCC_FuncInfo {
- size_t name_strp_index;
- void *cached_addr;
- size_t size;
-};
-
-struct OBCC_FuncTable {
- size_t count;
- struct OBCC_FuncInfo table[];
-};
-
-struct OBCC_String_Ptr {
- size_t count;
- size_t strp_indexs[];
-};
-
-
-#endif /* BCC_CACHE_H */
diff --git a/include/bcc/bcc_mccache.h b/include/bcc/bcc_mccache.h
index 292165d..a214831 100644
--- a/include/bcc/bcc_mccache.h
+++ b/include/bcc/bcc_mccache.h
@@ -20,8 +20,6 @@
#include <stdint.h>
#include <sys/types.h>
-#include "bcc_cache.h"
-
/* BCC Cache File Magic Word */
#define MCO_MAGIC "\0bcc"
@@ -81,5 +79,77 @@
size_t export_foreach_name_list_size;
};
+struct MCO_String {
+ size_t length; /* String length, without ending '\0' */
+ off_t offset; /* Note: Offset related to string_pool_offset. */
+};
+
+struct MCO_StringPool {
+ size_t count;
+ struct MCO_String list[];
+};
+
+enum MCO_ResourceType {
+ BCC_APK_RESOURCE = 0,
+ BCC_FILE_RESOURCE = 1,
+};
+
+struct MCO_Dependency {
+ size_t res_name_strp_index;
+ uint32_t res_type; /* BCC_APK_RESOURCE or BCC_FILE_RESOURCE */
+ unsigned char sha1[20];
+};
+
+struct MCO_DependencyTable {
+ size_t count;
+ struct MCO_Dependency table[];
+};
+
+struct MCO_ExportVarList {
+ size_t count;
+ void *cached_addr_list[];
+};
+
+struct MCO_ExportFuncList {
+ size_t count;
+ void *cached_addr_list[];
+};
+
+struct MCO_ExportForEachList {
+ size_t count;
+ void *cached_addr_list[];
+};
+
+struct MCO_Pragma {
+ size_t key_strp_index;
+ size_t value_strp_index;
+};
+
+struct MCO_PragmaList {
+ size_t count;
+ struct MCO_Pragma list[];
+};
+
+struct MCO_ObjectSlotList {
+ size_t count;
+ uint32_t object_slot_list[];
+};
+
+struct MCO_FuncInfo {
+ size_t name_strp_index;
+ void *cached_addr;
+ size_t size;
+};
+
+struct MCO_FuncTable {
+ size_t count;
+ struct MCO_FuncInfo table[];
+};
+
+struct MCO_String_Ptr {
+ size_t count;
+ size_t strp_indexs[];
+};
+
#endif /* BCC_MCCACHE_H */
diff --git a/lib/ExecutionEngine/Android.mk b/lib/ExecutionEngine/Android.mk
index 1ffa056..c015bcc 100644
--- a/lib/ExecutionEngine/Android.mk
+++ b/lib/ExecutionEngine/Android.mk
@@ -27,19 +27,15 @@
FileHandle.cpp \
GDBJIT.cpp \
GDBJITRegistrar.cpp \
+ MCCacheWriter.cpp \
+ MCCacheReader.cpp \
Runtime.c \
RuntimeStub.c \
Script.cpp \
- ScriptCompiled.cpp \
- SourceInfo.cpp
-
-ifeq ($(libbcc_USE_CACHE),1)
-libbcc_executionengine_SRC_FILES += \
- MCCacheWriter.cpp \
- MCCacheReader.cpp \
ScriptCached.cpp \
- Sha1Helper.cpp
-endif
+ ScriptCompiled.cpp \
+ Sha1Helper.cpp \
+ SourceInfo.cpp
#=====================================================================
diff --git a/lib/ExecutionEngine/Compiler.cpp b/lib/ExecutionEngine/Compiler.cpp
index c3ed9b5..8a55e38 100644
--- a/lib/ExecutionEngine/Compiler.cpp
+++ b/lib/ExecutionEngine/Compiler.cpp
@@ -204,12 +204,10 @@
// Register the scheduler
llvm::RegisterScheduler::setDefault(llvm::createDefaultScheduler);
-#if USE_CACHE
// Read in SHA1 checksum of libbcc and libRS.
readSHA1(sha1LibBCC_SHA1, sizeof(sha1LibBCC_SHA1), pathLibBCC_SHA1);
calcFileSHA1(sha1LibRS, pathLibRS);
-#endif
GlobalInitialized = true;
}
diff --git a/lib/ExecutionEngine/MCCacheReader.cpp b/lib/ExecutionEngine/MCCacheReader.cpp
index 4232ba5..6005536 100644
--- a/lib/ExecutionEngine/MCCacheReader.cpp
+++ b/lib/ExecutionEngine/MCCacheReader.cpp
@@ -146,15 +146,15 @@
bool MCCacheReader::checkHeader() {
- if (memcmp(mpHeader->magic, OBCC_MAGIC, 4) != 0) {
+ if (memcmp(mpHeader->magic, MCO_MAGIC, 4) != 0) {
ALOGE("Bad magic word\n");
return false;
}
- if (memcmp(mpHeader->version, OBCC_VERSION, 4) != 0) {
+ if (memcmp(mpHeader->version, MCO_VERSION, 4) != 0) {
mpHeader->version[4 - 1] = '\0'; // ensure c-style string terminated
ALOGI("Cache file format version mismatch: now %s cached %s\n",
- OBCC_VERSION, mpHeader->version);
+ MCO_VERSION, mpHeader->version);
return false;
}
return true;
@@ -240,7 +240,7 @@
bool MCCacheReader::readStringPool() {
- CACHE_READER_READ_SECTION(OBCC_StringPool,
+ CACHE_READER_READ_SECTION(MCO_StringPool,
mpResult->mpStringPoolRaw, str_pool);
char *str_base = reinterpret_cast<char *>(str_pool_raw);
@@ -256,7 +256,7 @@
bool MCCacheReader::checkStringPool() {
- OBCC_StringPool *poolR = mpResult->mpStringPoolRaw;
+ MCO_StringPool *poolR = mpResult->mpStringPoolRaw;
vector<char const *> &pool = mpResult->mStringPool;
// Ensure that every c-style string is ended with '\0'
@@ -272,7 +272,7 @@
bool MCCacheReader::readDependencyTable() {
- CACHE_READER_READ_SECTION(OBCC_DependencyTable, mpCachedDependTable,
+ CACHE_READER_READ_SECTION(MCO_DependencyTable, mpCachedDependTable,
depend_tab);
return true;
}
@@ -295,7 +295,7 @@
uint32_t depType = dep->second.first;
unsigned char const *depSHA1 = dep->second.second;
- OBCC_Dependency *depCached =&mpCachedDependTable->table[i];
+ MCO_Dependency *depCached =&mpCachedDependTable->table[i];
char const *depCachedName = strPool[depCached->res_name_strp_index];
uint32_t depCachedType = depCached->res_type;
unsigned char const *depCachedSHA1 = depCached->sha1;
@@ -335,10 +335,10 @@
}
bool MCCacheReader::readVarNameList() {
- CACHE_READER_READ_SECTION(OBCC_String_Ptr, mpVarNameList, export_var_name_list);
+ CACHE_READER_READ_SECTION(MCO_String_Ptr, mpVarNameList, export_var_name_list);
vector<char const *> const &strPool = mpResult->mStringPool;
- mpResult->mpExportVars = (OBCC_ExportVarList*)
+ mpResult->mpExportVars = (MCO_ExportVarList*)
malloc(sizeof(size_t) +
sizeof(void*) * export_var_name_list_raw->count);
if (!mpResult->mpExportVars) {
@@ -359,10 +359,10 @@
}
bool MCCacheReader::readFuncNameList() {
- CACHE_READER_READ_SECTION(OBCC_String_Ptr, mpFuncNameList, export_func_name_list);
+ CACHE_READER_READ_SECTION(MCO_String_Ptr, mpFuncNameList, export_func_name_list);
vector<char const *> const &strPool = mpResult->mStringPool;
- mpResult->mpExportFuncs = (OBCC_ExportFuncList*)
+ mpResult->mpExportFuncs = (MCO_ExportFuncList*)
malloc(sizeof(size_t) +
sizeof(void*) * export_func_name_list_raw->count);
if (!mpResult->mpExportFuncs) {
@@ -383,10 +383,10 @@
}
bool MCCacheReader::readForEachNameList() {
- CACHE_READER_READ_SECTION(OBCC_String_Ptr, mpForEachNameList, export_foreach_name_list);
+ CACHE_READER_READ_SECTION(MCO_String_Ptr, mpForEachNameList, export_foreach_name_list);
vector<char const *> const &strPool = mpResult->mStringPool;
- mpResult->mpExportForEach = (OBCC_ExportForEachList*)
+ mpResult->mpExportForEach = (MCO_ExportForEachList*)
malloc(sizeof(size_t) +
sizeof(void*) * export_foreach_name_list_raw->count);
if (!mpResult->mpExportForEach) {
@@ -407,13 +407,13 @@
}
bool MCCacheReader::readPragmaList() {
- CACHE_READER_READ_SECTION(OBCC_PragmaList, mpPragmaList, pragma_list);
+ CACHE_READER_READ_SECTION(MCO_PragmaList, mpPragmaList, pragma_list);
vector<char const *> const &strPool = mpResult->mStringPool;
ScriptCached::PragmaList &pragmas = mpResult->mPragmas;
for (size_t i = 0; i < pragma_list_raw->count; ++i) {
- OBCC_Pragma *pragma = &pragma_list_raw->list[i];
+ MCO_Pragma *pragma = &pragma_list_raw->list[i];
pragmas.push_back(make_pair(strPool[pragma->key_strp_index],
strPool[pragma->value_strp_index]));
}
@@ -423,7 +423,7 @@
bool MCCacheReader::readObjectSlotList() {
- CACHE_READER_READ_SECTION(OBCC_ObjectSlotList,
+ CACHE_READER_READ_SECTION(MCO_ObjectSlotList,
mpResult->mpObjectSlotList, object_slot_list);
return true;
}
diff --git a/lib/ExecutionEngine/MCCacheReader.h b/lib/ExecutionEngine/MCCacheReader.h
index 1e59111..df4aca3 100644
--- a/lib/ExecutionEngine/MCCacheReader.h
+++ b/lib/ExecutionEngine/MCCacheReader.h
@@ -40,13 +40,13 @@
off_t mInfoFileSize;
MCO_Header *mpHeader;
- OBCC_DependencyTable *mpCachedDependTable;
- OBCC_PragmaList *mpPragmaList;
- OBCC_FuncTable *mpFuncTable;
+ MCO_DependencyTable *mpCachedDependTable;
+ MCO_PragmaList *mpPragmaList;
+ MCO_FuncTable *mpFuncTable;
- OBCC_String_Ptr *mpVarNameList;
- OBCC_String_Ptr *mpFuncNameList;
- OBCC_String_Ptr *mpForEachNameList;
+ MCO_String_Ptr *mpVarNameList;
+ MCO_String_Ptr *mpFuncNameList;
+ MCO_String_Ptr *mpForEachNameList;
llvm::OwningPtr<ScriptCached> mpResult;
@@ -68,7 +68,7 @@
~MCCacheReader();
- void addDependency(OBCC_ResourceType resType,
+ void addDependency(MCO_ResourceType resType,
std::string const &resName,
unsigned char const *sha1) {
mDependencies.insert(std::make_pair(resName,
diff --git a/lib/ExecutionEngine/MCCacheWriter.cpp b/lib/ExecutionEngine/MCCacheWriter.cpp
index 427f067..b0bf117 100644
--- a/lib/ExecutionEngine/MCCacheWriter.cpp
+++ b/lib/ExecutionEngine/MCCacheWriter.cpp
@@ -87,8 +87,8 @@
memset(header, '\0', sizeof(MCO_Header));
// Magic word and version
- memcpy(header->magic, OBCC_MAGIC, 4);
- memcpy(header->version, OBCC_VERSION, 4);
+ memcpy(header->magic, MCO_MAGIC, 4);
+ memcpy(header->version, MCO_VERSION, 4);
// Machine Integer Type
uint32_t number = 0x00000001;
@@ -106,10 +106,10 @@
bool MCCacheWriter::prepareDependencyTable() {
- size_t tableSize = sizeof(OBCC_DependencyTable) +
- sizeof(OBCC_Dependency) * mDependencies.size();
+ size_t tableSize = sizeof(MCO_DependencyTable) +
+ sizeof(MCO_Dependency) * mDependencies.size();
- OBCC_DependencyTable *tab = (OBCC_DependencyTable *)malloc(tableSize);
+ MCO_DependencyTable *tab = (MCO_DependencyTable *)malloc(tableSize);
if (!tab) {
ALOGE("Unable to allocate for dependency table section.\n");
@@ -124,7 +124,7 @@
size_t i = 0;
for (map<string, pair<uint32_t, unsigned char const *> >::iterator
I = mDependencies.begin(), E = mDependencies.end(); I != E; ++I, ++i) {
- OBCC_Dependency *dep = &tab->table[i];
+ MCO_Dependency *dep = &tab->table[i];
dep->res_name_strp_index = addString(I->first.c_str(), I->first.size());
dep->res_type = I->second.first;
@@ -137,10 +137,10 @@
bool MCCacheWriter::preparePragmaList() {
size_t pragmaCount = mpOwner->getPragmaCount();
- size_t listSize = sizeof(OBCC_PragmaList) +
- sizeof(OBCC_Pragma) * pragmaCount;
+ size_t listSize = sizeof(MCO_PragmaList) +
+ sizeof(MCO_Pragma) * pragmaCount;
- OBCC_PragmaList *list = (OBCC_PragmaList *)malloc(listSize);
+ MCO_PragmaList *list = (MCO_PragmaList *)malloc(listSize);
if (!list) {
ALOGE("Unable to allocate for pragma list\n");
@@ -163,7 +163,7 @@
size_t keyLen = strlen(key);
size_t valueLen = strlen(value);
- OBCC_Pragma *pragma = &list->list[i];
+ MCO_Pragma *pragma = &list->list[i];
pragma->key_strp_index = addString(key, keyLen);
pragma->value_strp_index = addString(value, valueLen);
}
@@ -173,8 +173,8 @@
bool MCCacheWriter::prepareStringPool() {
// Calculate string pool size
- size_t size = sizeof(OBCC_StringPool) +
- sizeof(OBCC_String) * mStringPool.size();
+ size_t size = sizeof(MCO_StringPool) +
+ sizeof(MCO_String) * mStringPool.size();
off_t strOffset = size;
@@ -183,7 +183,7 @@
}
// Create string pool
- OBCC_StringPool *pool = (OBCC_StringPool *)malloc(size);
+ MCO_StringPool *pool = (MCO_StringPool *)malloc(size);
if (!pool) {
ALOGE("Unable to allocate string pool.\n");
@@ -198,7 +198,7 @@
char *strPtr = reinterpret_cast<char *>(pool) + strOffset;
for (size_t i = 0; i < mStringPool.size(); ++i) {
- OBCC_String *str = &pool->list[i];
+ MCO_String *str = &pool->list[i];
str->length = mStringPool[i].second;
str->offset = strOffset;
@@ -216,9 +216,9 @@
bool MCCacheWriter::prepareExportVarNameList() {
size_t varCount = mpOwner->getExportVarCount();
- size_t listSize = sizeof(OBCC_String_Ptr) + sizeof(size_t) * varCount;
+ size_t listSize = sizeof(MCO_String_Ptr) + sizeof(size_t) * varCount;
- OBCC_String_Ptr *list = (OBCC_String_Ptr*)malloc(listSize);
+ MCO_String_Ptr *list = (MCO_String_Ptr*)malloc(listSize);
if (!list) {
ALOGE("Unable to allocate for export variable name list\n");
@@ -240,9 +240,9 @@
bool MCCacheWriter::prepareExportFuncNameList() {
size_t funcCount = mpOwner->getExportFuncCount();
- size_t listSize = sizeof(OBCC_String_Ptr) + sizeof(size_t) * funcCount;
+ size_t listSize = sizeof(MCO_String_Ptr) + sizeof(size_t) * funcCount;
- OBCC_String_Ptr *list = (OBCC_String_Ptr*)malloc(listSize);
+ MCO_String_Ptr *list = (MCO_String_Ptr*)malloc(listSize);
if (!list) {
ALOGE("Unable to allocate for export function name list\n");
@@ -264,9 +264,9 @@
bool MCCacheWriter::prepareExportForEachNameList() {
size_t forEachCount = mpOwner->getExportForEachCount();
- size_t listSize = sizeof(OBCC_String_Ptr) + sizeof(size_t) * forEachCount;
+ size_t listSize = sizeof(MCO_String_Ptr) + sizeof(size_t) * forEachCount;
- OBCC_String_Ptr *list = (OBCC_String_Ptr*)malloc(listSize);
+ MCO_String_Ptr *list = (MCO_String_Ptr*)malloc(listSize);
if (!list) {
ALOGE("Unable to allocate for export forEach name list\n");
@@ -289,10 +289,10 @@
bool MCCacheWriter::prepareObjectSlotList() {
size_t objectSlotCount = mpOwner->getObjectSlotCount();
- size_t listSize = sizeof(OBCC_ObjectSlotList) +
+ size_t listSize = sizeof(MCO_ObjectSlotList) +
sizeof(uint32_t) * objectSlotCount;
- OBCC_ObjectSlotList *list = (OBCC_ObjectSlotList *)malloc(listSize);
+ MCO_ObjectSlotList *list = (MCO_ObjectSlotList *)malloc(listSize);
if (!list) {
ALOGE("Unable to allocate for object slot list\n");
diff --git a/lib/ExecutionEngine/MCCacheWriter.h b/lib/ExecutionEngine/MCCacheWriter.h
index 58f6ef5..b2bcb12 100644
--- a/lib/ExecutionEngine/MCCacheWriter.h
+++ b/lib/ExecutionEngine/MCCacheWriter.h
@@ -41,14 +41,14 @@
std::pair<uint32_t, unsigned char const *> > mDependencies;
MCO_Header *mpHeaderSection;
- OBCC_StringPool *mpStringPoolSection;
- OBCC_DependencyTable *mpDependencyTableSection;
- OBCC_PragmaList *mpPragmaListSection;
- OBCC_ObjectSlotList *mpObjectSlotSection;
+ MCO_StringPool *mpStringPoolSection;
+ MCO_DependencyTable *mpDependencyTableSection;
+ MCO_PragmaList *mpPragmaListSection;
+ MCO_ObjectSlotList *mpObjectSlotSection;
- OBCC_String_Ptr *mpExportVarNameListSection;
- OBCC_String_Ptr *mpExportFuncNameListSection;
- OBCC_String_Ptr *mpExportForEachNameListSection;
+ MCO_String_Ptr *mpExportVarNameListSection;
+ MCO_String_Ptr *mpExportFuncNameListSection;
+ MCO_String_Ptr *mpExportForEachNameListSection;
std::vector<std::string> varNameList;
std::vector<std::string> funcNameList;
@@ -66,7 +66,7 @@
bool writeCacheFile(FileHandle *objFile, FileHandle *infoFile,
Script *S, uint32_t libRS_threadable);
- void addDependency(OBCC_ResourceType resType,
+ void addDependency(MCO_ResourceType resType,
std::string const &resName,
unsigned char const *sha1) {
mDependencies.insert(std::make_pair(resName,
diff --git a/lib/ExecutionEngine/Script.cpp b/lib/ExecutionEngine/Script.cpp
index 65f7dfb..445d075 100644
--- a/lib/ExecutionEngine/Script.cpp
+++ b/lib/ExecutionEngine/Script.cpp
@@ -57,11 +57,9 @@
delete mCompiled;
break;
-#if USE_CACHE
case ScriptStatus::Cached:
delete mCached;
break;
-#endif
default:
break;
@@ -221,10 +219,7 @@
return 1;
}
- int status = -1;
-#if USE_CACHE
- status = internalLoadCache(cacheDir, cacheName, /* checkOnly */ false);
-#endif
+ int status = internalLoadCache(cacheDir, cacheName, /* checkOnly */ false);
if (status != 0) {
CompilerOption option;
@@ -250,7 +245,6 @@
return status;
}
-#if USE_CACHE
int Script::internalLoadCache(char const *cacheDir, char const *cacheName,
bool checkOnly) {
if ((cacheDir == NULL) || (cacheName == NULL)) {
@@ -325,7 +319,6 @@
return 0;
}
-#endif
int Script::internalCompile(const CompilerOption &option) {
// Create the ScriptCompiled object
@@ -393,7 +386,6 @@
(getCompilerErrorMessage() == NULL))
return 1;
-#if USE_CACHE
// Note: If we re-compile the script because the cached context slot not
// available, then we don't have to write the cache.
@@ -460,7 +452,6 @@
}
}
}
-#endif // USE_CACHE
return 0;
}
@@ -482,11 +473,9 @@
return mCompiled->lookup(name);
}
-#if USE_CACHE
case ScriptStatus::Cached: {
return mCached->lookup(name);
}
-#endif
default: {
mErrorCode = BCC_INVALID_OPERATION;
@@ -502,11 +491,9 @@
return mCompiled->getExportVarCount();
}
-#if USE_CACHE
case ScriptStatus::Cached: {
return mCached->getExportVarCount();
}
-#endif
default: {
return 0;
@@ -521,11 +508,9 @@
return mCompiled->getExportFuncCount();
}
-#if USE_CACHE
case ScriptStatus::Cached: {
return mCached->getExportFuncCount();
}
-#endif
default: {
return 0;
@@ -540,11 +525,9 @@
return mCompiled->getExportForEachCount();
}
-#if USE_CACHE
case ScriptStatus::Cached: {
return mCached->getExportForEachCount();
}
-#endif
default: {
return 0;
@@ -559,11 +542,9 @@
return mCompiled->getPragmaCount();
}
-#if USE_CACHE
case ScriptStatus::Cached: {
return mCached->getPragmaCount();
}
-#endif
default: {
return 0;
@@ -578,11 +559,9 @@
return mCompiled->getFuncCount();
}
-#if USE_CACHE
case ScriptStatus::Cached: {
return mCached->getFuncCount();
}
-#endif
default: {
return 0;
@@ -597,11 +576,9 @@
return mCompiled->getObjectSlotCount();
}
-#if USE_CACHE
case ScriptStatus::Cached: {
return mCached->getObjectSlotCount();
}
-#endif
default: {
return 0;
@@ -617,9 +594,7 @@
m##STATUS->getExportVarList(varListSize, varList); \
break;
-#if USE_CACHE
DELEGATE(Cached);
-#endif
DELEGATE(Compiled);
#undef DELEGATE
@@ -650,9 +625,7 @@
m##STATUS->getExportFuncList(funcListSize, funcList); \
break;
-#if USE_CACHE
DELEGATE(Cached);
-#endif
DELEGATE(Compiled);
#undef DELEGATE
@@ -682,9 +655,7 @@
m##STATUS->getExportForEachList(funcListSize, funcList); \
break;
-#if USE_CACHE
DELEGATE(Cached);
-#endif
DELEGATE(Compiled);
#undef DELEGATE
@@ -716,9 +687,7 @@
m##STATUS->getPragmaList(pragmaListSize, keyList, valueList); \
break;
-#if USE_CACHE
DELEGATE(Cached);
-#endif
DELEGATE(Compiled);
#undef DELEGATE
@@ -738,9 +707,7 @@
m##STATUS->getFuncInfoList(funcInfoListSize, funcInfoList); \
break;
-#if USE_CACHE
DELEGATE(Cached);
-#endif
DELEGATE(Compiled);
#undef DELEGATE
@@ -760,9 +727,7 @@
m##STATUS->getObjectSlotList(objectSlotListSize, objectSlotList); \
break;
-#if USE_CACHE
DELEGATE(Cached);
-#endif
DELEGATE(Compiled);
#undef DELEGATE
@@ -787,7 +752,6 @@
}
bool Script::isCacheable() const {
-#if USE_CACHE
if (getBooleanProp("debug.bcc.nocache")) {
// Android system environment property: Disables the cache mechanism by
// setting "debug.bcc.nocache". So we will not load the cache file any
@@ -802,9 +766,6 @@
}
return true;
-#else
- return false;
-#endif
}
size_t Script::getELFSize() const {
@@ -812,11 +773,11 @@
case ScriptStatus::Compiled: {
return mCompiled->getELFSize();
}
-#if USE_CACHE
+
case ScriptStatus::Cached: {
return mCached->getELFSize();
}
-#endif
+
default: {
return 0;
}
@@ -828,11 +789,11 @@
case ScriptStatus::Compiled: {
return mCompiled->getELF();
}
-#if USE_CACHE
+
case ScriptStatus::Cached: {
return mCached->getELF();
}
-#endif
+
default: {
return NULL;
}
diff --git a/lib/ExecutionEngine/Script.h b/lib/ExecutionEngine/Script.h
index f3e933d..16a453c 100644
--- a/lib/ExecutionEngine/Script.h
+++ b/lib/ExecutionEngine/Script.h
@@ -44,9 +44,7 @@
enum StatusType {
Unknown,
Compiled,
-#if USE_CACHE
- Cached,
-#endif
+ Cached
};
}
@@ -71,12 +69,9 @@
union {
ScriptCompiled *mCompiled;
-#if USE_CACHE
ScriptCached *mCached;
-#endif
};
-#if USE_CACHE
std::string mCacheDir;
std::string mCacheName;
@@ -87,7 +82,6 @@
inline std::string getCacheInfoPath() const {
return getCachedObjectPath().append(".info");
}
-#endif
bool mIsContextSlotNotAvail;
@@ -224,14 +218,13 @@
}
private:
-#if USE_CACHE
//
// It returns 0 if there's a cache hit.
//
// Side effect: it will set mCacheDir, mCacheName.
int internalLoadCache(char const *cacheDir, char const *cacheName,
bool checkOnly);
-#endif
+
int internalCompile(const CompilerOption&);
};
diff --git a/lib/ExecutionEngine/ScriptCached.cpp b/lib/ExecutionEngine/ScriptCached.cpp
index 1b08bc4..bbfac2b 100644
--- a/lib/ExecutionEngine/ScriptCached.cpp
+++ b/lib/ExecutionEngine/ScriptCached.cpp
@@ -18,8 +18,6 @@
#include "ScriptCached.h"
-#include <bcc/bcc_cache.h>
-
#include "DebugHelper.h"
#include <stdlib.h>
diff --git a/lib/ExecutionEngine/ScriptCached.h b/lib/ExecutionEngine/ScriptCached.h
index 750050f..e24a714 100644
--- a/lib/ExecutionEngine/ScriptCached.h
+++ b/lib/ExecutionEngine/ScriptCached.h
@@ -20,7 +20,6 @@
#include "Config.h"
#include <bcc/bcc.h>
-#include <bcc/bcc_cache.h>
#include <bcc/bcc_mccache.h>
#include "bcc_internal.h"
@@ -57,18 +56,18 @@
private:
Script *mpOwner;
- OBCC_ExportVarList *mpExportVars;
- OBCC_ExportFuncList *mpExportFuncs;
- OBCC_ExportForEachList *mpExportForEach;
+ MCO_ExportVarList *mpExportVars;
+ MCO_ExportFuncList *mpExportFuncs;
+ MCO_ExportForEachList *mpExportForEach;
PragmaList mPragmas;
- OBCC_ObjectSlotList *mpObjectSlotList;
+ MCO_ObjectSlotList *mpObjectSlotList;
FuncTable mFunctions;
RSExecRef mRSExecutable;
llvm::SmallVector<char, 1024> mCachedELFExecutable;
- OBCC_StringPool *mpStringPoolRaw;
+ MCO_StringPool *mpStringPoolRaw;
std::vector<char const *> mStringPool;
bool mLibRSThreadable;
diff --git a/lib/ExecutionEngine/SourceInfo.cpp b/lib/ExecutionEngine/SourceInfo.cpp
index b937b05..c069462 100644
--- a/lib/ExecutionEngine/SourceInfo.cpp
+++ b/lib/ExecutionEngine/SourceInfo.cpp
@@ -16,17 +16,14 @@
#include "SourceInfo.h"
-#if USE_CACHE
#include "MCCacheWriter.h"
#include "MCCacheReader.h"
-#endif
#include "DebugHelper.h"
#include "ScriptCompiled.h"
#include "Sha1Helper.h"
#include <bcc/bcc.h>
-#include <bcc/bcc_cache.h>
#include <llvm/Bitcode/ReaderWriter.h>
#include <llvm/Module.h>
@@ -58,7 +55,6 @@
result->buffer.bitcodeSize = bitcodeSize;
result->flags = flags;
-#if USE_CACHE
if (!resName && !(flags & BCC_SKIP_DEP_SHA1)) {
result->flags |= BCC_SKIP_DEP_SHA1;
@@ -72,7 +68,6 @@
} else {
calcSHA1(result->sha1, bitcode, bitcodeSize);
}
-#endif
return result;
}
@@ -90,13 +85,11 @@
result->file.path = path;
result->flags = flags;
-#if USE_CACHE
memset(result->sha1, '\0', 20);
if (!(result->flags & BCC_SKIP_DEP_SHA1)) {
calcFileSHA1(result->sha1, path);
}
-#endif
return result;
}
@@ -114,7 +107,6 @@
result->module = module;
result->flags = flags;
-#if USE_CACHE
if (! (flags & BCC_SKIP_DEP_SHA1)) {
result->flags |= BCC_SKIP_DEP_SHA1;
@@ -124,7 +116,6 @@
}
memset(result->sha1, '\0', 20);
-#endif
return result;
}
@@ -190,7 +181,6 @@
}
}
-#if USE_CACHE
template <typename T> void SourceInfo::introDependency(T &checker) {
if (flags & BCC_SKIP_DEP_SHA1) {
return;
@@ -212,7 +202,6 @@
template void SourceInfo::introDependency<MCCacheWriter>(MCCacheWriter &);
template void SourceInfo::introDependency<MCCacheReader>(MCCacheReader &);
-#endif // USE_CACHE
} // namespace bcc
diff --git a/lib/ExecutionEngine/SourceInfo.h b/lib/ExecutionEngine/SourceInfo.h
index 9026f1c..080d3b4 100644
--- a/lib/ExecutionEngine/SourceInfo.h
+++ b/lib/ExecutionEngine/SourceInfo.h
@@ -61,9 +61,7 @@
unsigned long flags;
-#if USE_CACHE
unsigned char sha1[20];
-#endif
private:
SourceInfo() : module(NULL), shared_context(false) { }
@@ -91,9 +89,7 @@
// Share with the given context if it's provided.
int prepareModule(llvm::LLVMContext *context = NULL);
-#if USE_CACHE
template <typename T> void introDependency(T &checker);
-#endif
~SourceInfo();
};
diff --git a/libbcc-config.mk b/libbcc-config.mk
index 63219a6..37cc848 100644
--- a/libbcc-config.mk
+++ b/libbcc-config.mk
@@ -28,8 +28,6 @@
# Configurations
#=====================================================================
-libbcc_USE_CACHE := 1
-
libbcc_DEBUG_MC_DISASSEMBLER := 0
libbcc_USE_LOGGER := 1