File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System ;
22using System . IO ;
3+ using System . Reflection ;
34using System . Runtime ;
45using ScriptCs . Argument ;
56using ScriptCs . Command ;
@@ -13,15 +14,7 @@ internal static class Program
1314 {
1415 private static int Main ( string [ ] args )
1516 {
16- #if ! __MonoCS__
17- try
18- {
19- SetProfile ( ) ;
20- }
21- catch ( TypeLoadException )
22- {
23- }
24- #endif
17+ SetProfile ( ) ;
2518
2619 IConsole console = new ScriptConsole ( ) ;
2720
@@ -93,16 +86,17 @@ private static string[] GetModuleList(string modulesArg)
9386 return modules ;
9487 }
9588
96- #if ! __MonoCS__
97- [ MethodImpl ( MethodImplOptions . NoInlining ) ]
9889 private static void SetProfile ( )
9990 {
100- if ( Type . GetType ( "Mono.Runtime" ) == null )
91+ var profileOptimizationType = Type . GetType ( "System.Runtime.ProfileOptimization" ) ;
92+ if ( profileOptimizationType != null )
10193 {
102- ProfileOptimization . SetProfileRoot ( typeof ( Program ) . Assembly . Location ) ;
103- ProfileOptimization . StartProfile ( typeof ( Program ) . Assembly . GetName ( ) . Name + ".profile" ) ;
94+ var setProfileRoot = profileOptimizationType . GetMethod ( "SetProfileRoot" , BindingFlags . Public | BindingFlags . Static ) ;
95+ setProfileRoot . Invoke ( null , new object [ ] { typeof ( Program ) . Assembly . Location } ) ;
96+
97+ var startProfile = profileOptimizationType . GetMethod ( "StartProfile" , BindingFlags . Public | BindingFlags . Static ) ;
98+ startProfile . Invoke ( null , new object [ ] { typeof ( Program ) . Assembly . GetName ( ) . Name + ".profile" } ) ;
10499 }
105100 }
106- #endif
107101 }
108102}
You can’t perform that action at this time.
0 commit comments