Merge "Fix load/storeBaseDispWide bug with large offests." into dalvik-dev
diff --git a/src/debugger.cc b/src/debugger.cc
index 5a1b1ad..89cfe64 100644
--- a/src/debugger.cc
+++ b/src/debugger.cc
@@ -1118,7 +1118,7 @@
     static void Callback(void* context, uint16_t slot, uint32_t startAddress, uint32_t endAddress, const char* name, const char* descriptor, const char* signature) {
       DebugCallbackContext* pContext = reinterpret_cast<DebugCallbackContext*>(context);
 
-      VLOG(jdwp) << StringPrintf("    %2zd: %d(%d) '%s' '%s' '%s' slot=%d", pContext->variable_count, startAddress, endAddress - startAddress, name, descriptor, signature, slot);
+      VLOG(jdwp) << StringPrintf("    %2zd: %d(%d) '%s' '%s' '%s' actual slot=%d mangled slot=%d", pContext->variable_count, startAddress, endAddress - startAddress, name, descriptor, signature, slot, MangleSlot(slot, name));
 
       slot = MangleSlot(slot, name);
 
@@ -1586,6 +1586,8 @@
     UNIMPLEMENTED(FATAL) << "Don't know how to pull locals from callee save frames: " << vmap_offset;
   }
 
+  // TODO: check that the tag is compatible with the actual type of the slot!
+
   switch (tag) {
   case JDWP::JT_BOOLEAN:
     {
@@ -1632,7 +1634,12 @@
       JDWP::SetObjectId(buf+1, gRegistry->Add(o));
     }
     break;
+  case JDWP::JT_CLASS_LOADER:
+  case JDWP::JT_CLASS_OBJECT:
   case JDWP::JT_OBJECT:
+  case JDWP::JT_STRING:
+  case JDWP::JT_THREAD:
+  case JDWP::JT_THREAD_GROUP:
     {
       CHECK_EQ(width, sizeof(JDWP::ObjectId));
       Object* o = reinterpret_cast<Object*>(f.GetVReg(m, reg));
@@ -1676,6 +1683,8 @@
     UNIMPLEMENTED(FATAL) << "Don't know how to pull locals from callee save frames: " << vmap_offset;
   }
 
+  // TODO: check that the tag is compatible with the actual type of the slot!
+
   switch (tag) {
   case JDWP::JT_BOOLEAN:
   case JDWP::JT_BYTE:
@@ -1698,6 +1707,9 @@
     {
       CHECK_EQ(width, sizeof(JDWP::ObjectId));
       Object* o = gRegistry->Get<Object*>(static_cast<JDWP::ObjectId>(value));
+      if (o == kInvalidObject) {
+        UNIMPLEMENTED(FATAL) << "return an error code when given an invalid object to store";
+      }
       f.SetVReg(m, reg, static_cast<uint32_t>(reinterpret_cast<uintptr_t>(o)));
     }
     break;
diff --git a/src/dex_verifier.cc b/src/dex_verifier.cc
index 2b90089..04829bf 100644
--- a/src/dex_verifier.cc
+++ b/src/dex_verifier.cc
@@ -3182,18 +3182,18 @@
                                << PrettyMethod(res_method);
     return NULL;
   }
-  // Check that invoke-virtual and invoke-super are not used on private methods.
-  if (res_method->IsPrivate() && method_type == METHOD_VIRTUAL) {
-    Fail(VERIFY_ERROR_GENERIC) << "invoke-super/virtual can't be used on private method "
-                               << PrettyMethod(res_method);
-    return NULL;
-  }
   // Check if access is allowed.
   if (!referrer->CanAccessMember(res_method->GetDeclaringClass(), res_method->GetAccessFlags())) {
     Fail(VERIFY_ERROR_ACCESS_METHOD) << "illegal method access (call " << PrettyMethod(res_method)
                                   << " from " << PrettyDescriptor(referrer) << ")";
     return NULL;
   }
+  // Check that invoke-virtual and invoke-super are not used on private methods of the same class.
+  if (res_method->IsPrivate() && method_type == METHOD_VIRTUAL) {
+    Fail(VERIFY_ERROR_GENERIC) << "invoke-super/virtual can't be used on private method "
+                               << PrettyMethod(res_method);
+    return NULL;
+  }
   // Check that interface methods match interface classes.
   if (klass->IsInterface() && method_type != METHOD_INTERFACE) {
     Fail(VERIFY_ERROR_CLASS_CHANGE) << "non-interface method " << PrettyMethod(res_method)
diff --git a/src/oatdump.cc b/src/oatdump.cc
index 5b9d271..1bbbb08 100644
--- a/src/oatdump.cc
+++ b/src/oatdump.cc
@@ -407,7 +407,7 @@
         if (run == 0) {
           StringAppendF(&summary, "\t%d: ", i);
         } else {
-          StringAppendF(&summary, "\t%d to %d: ", i, i + run);
+          StringAppendF(&summary, "\t%d to %zd: ", i, i + run);
           i = i + run;
         }
         Class* value_class = value == NULL ? obj_class->GetComponentType() : value->GetClass();
diff --git a/test/003-omnibus-opcodes/expected.txt b/test/003-omnibus-opcodes/expected.txt
index afb0c19..25ab188 100644
--- a/test/003-omnibus-opcodes/expected.txt
+++ b/test/003-omnibus-opcodes/expected.txt
@@ -69,20 +69,14 @@
 UnresTest1...
 UnresTest1...
 UnresTest2...
-java.lang.ClassNotFoundException: Didn't find class "UnresClass" on path: /data/art-test/003-omnibus-opcodes.jar
-	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:64)
-	at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
-	at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
+java.lang.NoClassDefFoundError: Failed resolution of: LUnresClass;
 	at UnresTest2.run(UnresTest2.java:33)
 	at Main.run(Main.java:64)
 	at Main.main(Main.java:26)
-	Suppressed: java.lang.ClassNotFoundException: UnresClass
-		at java.lang.Class.classForName(Native Method)
-		at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
-		at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
-		at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
-		... 4 more
-	Caused by: java.lang.NoClassDefFoundError: Class "LUnresClass;" not found
-		... 8 more
+java.lang.NoClassDefFoundError: Failed resolution of: LUnresClassSubclass;
+	at UnresTest2.run(UnresTest2.java:41)
+	at Main.run(Main.java:64)
+	at Main.main(Main.java:26)
+UnresTest2 done
 InternedString.run
 Done!