public void Transform() { var ppr = new PtrPrimitiveReplacer(factory, store, program, eventListener); ppr.ReplaceAll(); var cpa = new ConstantPointerAnalysis(factory, store, program); cpa.FollowConstantPointers(); int iteration = 0; do { if (eventListener.IsCanceled()) { return; } ++iteration; if (iteration > 50) { eventListener.Warn( string.Format("Type transformer has looped {0} times, quitting prematurely.", iteration)); return; } Changed = false; visitedTypes.Clear(); foreach (TypeVariable tv in store.TypeVariables) { if (eventListener.IsCanceled()) { return; } EquivalenceClass eq = tv.Class; if (eq.DataType != null) { DateTime start = DateTime.Now; eq.DataType = eq.DataType.Accept(this); DateTime end = DateTime.Now; if (eq.DataType is UnionType ut) { //trace.Verbose("= TT: took {2,4} msec to simplify {0} ({1})", tv.DataType, eq.DataType, (end - start).Milliseconds); } } if (tv.DataType != null) { tv.DataType = tv.DataType.Accept(this); } // Debug.Print("Transformed {0}:{1}", tv, tv.Class.DataType); } if (ppr.ReplaceAll()) { Changed = true; } if (NestedComplexTypeExtractor.ReplaceAll(factory, store)) { Changed = true; } } while (Changed); }
public void Transform() { var ppr = new PtrPrimitiveReplacer(factory, store, program); ppr.ReplaceAll(eventListener); var cpa = new ConstantPointerAnalysis(factory, store, program); cpa.FollowConstantPointers(); int iteration = 0; do { if (eventListener.IsCanceled()) { return; } ++iteration; if (iteration > 50) { eventListener.Warn(new NullCodeLocation(""), string.Format("Type transformer has looped {0} times, quitting prematurely.", iteration)); return; } Changed = false; this.visitedTypes = new HashSet <DataType>(); foreach (TypeVariable tv in store.TypeVariables) { if (eventListener.IsCanceled()) { return; } tvCur = tv; EquivalenceClass eq = tv.Class; if (eq.DataType != null) { eq.DataType = eq.DataType.Accept(this); } if (tv.DataType != null) { tv.DataType = tv.DataType.Accept(this); } // Debug.Print("Transformed {0}:{1}", tv, tv.Class.DataType); } if (ppr.ReplaceAll(eventListener)) { Changed = true; } if (NestedComplexTypeExtractor.ReplaceAll(factory, store)) { Changed = true; } } while (Changed); }