summaryrefslogtreecommitdiff
path: root/tests/src/baseservices/exceptions/regressions/V1/SEH/asm/FiltFallThru.il
blob: 57f32f00e0fe09c392098f0c3a633da6d1ddd805 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

//
// FiltFallThru.asm
// Revised 4.01.99 by t-joecl
//
// Apply filters that don't trap an exception, then catch it in an
// outer .exception aHandler.
//
.assembly extern legacy library mscorlib{}
.assembly extern System.Console
{
  .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
  .ver 4:0:0:0
}

.assembly FiltFallThru{}

.class		FiltFallThru {

// global for storing return value - defaults to 0 for success


//    .data iResult = int32(0x00000000)
.field static int32 iResult

// Execution starts here

.method static	int32 main(class [mscorlib]System.String[]) {
.locals(string)
.entrypoint
.maxstack	2

	ldstr "Done"
	stloc.0
.try{
    .try{
	try_start:
		newobj instance void [mscorlib]System.Security.SecurityException::.ctor()
		throw	
		try_end:
		// Error case 4 - exception _not thrown
		ldstr	"Error case 4 - exception _not thrown"


		call void [System.Console]System.Console::WriteLine(class System.String)
		ldc.i4		0x4
		stsfld int32 FiltFallThru::iResult
		leave ENDOFTEST
	}

	// aFilter two exceptions that won't be encountered;
	// let them fall through. 
	filter{
	OOMfilter:
		isinst	[mscorlib]System.OutOfMemoryException
		leave	OOMcontinue

		// Error case 2 - aFilter failure: filtered the wrong exception
		ldstr	"Error case 2 - aFilter failure: filtered the wrong exception"


		call void [System.Console]System.Console::WriteLine(class System.String)
		ldc.i4		0x2
		stsfld int32 FiltFallThru::iResult
		ldnull
		leave	OOMendfilter
		OOMcontinue:
		ldnull
		OOMendfilter:

		AEfilter:
		isinst	[mscorlib]System.ArithmeticException
		leave	AEcontinue

		// Error case 2 - aFilter failure: filtered the wrong exception
		ldstr	"Error case 2 - aFilter failure: filtered the wrong exception"


		call void [System.Console]System.Console::WriteLine(class System.String)
		ldc.i4		0x2
		stsfld int32 FiltFallThru::iResult
		ldc.i4  0x00000001
		leave	AEendfilter
		AEcontinue:
		ldc.i4  0x00000000
		AEendfilter:
		endfilter
	}
	{
	FILThandler:
		pop
		//	isinst	System.ArithmeticException
		//	brfalse	FILTcontinue
		//	br FILTcontinue
	FILTcontinue:
		// Error case 3 - running aHandler for the wrong aFilter
		ldstr	"Error case 3 - running aHandler for the wrong aFilter"


		call void [System.Console]System.Console::WriteLine(class System.String)
		ldc.i4		0x3
		stsfld int32 FiltFallThru::iResult
		leave ENDFILThandler
	ENDFILThandler:
		leave ENDOFTEST

	FILThandler1:
		pop
	//	isinst	System.ArithmeticException
	//	brfalse	FILTcontinue1
	//	br FILTcontinue1
	FILTcontinue1:
	// Error case 3 - running aHandler for the wrong aFilter
		ldstr	"Error case 3 - running aHandler for the wrong aFilter"
		call void [System.Console]System.Console::WriteLine(class System.String)
		ldc.i4		0x3
		stsfld int32 FiltFallThru::iResult
		leave ENDFILThandler1
	ENDFILThandler1:
	leave ENDOFTEST
      }
}

catch [mscorlib]System.Security.SecurityException{
SEChandler:
	isinst	[mscorlib]System.Security.SecurityException
	brfalse	handler_fail
	br end_handler

handler_fail:
	// Error case 1 - aHandler failure: trapped the wrong exception
	ldc.i4		0x1
	stsfld int32 FiltFallThru::iResult
	ldstr	"Error case 1 - aHandler failure: trapped the wrong exception"


    	call void [System.Console]System.Console::WriteLine(class System.String)
end_handler:
	leave ENDOFTEST
}
ENDOFTEST:
	ldsfld int32 FiltFallThru::iResult
	ldc.i4		0
	ceq
	brfalse		RETFAIL
	ldstr	"Test succeeded (returning 100)."


    	call void [System.Console]System.Console::WriteLine(class System.String)
	ldc.i4	0x64
	br RETEND
RETFAIL:
	ldstr	"Test FAILED."


    	call void [System.Console]System.Console::WriteLine(class System.String)
	ldsfld int32 FiltFallThru::iResult
RETEND:
	ldloc.0
    	call void [System.Console]System.Console::WriteLine(class System.String)
	ret

}
}