All pastes #244956 Raw Edit

Untitled

public text v1 · immutable
#244956 ·published 2006-11-10 12:49 UTC
rendered paste body

using System;

public class Hello
{
	public static int AdvanceTime(int timer)
	{
		if(timer > 0) {
			return timer + 1;
			}
		return 0;
	}
	public static int Main()
	{
			int a = 1;
			int b = 5;
			int c = AdvanceTime(a + b);		
			return c;
	}
}

cscc test.cs -o test.exe
ilrun -Z hello.exe
=>

where $Synthetic.$164..ctor is the default constructor

function $Synthetic.$164..ctor(i1 : ptr, i2 : int) : ptr
	incoming_frame_posn(i1, 8)
	incoming_frame_posn(i2, 12)
	store_relative_int(i1, 3273164, 40)
	store_relative_int(i1, 0, 96)
	push_int(i2)
	push_int(i1)
.L2:
	call_external $Synthetic.$164..ctor (0x08063218)
	return_reg(i9, eax)
	i12 = load_relative_int(i1, 56)
	store_relative_int(i1, 1, 96)
	pop_stack(8)
	if ifalse(i12) then goto .L0
.L3:
	push_int(i1)
.L4:
	call_external ILRuntimeHandleManagedSafePointFlags (0x08053820)
	pop_stack(4)
.L0:
	i18 = load_relative_int(i1, 48)
	if ifalse(i18) then goto .L1
.L5:
	store_relative_int(i1, i18, 100)
	store_relative_int(i1, 0, 48)
	throw(i18)
	ends_in_dead
.L1:
	return_int(i9)
	ends_in_dead
end

function $Synthetic.$164..ctor(ptr, int) : ptr

/tmp/libjit-dump.o:     file format elf32-i386

Disassembly of section .text:

00c24018 <.text>:
  c24018:	55                   	push   %ebp
  c24019:	8b ec                	mov    %esp,%ebp
  c2401b:	83 ec 04             	sub    $0x4,%esp
  c2401e:	56                   	push   %esi
  c2401f:	57                   	push   %edi
  c24020:	8b 7d 08             	mov    0x8(%ebp),%edi
  c24023:	c7 47 28 cc f1 31 00 	movl   $0x31f1cc,0x28(%edi)
  c2402a:	c7 47 60 00 00 00 00 	movl   $0x0,0x60(%edi)
  c24031:	ff 75 0c             	pushl  0xc(%ebp)
  c24034:	57                   	push   %edi
  c24035:	e8 de f1 43 07       	call   0x8063218
  c2403a:	8b 4f 38             	mov    0x38(%edi),%ecx
  c2403d:	c7 47 60 01 00 00 00 	movl   $0x1,0x60(%edi)
  c24044:	83 c4 08             	add    $0x8,%esp
  c24047:	89 45 fc             	mov    %eax,0xfffffffc(%ebp)
  c2404a:	0b c9                	or     %ecx,%ecx
  c2404c:	0f 84 09 00 00 00    	je     0xc2405b
  c24052:	57                   	push   %edi
  c24053:	e8 c8 f7 42 07       	call   0x8053820
  c24058:	83 c4 04             	add    $0x4,%esp
  c2405b:	8b 77 30             	mov    0x30(%edi),%esi
  c2405e:	0b f6                	or     %esi,%esi
  c24060:	0f 84 10 00 00 00    	je     0xc24076
  c24066:	89 77 64             	mov    %esi,0x64(%edi)
  c24069:	c7 47 30 00 00 00 00 	movl   $0x0,0x30(%edi)
  c24070:	56                   	push   %esi
  c24071:	e8 f6 e4 51 ff       	call   0x14256c
  c24076:	8b 45 fc             	mov    0xfffffffc(%ebp),%eax
  c24079:	8b 75 f8             	mov    0xfffffff8(%ebp),%esi
  c2407c:	8b 7d f4             	mov    0xfffffff4(%ebp),%edi
  c2407f:	8b e5                	mov    %ebp,%esp
  c24081:	5d                   	pop    %ebp
  c24082:	c3                   	ret    

end

function Hello.Main(i1 : ptr) : int
	incoming_frame_posn(i1, 8)
.L0:
	i3 = 0
	i4 = 0
	i5 = 0
.L1:
.L2:
	i3 = 1
	i4 = 5
	i9 = i3
	i10 = i4
	i11 = i9 + i10
	push_int(i11)
	push_int(i1)
.L3:
	call Hello.AdvanceTime
	return_reg(i12, eax)
	i5 = i12
	i13 = i5
	return_int(i13)
	ends_in_dead
end

function Hello.Main(ptr) : int

/tmp/libjit-dump.o:     file format elf32-i386

Disassembly of section .text:

00c240ba <.text>:
  c240ba:	55                   	push   %ebp
  c240bb:	8b ec                	mov    %esp,%ebp
  c240bd:	53                   	push   %ebx
  c240be:	56                   	push   %esi
  c240bf:	57                   	push   %edi
  c240c0:	33 ff                	xor    %edi,%edi
  c240c2:	33 f6                	xor    %esi,%esi
  c240c4:	33 db                	xor    %ebx,%ebx
  c240c6:	bf 01 00 00 00       	mov    $0x1,%edi
  c240cb:	be 05 00 00 00       	mov    $0x5,%esi
  c240d0:	8b c7                	mov    %edi,%eax
  c240d2:	8b ce                	mov    %esi,%ecx
  c240d4:	03 c1                	add    %ecx,%eax
  c240d6:	50                   	push   %eax
  c240d7:	ff 75 08             	pushl  0x8(%ebp)
  c240da:	e8 8d a4 01 00       	call   0xc3e56c
  c240df:	8b d8                	mov    %eax,%ebx
  c240e1:	8b 5d fc             	mov    0xfffffffc(%ebp),%ebx
  c240e4:	8b 75 f8             	mov    0xfffffff8(%ebp),%esi
  c240e7:	8b 7d f4             	mov    0xfffffff4(%ebp),%edi
  c240ea:	8b e5                	mov    %ebp,%esp
  c240ec:	5d                   	pop    %ebp
  c240ed:	c3                   	ret    

end

function Hello.AdvanceTime(i1 : ptr, i2 : int) : int
	incoming_frame_posn(i1, 8)
	incoming_frame_posn(i2, 12)
.L0:
	i5 = i2
	if i5 <= 0 then goto .L1
.L2:
	i8 = i2
	i10 = i8 + 1
	return_int(i10)
	ends_in_dead
.L1:
	return_int(0)
	ends_in_dead
end

function Hello.AdvanceTime(ptr, int) : int

/tmp/libjit-dump.o:     file format elf32-i386

Disassembly of section .text:

00c2411c <.text>:
  c2411c:	55                   	push   %ebp
  c2411d:	8b ec                	mov    %esp,%ebp
  c2411f:	57                   	push   %edi
  c24120:	8b 7d 0c             	mov    0xc(%ebp),%edi
  c24123:	8b c7                	mov    %edi,%eax
  c24125:	3d 00 00 00 00       	cmp    $0x0,%eax
  c2412a:	0f 8e 0c 00 00 00    	jle    0xc2413c
  c24130:	8b c7                	mov    %edi,%eax
  c24132:	05 01 00 00 00       	add    $0x1,%eax
  c24137:	e9 02 00 00 00       	jmp    0xc2413e
  c2413c:	33 c0                	xor    %eax,%eax
  c2413e:	5f                   	pop    %edi
  c2413f:	5d                   	pop    %ebp
  c24140:	c3                   	ret    

end