Le réseau pour les développeurs >
Forums - Accueil
>
Phoenix
>
Null Reference exception when travser a flow graph
Null Reference exception when travser a flow graph
When I execute the above code snippet, I get a null reference exeption at the line marked as "error". The error message says as follows:
foreach (Phx.Unit unit in oldModuleUnit.ChildUnits) { if (unit.IsFunctionUnit) { Phx.FunctionUnit functionUnit = ((Phx.FunctionUnit)unit); Phx.FunctionUnitState raiseToState = Phx.FunctionUnit.LowLevelIRBeforeLayoutFunctionUnitState; functionUnit = oldModuleUnit.Raise(functionUnit.FunctionSymbol, raiseToState); functionUnit.BuildFlowGraph(); Phx.Dataflow.MemoryLivenessWalker walker = Phx.Dataflow.MemoryLivenessWalker.New(functionUnit.Lifetime); walker.Traverse(Phx.Dataflow.TraversalKind.Iterative, functionUnit); //error } }
Phoenix Assertion Failure: d:\enlistments\sdk_june08\src\phx\dataflow\traverser.
cpp, Line 377
this->BlockDataArray != nullptr : Called Walker::Initialize before Traverse
in (Data) <unnamed unit> during IR Unit Function Phases
in (PEModule) F:\tmp1\test\test\bin\Debug\test.exe
in (Program) <unnamed unit>
Phoenix Assertion Failure: d:\enlistments\sdk_june08\src\phx\dataflow\traverser.
cpp, Line 378
this->Direction != Dataflow::Direction::IllegalSentinel
in (Data) <unnamed unit> during IR Unit Function Phases
in (PEModule) F:\tmp1\test\test\bin\Debug\test.exe
in (Program) <unnamed unit>
Can anyone give me some suggestions on why I get such an error message?- Modifiézhong hao lundi 1 juin 2009 08:31
Toutes les réponses
- The assert is trying to tell you that you left out a needed call. But it's worded a little strangely:
this->BlockDataArray != nullptr : Called Walker::Initialize before Traverse
it should really say "you must call Walker.Initialize before you call Walker.Traverse". The fix is thus to add a call walker.Initialize(direction, functionUnit) before you call walker.Traverse. Direction for liveness should be Phx.Dataflow.Direction.Backward.
Architect - Microsoft Phoenix Project - Many thanks. I add such a call to my code. Now I have no assertion errors. However, it still does not work.
It seems that some IR units have no names. How can I build those names?
Phoenix Assertion Failure: d:\enlistments\sdk_june08\gen\rdk\phx\pdl-host\32\gen
-phx-pdl-phx.inl, Line 7155
this->IsFunctionUnit
in (Data) <unnamed unit> during IR Unit Function Phases
in (PEModule) F:\tmp1\test\test\bin\Debug\test.exe
in (Program) <unnamed unit> Make sure your code is only looking at function units (you have such a test in your code sample above). There are other kinds of units, eg DataUnits, that do not contain code.
Architect - Microsoft Phoenix Project

