From 04e258b02976db0568754f7ae75be6cde8083b48 Mon Sep 17 00:00:00 2001 From: Rick Lavoie Date: Mon, 9 Sep 2019 20:37:10 -0700 Subject: [PATCH] Use jit::deque instead of jit::vector for cached operands in vasm-graph-color Summary: We guarantee that you can hold a reference to the cached operand VregSets indefinitely (since we never delete them). However, since they are stored in jit::vector, we can resize and invalidate references. Fix this by using jit::deque instead (which guarantees references to elements are never invalidated). I'm surprised this was never a problem until now, but with some other changes this started causing problems. Reviewed By: ottoni, mofarrell Differential Revision: D17270519 fbshipit-source-id: a6c740ecbd186117c2adc5f0aaabcbc3cae55ddc --- hphp/runtime/vm/jit/vasm-graph-color.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hphp/runtime/vm/jit/vasm-graph-color.cpp b/hphp/runtime/vm/jit/vasm-graph-color.cpp index 09fbea784e1..ed7dcb2c0a9 100644 --- a/hphp/runtime/vm/jit/vasm-graph-color.cpp +++ b/hphp/runtime/vm/jit/vasm-graph-color.cpp @@ -203,9 +203,10 @@ struct State { std::unordered_multimap loopMembership; // Cached operands. The "id" field in a Vinstr is an index into this - // table. Since 0 means no cached information, the first entry in - // this vector is never used. - jit::vector cachedOperands; + // table. Since 0 means no cached information, the first entry is + // never used. We use a deque to guarantee that references will + // never be invalidated. + jit::deque cachedOperands; // Calculate penalty vectors. Different Vregs may share the same // penalty vector. -- 2.11.4.GIT