Closed Bug 1195972 Opened 9 years ago Closed 8 years ago

js::ctypes::FieldInfo is only valid on the heap, but is allocated on the stack

Categories

(Core :: JavaScript: GC, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: nika, Unassigned)

References

Details

js/src/ctypes/CTypes.cpp:5565:7: error: variable of type 'js::ctypes::FieldInfo' only valid on the heap
      FieldInfo info;
      ^
js/src/ctypes/CTypes.cpp:5565:7: note: value incorrectly allocated in an automatic variable
js/src/ctypes/CTypes.h:236:23: note: 'js::ctypes::FieldInfo' is a heap type because member 'mType' is a heap type 'JS::Heap<JSObject *>'
  JS::Heap<JSObject*> mType;    // CType of the field
                      ^
Related:

../../dist/include/js/HashTable.h:1696:9: warning: variable of type 'typename HashTableEntry<HashMapEntry<JSFlatString *, FieldInfo> >::NonConstT' (aka 'js::HashMapEntry<JSFlatString *, js::ctypes::FieldInfo>') only valid on the heap
        typename HashTableEntry<T>::NonConstT t(mozilla::Move(*p));
        ^
../../dist/include/js/HashTable.h:1696:9: note: value incorrectly allocated in an automatic variable
../../dist/include/js/HashTable.h:650:11: note: 'typename HashTableEntry<HashMapEntry<JSFlatString *, FieldInfo> >::NonConstT' (aka 'js::HashMapEntry<JSFlatString *, js::ctypes::FieldInfo>') is a heap type because member 'value_' is a heap type 'js::ctypes::FieldInfo'
    Value value_;
          ^
js/src/ctypes/CTypes.h:236:23: note: 'js::ctypes::FieldInfo' is a heap type because member 'mType' is a heap type 'JS::Heap<JSObject *>'
  JS::Heap<JSObject*> mType;    // CType of the field
                      ^
Part of the problem is that HashTable::rekeyWithoutRehash() constructs a hash table entry on the stack.  It might be possible to rework it to avoid doing that, or maybe we can get rid of rekeying when entirely Terrence's work on giving objects stable hash codes lands.
Has there been any progress on getting rid of this problem?
(In reply to Michael Layzell [:mystor] from comment #3)
Work on this is progressing, but we're not there yet.  Needinfo'ing myself to remind me to check back later.
Flags: needinfo?(jcoppeard)
Closing as per bug 1195568 comment 6.
Status: NEW → RESOLVED
Closed: 8 years ago
Flags: needinfo?(jcoppeard)
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.