diff src/share/vm/interpreter/linkResolver.cpp @ 12885:8df6f123d35e

8026124: JSR-292 bug: java.nio.file.Path.toString cores dump Summary: catch problem case, assert it matches valid input, new test Reviewed-by: jrose, twisti, kvn
author drchase
date Sat, 12 Oct 2013 17:26:41 -0400
parents ac9cb1d5a202
children 8f4bb1773fd9
line wrap: on
line diff
--- a/src/share/vm/interpreter/linkResolver.cpp	Mon Oct 14 19:30:05 2013 -0700
+++ b/src/share/vm/interpreter/linkResolver.cpp	Sat Oct 12 17:26:41 2013 -0400
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -158,6 +159,22 @@
     index = vt->index_of_miranda(resolved_method->name(),
                                  resolved_method->signature());
     kind = CallInfo::vtable_call;
+  } else if (resolved_method->has_vtable_index()) {
+    // Can occur if an interface redeclares a method of Object.
+
+#ifdef ASSERT
+    // Ensure that this is really the case.
+    KlassHandle object_klass = SystemDictionary::Object_klass();
+    Method * object_resolved_method = object_klass()->vtable()->method_at(index);
+    assert(object_resolved_method->name() == resolved_method->name(),
+      err_msg("Object and interface method names should match at vtable index %d, %s != %s",
+      index, object_resolved_method->name()->as_C_string(), resolved_method->name()->as_C_string()));
+    assert(object_resolved_method->signature() == resolved_method->signature(),
+      err_msg("Object and interface method signatures should match at vtable index %d, %s != %s",
+      index, object_resolved_method->signature()->as_C_string(), resolved_method->signature()->as_C_string()));
+#endif // ASSERT
+
+    kind = CallInfo::vtable_call;
   } else {
     // A regular interface call.
     kind = CallInfo::itable_call;