Closed
Bug 1319971
Opened 8 years ago
Closed 8 years ago
js\src\ds/OrderedHashTable.h(775): error C2131: expression did not evaluate to a constant when using VS2017 RC
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: m_kato, Assigned: away)
References
()
Details
Attachments
(1 file, 1 obsolete file)
5.42 KB,
patch
|
luke
:
review+
|
Details | Diff | Splinter Review |
When using VS2017 RC, it cannot resolve constexpr of OrderedHashTable.h. c:\development\hg.mozilla.org\mozilla-win64\js\src\ds/OrderedHashTable.h(775): error C2131: expression did not evaluate to a constant c:\development\hg.mozilla.org\mozilla-win64\js\src\ds/OrderedHashTable.h(532): note: failure was caused by non-constant arguments or reference to a non-constant symbol c:\development\hg.mozilla.org\mozilla-win64\js\src\ds/OrderedHashTable.h(532): note: see usage of 'js::detail::OrderedHashTable<js::OrderedHashMap<js::HashableValue,js::HeapPtr<JS::Value>,js::HashableValue::Hasher,js::RuntimeAllocPolicy>::Entry,js::OrderedHashMap<js::HashableValue,js::HeapPtr<JS::Value>,js::HashableValue::Hasher,js::RuntimeAllocPolicy>::MapOps,AllocPolicy>::Data::element' with [ AllocPolicy=js::RuntimeAllocPolicy ] c:/Development/hg.mozilla.org/mozilla-win64/js/src/jit/CodeGenerator.cpp(6394): note: see reference to function template instantiation 'void js::jit::RangePopFront<OrderedHashTable>(js::jit::MacroAssembler &,js::jit::Register,js::jit::Register,js::jit::Register,js::jit::Register)' being compiled with [ OrderedHashTable=js::ValueMap ] c:/Development/hg.mozilla.org/mozilla-win64/js/src/jit/CodeGenerator.cpp(6419): note: see reference to function template instantiation 'void js::jit::CodeGenerator::emitGetNextEntryForIterator<js::MapIteratorObject,js::ValueMap>(js::jit::LGetNextEntryForIterator *)' being compiled c:\development\hg.mozilla.org\mozilla-win64\js\src\ds/OrderedHashTable.h(794): note: see reference to class template instantiation 'js::detail::OrderedHashTable<T,js::OrderedHashSet<T,js::HashableValue::Hasher,js::RuntimeAllocPolicy>::SetOps,AllocPolicy>' being compiled with [ T=js::HashableValue, AllocPolicy=js::RuntimeAllocPolicy ] : :
Reporter | ||
Comment 1•8 years ago
|
||
Reported https://connect.microsoft.com/VisualStudio/feedback/details/3113051
Reporter | ||
Comment 2•8 years ago
|
||
new URL: https://developercommunity.visualstudio.com/content/problem/22196/static-assert-cannot-compile-constexprs-method-tha.html
Here's a simple patch that converts static_assert to MOZ_ASSERT. I considered adding something like a JS_OFFSETOF_ASSERT and letting that happen at compile-time everywhere except VS2017, but it felt like overkill. Let me know if you disagree.
Attachment #8844711 -
Flags: review?(luke)
Comment 4•8 years ago
|
||
From my brief reading of the bug, it looks like the issue is offsetof-in-a-constexpr-method and so a static_assert of just an offsetof would work. If that's right, then perhaps we could just move the static_asserts to be inside the relevant classes where they can name the private fields directly instead of going through a constexpr method. I kinda like having the static_asserts next to the definition for readability, so I think this would be preferable.
(In reply to Luke Wagner [:luke] from comment #4) > From my brief reading of the bug, it looks like the issue is > offsetof-in-a-constexpr-method and so a static_assert of just an offsetof > would work. Oh, good point. I had assumed that all compile-time things were busted with offsetof in VS2017, but it looks like that's not the case. Nicer patch coming up!
Assignee: nobody → dmajor
Attachment #8844711 -
Attachment is obsolete: true
Attachment #8844711 -
Flags: review?(luke)
Attachment #8845162 -
Flags: review?(luke)
Comment 7•8 years ago
|
||
Comment on attachment 8845162 [details] [diff] [review] Use offsetof directly Review of attachment 8845162 [details] [diff] [review]: ----------------------------------------------------------------- Thanks! ::: js/src/jit/CodeGenerator.cpp @@ -6464,5 @@ > { > masm.loadPtr(Address(range, ValueMap::Range::offsetOfHashTable()), front); > masm.loadPtr(Address(front, ValueMap::offsetOfImplData()), front); > > - static_assert(ValueMap::offsetOfImplDataElement() == 0, "offsetof(Data, element) is 0"); These static asserts are also useful for locally reasoning about the following codegen, so could you turn them into MOZ_ASSERT()s (keeping the new static asserts).
Attachment #8845162 -
Flags: review?(luke) → review+
Pushed by dmajor@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/261a33fad371 Re-work some static_asserts to get VS2017 compiling. r=luke
Comment 9•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/261a33fad371
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Updated•8 years ago
|
status-firefox53:
affected → ---
You need to log in
before you can comment on or make changes to this bug.
Description
•