internal void mergeJECGTT(JI j, JECAKey key, JECGTT jecFrom, JECGTT jecTo, Action <GTTI> enqueuePropagateGTTI, Action <GTTI, GTTI> enqueueMergeGTTI) { Debug.Assert(jecFrom != jecTo); Debug.Assert(jecFrom.jecgtT.SequenceEqual(jecTo.jecgtT)); Debug.Assert(makeJECGTTKey(j, jecTo.jecgtT) == key); if (jecFrom.CompareTo(jecTo) < 0) { FU.swap(ref jecFrom, ref jecTo); } gtts.mergeJECInt(j, jecFrom, jecTo, enqueuePropagateGTTI, enqueueMergeGTTI); #if DEBUG if (jecgtTBreakCondition(j, jecTo.jecgtT)) { Debugger.Break(); } if (jecgtTBreakCondition(j, jecFrom.jecgtT)) { Debugger.Break(); } #endif Debug.Assert(jecTKeyToJECGTT[j][key] == jecFrom || jecTKeyToJECGTT[j][key] == jecTo); if (jecTKeyToJECGTT[j][key] == jecFrom) { removeJECTKeyInt(j, key); setJECTKeyInt(j, key, jecTo); } }
private JGTTSD mapJECTGTT(JI j, JECGTT jecGTTECX, JECGTT jecGTTECY) { Debug.Assert(jn == 2); var jecA = (j == 0) ? new[] { jecGTTECX, jecGTTECY } : new[] { jecGTTECY, jecGTTECX }; return(mapJECGTTA(jecA)); }
protected void mapNewJGTTInt(JI j, JECGTT jec, GTT jgtt) { Debug.Assert(!gttSS.hasJT(j, jgtt)); gttSS.mapNewJTToJECInt(j, jgtt, jec);//JoinTemplateMaker.mapNewJGTTInt foreach (var gtti in jec.tis) { enqueuePropagateGTTI(gtti); } }
private void remapJECGTT(JI j, JECGTT sJECGTT, JECGT jecFrom, JECGT jecTo, Action <GTTI> enqueuePropagateGTTI, Action <GTTI, GTTI> enqueueMergeGTTI) { if (!sJECGTT.jecgtT.Contains(jecFrom)) { return; } #if DEBUG if (jecgtTBreakCondition(j, sJECGTT.jecgtT)) { Debugger.Break(); } #endif var oldKey = makeJECGTTKey(j, sJECGTT.jecgtT); var newECIs = (from jecGT in sJECGTT.jecgtT select(jecGT == jecFrom) ? jecTo : jecGT).ToArray(); var newKey = makeJECGTTKey(j, newECIs); #if DEBUG if (jecgtTBreakCondition(j, newECIs)) { Debugger.Break(); } #endif #if DEBUG if (jecgtTBreakCondition(j, sJECGTT.jecgtT)) { Debugger.Break(); } #endif Debug.Assert(oldKey != newKey); sJECGTT.updateJECGTA(newECIs); Debug.Assert(!jecTKeyToJECGTT[j].ContainsKey(oldKey) || jecTKeyToJECGTT[j][oldKey] == sJECGTT); removeJECTKeyInt(j, oldKey); Debug.Assert(!jecTKeyToJECGTT[j].ContainsKey(oldKey)); JECGTT oJECGTT; if (jecTKeyToJECGTT[j].TryGetValue(newKey, out oJECGTT)) { mergeJECGTT(j, newKey, oJECGTT, sJECGTT, enqueuePropagateGTTI, enqueueMergeGTTI); } else { Debug.Assert(!jecTKeyToJECGTT[j].ContainsKey(newKey)); setJECTKeyInt(j, newKey, sJECGTT); completeJECGTTJGTTs(j, sJECGTT); foreach (var gtti in sJECGTT.tis) { if (gtts.getTD(gtti).isAnyUpdated) { enqueuePropagateGTTI(gtti); } } } }
private void completeJECGTTJGTTs(JI j, JECGTT jec) { var jgtts = ju.makeJGTTs(j, from jecgtt in jec.jecgtT select new HashSet <GT>(from cjgt in jecgtt.jts select pus[j].transitiveMerge(cjgt))); foreach (var jgtt in jgtts) { if (gtts.hasJT(j, jgtt)) { } // Debug.Assert(gtts.getJTJEC(j, jgtt) == jec); else { gtts.mapNewJTToJECInt(j, jgtt, jec);//JSourceStructure.completeJECGTTJGTTs } } }
internal JECGTT makeNewJECGTTInt(JI j, JECGT[] jecgtT, JECAKey key) { #if DEBUG Debug.Assert(key == makeJECGTTKey(j, jecgtT)); #endif var jec = new JECGTT(jecgtT); #if DEBUG if (jecgtTBreakCondition(j, jecgtT)) { Debugger.Break(); } #endif setJECTKeyInt(j, key, jec); return(jec); }
private void setJECTKeyInt(JI j, JECITKey key, JECGTT jec) { Debug.Assert(!jecTKeyToJECGTT[j].ContainsKey(key)); jecTKeyToJECGTT[j][key] = jec; }
protected sealed override void propagateDownGTISources(JGTSD gtd) { if (gtd.depth != minDepth && gtd.depth != topDepth) { Debug.Assert(jn == 1 || jn == 2); if (jn == 1) { Debug.Assert(js.Length == 1 && js[0] == 0); var j = 0; if (gtd.njgts(j).Any() || gtd.isDepthDownUpdated) { var ujgts = (gtd.isDepthDownUpdated) ? gtd.jgts(j) : gtd.njgts(j); foreach (var njgt in ujgts) { foreach (var njgfa in njgt.gfas) { if (universe.inScope(njgfa.function)) { var f = njgfa.function; var dd = (gtd.depth >= 0) ? -1 : gtd.depth - 1; var gttd = map1JGTT(njgfa.gtt); mapGFA(gtd, f, gttd); } } } } } else {//TODO exclude pairs that are checked twice njgt x ngfa + njgt x njgt Debug.Assert(jn == 2); foreach (var j in js) { var X = j; var njgtsX = gtd.njgts(X); if (!njgtsX.Any() && !gtd.isDepthDownUpdated) { continue; } var jgtECX = gtd.jec(X); var ujgts = (gtd.isDepthDownUpdated) ? jgtECX.jts : gtd.njgts(X); var Y = 1 - j; var jgtECY = gtd.jec(Y); foreach (var njgt in ujgts) { foreach (var njgfa in njgt.gfas) { var f = njgfa.function; var jgttX = njgfa.gtt; var jgfasY = jgtECY.jgfas(f); JECGTT gttECX = null; foreach (var jgfaY in jgfasY) { if (gttECX == null) { gttECX = mapJGTTEC(X, jgttX); } var gttECY = mapJGTTEC(Y, jgfaY.gtt); var gttd = mapJECTGTT(X, gttECX, gttECY); mapGFA(gtd, f, gttd); } foreach (var gtti in gtd.getGFAs(f).ToList()) { if (gttECX == null) { gttECX = mapJGTTEC(X, jgttX); } var gttECY = getGTTIEC(Y, gtti); var gttd = mapJECTGTT(X, gttECX, gttECY); mapGFA(gtd, f, gttd); } } } } } } gtd.clearNewSources(); }