Open Bug 1232327 Opened 10 years ago Updated 1 year ago

Figure out a way to make JS vector usage require explicitly-selected AllocPolicy for heap-allocated vectors

Categories

(Core :: JavaScript Engine, enhancement, P5)

enhancement

Tracking

()

People

(Reporter: Waldo, Unassigned)

References

(Blocks 1 open bug)

Details

It's quite often a mistake to have js::Vector<T> or js::Vector<T, N> in heap-allocated classes -- in fact it's almost always (always?) an error. We should forbid this somehow. I don't know if clang exposes enough rope for this on template aliases. But if we could tag template aliases MOZ_STACK_CLASS or MOZ_HEAP_CLASS, we could tag js::Vector as MOZ_STACK_CLASS and fork out js::HeapVector (with the AllocPolicy argument mandatory) for use on the heap and be good. If we can't do that immediately, perhaps we could add sufficient clang-plugin support to do it.
I am not sure to understand why this is a mistake, if <N represents the most frequent use cases, while still having support for >>>N cases.
Severity: normal → S3
Blocks: sm-runtime
Severity: S3 → N/A
Type: defect → enhancement
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.