@@ -29,6 +29,8 @@ public class TestCompiler : ITraceListener
2929
3030 protected SimLinker linker ;
3131
32+ protected const uint MaxTicks = 500000 ;
33+
3234 public TestCompiler ( BaseTestPlatform platform )
3335 {
3436 this . platform = platform ;
@@ -65,15 +67,27 @@ protected void CompileTestCode()
6567
6668 compiler . Load ( TypeSystem . Load ( moduleLoader . CreateMetadata ( ) ) ) ;
6769
70+ //compiler.Execute();
6871 compiler . Execute ( Environment . ProcessorCount ) ;
6972
7073 linker = compiler . Linker as SimLinker ;
7174
75+ //DumpSymbols();
7276 //simAdapter.SimCPU.Monitor.DebugOutput = true; // DEBUG OPTION
7377
7478 Run < int > ( string . Empty , "Default" , "AssemblyInit" , true ) ;
7579
76- //simAdapter.SimCPU.Monitor.DebugOutput = true; // DEBUG OPTION
80+ simAdapter . SimCPU . Monitor . DebugOutput = true ; // DEBUG OPTION
81+ }
82+
83+ public void DumpSymbols ( )
84+ {
85+ var symbols = simAdapter . SimCPU . Symbols ;
86+
87+ foreach ( var symbol in symbols )
88+ {
89+ Debug . WriteLine ( symbol . Value . ToString ( ) ) ;
90+ }
7791 }
7892
7993 public T Run < T > ( string ns , string type , string method , params object [ ] parameters )
@@ -107,12 +121,12 @@ protected T Run<T>(string ns, string type, string method, bool reset, params obj
107121
108122 platform . PrepareToExecuteMethod ( simAdapter , address , parameters ) ;
109123
110- simAdapter . SimCPU . Monitor . BreakAtTick = simAdapter . SimCPU . Monitor . BreakAtTick + 500000 ; // nothing should take this long
124+ simAdapter . SimCPU . Monitor . BreakAtTick = simAdapter . SimCPU . Monitor . BreakAtTick + MaxTicks ; // nothing should take this long
111125 simAdapter . SimCPU . Execute ( ) ;
112126
113127 if ( simAdapter . SimCPU . Monitor . BreakAtTick == simAdapter . SimCPU . Tick )
114128 {
115- throw new Exception ( "Aborted. Method did not complete under 500000 ticks. " + simAdapter . SimCPU . Tick . ToString ( ) ) ;
129+ throw new Exception ( "Aborted. Method did not complete under " + MaxTicks . ToString ( ) + " ticks. " + simAdapter . SimCPU . Tick . ToString ( ) ) ;
116130 }
117131
118132 if ( runtimeMethod . Signature . ReturnType . IsVoid )
@@ -174,4 +188,4 @@ void ITraceListener.OnNewTraceLog(TraceLog traceLog)
174188 {
175189 }
176190 }
177- }
191+ }
0 commit comments