summaryrefslogtreecommitdiff
path: root/ghc/compiler/ilxGen/Entry.ilx
blob: 674c83141a49aa88b669da90fc62ce8f44dc2933 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
.assembly test { }
.assembly extern 'mscorlib' { }
.assembly extern ilx 'std' { }
// ENTRYPOINT
.class MainMain { 
   .method public static void Main(class [mscorlib]System.String[]) {
       .entrypoint
           ldstr "LOG: *** loading main value"   call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String)
      ldsfld thunk<(func ( /* unit skipped */ ) --> class [std]PrelBase_Z0T)> class Main::'Main_main'

           ldstr "LOG: *** evaluating main value"
           call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) 
      callfunc () --> (func ( /* unit skipped */ ) --> class [std]PrelBase_Z0T)
           ldstr "LOG: *** calling main value"
           call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) 
      // ldunit
      callfunc ( /* unit skipped */ ) --> class [std]PrelBase_Z0T

      pop


// HACK HACK HACK
// Call the "finalizers" for stdin, stdout and stderr, because COM+ doesn't 
// guarantee that finalizers will be run. WE DON'T GUARANTEE TO RUN ANY
// OTHER FINALIZERS...

      ldstr "LOG: ***calling critical finalizers manually in main()"
           call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String)

ldsfld thunk<(func (thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handlezuzu>>) --> (func (/* unit skipped */) --> class [std]PrelBase_Z0T))>  [std]'PrelHandle'::'PrelHandle_stdHandleFinalizzer'
ldsfld thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handle__>>  [std]'PrelHandle'::'PrelHandle_stdin'
      callfunc () (thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handle__>>) --> (func ( /* unit skipped */ ) -->  class [std]PrelBase_Z0T)
      callfunc ( /* unit skipped */ ) --> class [std]PrelBase_Z0T
      pop

ldsfld thunk<(func (thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handlezuzu>>) --> (func (/* unit skipped */) --> class [std]PrelBase_Z0T))>  [std]'PrelHandle'::'PrelHandle_stdHandleFinalizzer'
ldsfld thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handle__>>  [std]'PrelHandle'::'PrelHandle_stdout'
      callfunc () (thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handle__>>) --> (func ( /* unit skipped */ ) -->  class [std]PrelBase_Z0T)
      callfunc ( /* unit skipped */ ) --> class [std]PrelBase_Z0T
      pop

ldsfld thunk<(func (thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handlezuzu>>) --> (func (/* unit skipped */) --> class [std]PrelBase_Z0T))>  [std]'PrelHandle'::'PrelHandle_stdHandleFinalizzer'
ldsfld thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handle__>>  [std]'PrelHandle'::'PrelHandle_stderr'
      callfunc () (thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handle__>>) --> (func ( /* unit skipped */ ) -->  class [std]PrelBase_Z0T)
      callfunc ( /* unit skipped */ ) --> class [std]PrelBase_Z0T
      pop

      ldstr "LOG: exit main()\n"
           call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String)
      ret
   }
}