Update the GetDirectBufferAddress implementation.

This change is the dalvik change corresponding to the following libcore change:
  https://android-git.corp.google.com/g/64326

Bug: 2935622
Change-Id: If3687e3efcc322e651c685885f6701726b5d9efc
diff --git a/vm/Globals.h b/vm/Globals.h
index fea40c2..25a9d70 100644
--- a/vm/Globals.h
+++ b/vm/Globals.h
@@ -329,7 +329,6 @@
     Method*     methOrgApacheHarmonyNioInternalDirectBuffer_getEffectiveAddress;
     int         offJavaNioBuffer_capacity;
     int         offJavaNioBuffer_effectiveDirectAddress;
-    int         offOrgApacheHarmonyLuniPlatformPlatformAddress_osaddr;
 
     /*
      * VM-synthesized primitive classes, for arrays.
diff --git a/vm/Jni.c b/vm/Jni.c
index 312984e..5fe68c0 100644
--- a/vm/Jni.c
+++ b/vm/Jni.c
@@ -370,9 +370,9 @@
     meth = dvmFindVirtualMethodByDescriptor(
                 gDvm.classOrgApacheHarmonyNioInternalDirectBuffer,
                 "getEffectiveAddress",
-                "()Lorg/apache/harmony/luni/platform/PlatformAddress;");
+                "()I");
     if (meth == NULL) {
-        LOGE("Unable to find PlatformAddress.getEffectiveAddress\n");
+        LOGE("Unable to find DirectBuffer.getEffectiveAddress\n");
         return false;
     }
     gDvm.methOrgApacheHarmonyNioInternalDirectBuffer_getEffectiveAddress = meth;
@@ -395,13 +395,6 @@
     }
     gDvm.methJavaNioReadWriteDirectByteBuffer_init = meth;
 
-    gDvm.offOrgApacheHarmonyLuniPlatformPlatformAddress_osaddr =
-        dvmFindFieldOffset(platformAddressClass, "osaddr", "I");
-    if (gDvm.offOrgApacheHarmonyLuniPlatformPlatformAddress_osaddr < 0) {
-        LOGE("Unable to find PlatformAddress.osaddr\n");
-        return false;
-    }
-
     gDvm.offJavaNioBuffer_capacity =
         dvmFindFieldOffset(bufferClass, "capacity", "I");
     if (gDvm.offJavaNioBuffer_capacity < 0) {
@@ -3711,10 +3704,9 @@
     }
 
     /*
-     * Get a PlatformAddress object with the effective address.
+     * Get the effective address by calling getEffectiveAddress.
      *
-     * If this isn't a direct buffer, the result will be NULL and/or an
-     * exception will have been thrown.
+     * If this isn't a direct buffer, an exception will have been thrown.
      */
     JValue callResult;
     const Method* meth = dvmGetVirtualizedMethod(bufObj->clazz,
@@ -3722,23 +3714,14 @@
     dvmCallMethodA(self, meth, bufObj, false, &callResult, NULL);
     if (dvmGetException(self) != NULL) {
         dvmClearException(self);
-        callResult.l = NULL;
+        callResult.i = 0;
     }
 
-    Object* platformAddr = callResult.l;
-    if (platformAddr == NULL) {
+    result = (void*)(uintptr_t) callResult.i;
+    if (result == NULL) {
         LOGV("Got request for address of non-direct buffer\n");
-        goto bail;
     }
 
-    /*
-     * Extract the address from the PlatformAddress object.  Instead of
-     * calling the toInt() method, just grab the field directly.  This
-     * is faster but more fragile.
-     */
-    result = (void*) dvmGetFieldInt(platformAddr,
-                gDvm.offOrgApacheHarmonyLuniPlatformPlatformAddress_osaddr);
-
     //LOGI("slow path for %p --> %p\n", buf, result);
 
 bail: