diff src/share/vm/opto/machnode.cpp @ 216:8d191a7697e2

6715633: when matching a memory node the adr_type should not change Summary: verify the adr_type of a mach node was not changed Reviewed-by: rasbold, never
author kvn
date Fri, 20 Jun 2008 11:10:05 -0700
parents ba764ed4b6f2
children 1e026f8da827
line wrap: on
line diff
--- a/src/share/vm/opto/machnode.cpp	Fri Jun 20 10:17:09 2008 -0700
+++ b/src/share/vm/opto/machnode.cpp	Fri Jun 20 11:10:05 2008 -0700
@@ -262,14 +262,16 @@
     // Now we have collected every part of the ADLC MEMORY_INTER.
     // See if it adds up to a base + offset.
     if (index != NULL) {
-      if (!index->is_Con()) {
-        const TypeNarrowOop* narrowoop = index->bottom_type()->isa_narrowoop();
-        if (narrowoop != NULL) {
-          // Memory references through narrow oops have a
-          // funny base so grab the type from the index.
-          adr_type = narrowoop->make_oopptr();
-          return NULL;
-        }
+      const TypeNarrowOop* narrowoop = index->bottom_type()->isa_narrowoop();
+      if (narrowoop != NULL) { // EncodeN, LoadN, LoadConN, LoadNKlass.
+        // Memory references through narrow oops have a
+        // funny base so grab the type from the index:
+        // [R12 + narrow_oop_reg<<3 + offset]
+        assert(base == NULL, "Memory references through narrow oops have no base");
+        offset = disp;
+        adr_type = narrowoop->make_oopptr()->add_offset(offset);
+        return NULL;
+      } else if (!index->is_Con()) {
         disp = Type::OffsetBot;
       } else if (disp != Type::OffsetBot) {
         const TypeX* ti = index->bottom_type()->isa_intptr_t();