summaryrefslogtreecommitdiffstats
path: root/vm/Native.c
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2009-11-12 18:45:15 -0800
committerJean-Baptiste Queru <jbq@google.com>2009-11-12 18:45:15 -0800
commit72e93344b4d1ffc71e9c832ec23de0657e5b04a5 (patch)
tree1a08d1e43d54200ea737234d865c4668c5d3535b /vm/Native.c
parentdfd0afbcb08b871e224a28ecb4ed427a7693545c (diff)
downloadandroid_dalvik-72e93344b4d1ffc71e9c832ec23de0657e5b04a5.tar.gz
android_dalvik-72e93344b4d1ffc71e9c832ec23de0657e5b04a5.tar.bz2
android_dalvik-72e93344b4d1ffc71e9c832ec23de0657e5b04a5.zip
eclair snapshot
Diffstat (limited to 'vm/Native.c')
-rw-r--r--vm/Native.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/vm/Native.c b/vm/Native.c
index 618fb9997..31832c250 100644
--- a/vm/Native.c
+++ b/vm/Native.c
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/*
* Native method resolution.
*
@@ -61,6 +62,10 @@ void dvmNativeShutdown(void)
* Initializes method's class if necessary.
*
* An exception is thrown on resolution failure.
+ *
+ * (This should not be taking "const Method*", because it modifies the
+ * structure, but the declaration needs to match the DalvikBridgeFunc
+ * type definition.)
*/
void dvmResolveNativeMethod(const u4* args, JValue* pResult,
const Method* method, Thread* self)
@@ -107,11 +112,9 @@ void dvmResolveNativeMethod(const u4* args, JValue* pResult,
/* now scan any DLLs we have loaded for JNI signatures */
func = lookupSharedLibMethod(method);
if (func != NULL) {
- if (dvmIsSynchronizedMethod(method))
- dvmSetNativeFunc(method, dvmCallSynchronizedJNIMethod, func);
- else
- dvmSetNativeFunc(method, dvmCallJNIMethod, func);
- dvmCallJNIMethod(args, pResult, method, self);
+ /* found it, point it at the JNI bridge and then call it */
+ dvmUseJNIBridge((Method*) method, func);
+ (*method->nativeFunc)(args, pResult, method, self);
return;
}
@@ -467,16 +470,18 @@ bool dvmLoadNativeCode(const char* pathName, Object* classLoader)
* doesn't have to search through LD_LIBRARY_PATH. (It may do so to
* resolve this library's dependencies though.)
*
- * Failures here are expected when java.library.path has several entries.
+ * Failures here are expected when java.library.path has several entries
+ * and we have to hunt for the lib.
*
* The current android-arm dynamic linker implementation tends to
* return "Cannot find library" from dlerror() regardless of the actual
- * problem. A more useful diagnostic may be sent to stdout/stderr,
- * but often that's not visible. Some things to try:
+ * problem. A more useful diagnostic may be sent to stdout/stderr if
+ * linker diagnostics are enabled, but that's not usually visible in
+ * Android apps. Some things to try:
* - make sure the library exists on the device
* - verify that the right path is being opened (the debug log message
* above can help with that)
- * - check to see if the library is valid
+ * - check to see if the library is valid (e.g. not zero bytes long)
* - check config/prelink-linux-arm.map to ensure that the library
* is listed and is not being overrun by the previous entry (if
* loading suddenly stops working on a prelinked library, this is
@@ -646,7 +651,7 @@ static char* mangleString(const char* str, int len)
for (i = 0; i < charLen; i++) {
u2 ch = utf16[i];
- if (ch > 127) {
+ if (ch == '$' || ch > 127) {
mangleLen += 6;
} else {
switch (ch) {
@@ -671,7 +676,7 @@ static char* mangleString(const char* str, int len)
for (i = 0, cp = mangle; i < charLen; i++) {
u2 ch = utf16[i];
- if (ch > 127) {
+ if (ch == '$' || ch > 127) {
sprintf(cp, "_0%04x", ch);
cp += 6;
} else {