diff options
| author | Stephen Hines <srhines@google.com> | 2015-05-20 18:09:57 -0700 |
|---|---|---|
| committer | Stephen Hines <srhines@google.com> | 2015-05-22 13:19:36 -0700 |
| commit | 5aa018cc36e589b07674957714d27ae3d1fa1c4e (patch) | |
| tree | 0e2c6ba61785d8effa32ff499c21fbcbf966519d /cpu_ref/rsCpuExecutable.cpp | |
| parent | c060f1435e7b9405f3be8974417fa6f410f03753 (diff) | |
Update RS driver to support extraction of global variable properties.
Bug: 20306487
This patch adds some new enums to classify properties (such as "static",
"constant", and "pointer") for global variables. The reference driver
is also extended to provide methods to examine these properties (when
the bitcode is compiled with bcc).
Change-Id: I331756f8a8990caf5ebdf85599060434a7cfdcb7
Diffstat (limited to 'cpu_ref/rsCpuExecutable.cpp')
| -rw-r--r-- | cpu_ref/rsCpuExecutable.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/cpu_ref/rsCpuExecutable.cpp b/cpu_ref/rsCpuExecutable.cpp index f229f523..e2c27b55 100644 --- a/cpu_ref/rsCpuExecutable.cpp +++ b/cpu_ref/rsCpuExecutable.cpp @@ -311,12 +311,13 @@ ScriptExecutable* ScriptExecutable::createFromSharedObject( const char ** pragmaValues = nullptr; uint32_t checksum = 0; - const char *rsInfo = (const char *) dlsym(sharedObj, ".rs.info"); + const char *rsInfo = (const char *) dlsym(sharedObj, kRsInfo); int numEntries = 0; - const int *rsGlobalEntries = (const int *) dlsym(sharedObj, ".rs.global_entries"); - const char **rsGlobalNames = (const char **) dlsym(sharedObj, ".rs.global_names"); - const void **rsGlobalAddresses = (const void **) dlsym(sharedObj, ".rs.global_addresses"); - const size_t *rsGlobalSizes = (const size_t *) dlsym(sharedObj, ".rs.global_sizes"); + const int *rsGlobalEntries = (const int *) dlsym(sharedObj, kRsGlobalEntries); + const char **rsGlobalNames = (const char **) dlsym(sharedObj, kRsGlobalNames); + const void **rsGlobalAddresses = (const void **) dlsym(sharedObj, kRsGlobalAddresses); + const size_t *rsGlobalSizes = (const size_t *) dlsym(sharedObj, kRsGlobalSizes); + const uint32_t *rsGlobalProperties = (const uint32_t *) dlsym(sharedObj, kRsGlobalProperties); if (strgets(line, MAXLINE, &rsInfo) == nullptr) { return nullptr; @@ -559,6 +560,7 @@ ScriptExecutable* ScriptExecutable::createFromSharedObject( rsAssert(rsGlobalNames); rsAssert(rsGlobalAddresses); rsAssert(rsGlobalSizes); + rsAssert(rsGlobalProperties); } } else { ALOGD("Missing .rs.global_entries from shared object"); @@ -569,8 +571,8 @@ ScriptExecutable* ScriptExecutable::createFromSharedObject( invokeFunctions, funcCount, forEachFunctions, forEachSignatures, forEachCount, pragmaKeys, pragmaValues, pragmaCount, - rsGlobalNames, rsGlobalAddresses, rsGlobalSizes, numEntries, - isThreadable, checksum); + rsGlobalNames, rsGlobalAddresses, rsGlobalSizes, rsGlobalProperties, + numEntries, isThreadable, checksum); error: @@ -612,9 +614,18 @@ void* ScriptExecutable::getFieldAddress(const char* name) const { bool ScriptExecutable::dumpGlobalInfo() const { ALOGE("Globals: %p %p %p", mGlobalAddresses, mGlobalSizes, mGlobalNames); + ALOGE("P - Pointer"); + ALOGE(" C - Constant"); + ALOGE(" S - Static"); for (int i = 0; i < mGlobalEntries; i++) { ALOGE("Global[%d]: %p %zu %s", i, mGlobalAddresses[i], mGlobalSizes[i], mGlobalNames[i]); + uint32_t properties = mGlobalProperties[i]; + ALOGE("%c%c%c Type: %u", + isGlobalPointer(properties) ? 'P' : ' ', + isGlobalConstant(properties) ? 'C' : ' ', + isGlobalStatic(properties) ? 'S' : ' ', + getGlobalRsType(properties)); } return true; } |
