Reviewers: Erik Corry,

Description:
Workaround a gcc 4.4 bug.

Gcc generates wrong vtable entries for certain code pattern. The change
in heap.cc has detailed explanation.


Please review this at http://codereview.chromium.org/147022

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     src/heap.h
   M     src/heap.cc


Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 2255)
+++ src/heap.cc (working copy)
@@ -1257,28 +1257,51 @@
    return true;
  }

+
+void Heap::CreateCEntryStub() {
+  CEntryStub stub;
+  c_entry_code_ = *stub.GetCode();
+}
+
+
+void Heap::CreateCEntryDebugBreakStub() {
+  CEntryDebugBreakStub stub;
+  c_entry_debug_break_code_ = *stub.GetCode();
+}
+
+
+void Heap::CreateJSEntryStub() {
+  JSEntryStub stub;
+  js_entry_code_ = *stub.GetCode();
+}
+
+
+void Heap::CreateJSConstructEntryStub() {
+  JSConstructEntryStub stub;
+  js_construct_entry_code_ = *stub.GetCode();
+}
+
+
  void Heap::CreateFixedStubs() {
    // Here we create roots for fixed stubs. They are needed at GC
    // for cooking and uncooking (check out frames.cc).
    // The eliminates the need for doing dictionary lookup in the
    // stub cache for these stubs.
    HandleScope scope;
-  {
-    CEntryStub stub;
-    c_entry_code_ = *stub.GetCode();
-  }
-  {
-    CEntryDebugBreakStub stub;
-    c_entry_debug_break_code_ = *stub.GetCode();
-  }
-  {
-    JSEntryStub stub;
-    js_entry_code_ = *stub.GetCode();
-  }
-  {
-    JSConstructEntryStub stub;
-    js_construct_entry_code_ = *stub.GetCode();
-  }
+  // gcc-4.4 has problem to generate the correct vtables if the following
+  // functions are inlined. e.g.,
+  // {  CEntryStub stub;
+  //    c_entry_code_ = *stub.GetCode();
+  // }
+  // {  CEntryDebugBreakStub stub;
+  //    c_entry_debug_break_code_ = *stub.GetCode();
+  // }
+  //
+  // Possible gcc bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32327
+  Heap::CreateCEntryStub();
+  Heap::CreateCEntryDebugBreakStub();
+  Heap::CreateJSEntryStub();
+  Heap::CreateJSConstructEntryStub();
  }


Index: src/heap.h
===================================================================
--- src/heap.h  (revision 2255)
+++ src/heap.h  (working copy)
@@ -921,7 +921,15 @@

    static bool CreateInitialMaps();
    static bool CreateInitialObjects();
+
+  // These four Create*EntryStub functions are here because of a gcc-4.4  
bug
+  // that assigns wrong vtable entries.
+  static void CreateCEntryStub();
+  static void CreateCEntryDebugBreakStub();
+  static void CreateJSEntryStub();
+  static void CreateJSConstructEntryStub();
    static void CreateFixedStubs();
+
    static Object* CreateOddball(Map* map,
                                 const char* to_string,
                                 Object* to_number);



--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to