Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2007-08-20 Jb Evain <jbevain@novell.com> * mini.c (mono_method_to_ir): throw MethodAccessException and FieldAccessException instead of InvalidProgramException. in mono/mono/metadata: 2007-08-20 Jb Evain <jbevain@novell.com> * class-internals: add definitions for MONO_EXCEPTION_METHOD_ACCESS and MONO_EXCEPTION_FIELD_ACCESS. * debug-helpers.[c|h]: new mono_field_full_name function. in mono/mono/tests: 2007-08-20 Jb Evain <jbevain@novell.com> * field-access.il, method-access.il, Makefile.am: tests for FieldAccessException and MethodAccessException. svn path=/trunk/mono/; revision=84470
- Loading branch information
Showing
10 changed files
with
232 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,79 @@ | |||
.assembly extern mscorlib {} | |||
|
|||
.assembly 'field-access' {} | |||
|
|||
.class public FieldFail extends [mscorlib]System.Object { | |||
|
|||
.field private static string _sfield | |||
|
|||
.field private string _field | |||
|
|||
.method public specialname rtspecialname instance void .ctor() | |||
{ | |||
ldarg.0 | |||
call instance void [mscorlib]System.Object::.ctor() | |||
ret | |||
} | |||
} | |||
|
|||
.class Test { | |||
|
|||
.method static void read_sfield () | |||
{ | |||
ldsfld string FieldFail::_sfield | |||
pop | |||
ret | |||
} | |||
|
|||
.method static void read_field () | |||
{ | |||
.locals (FieldFail ff) | |||
|
|||
newobj instance void FieldFail::.ctor() | |||
stloc ff | |||
ldloc ff | |||
ldfld string FieldFail::_field | |||
pop | |||
ret | |||
} | |||
|
|||
.method static int32 Main () | |||
{ | |||
.entrypoint | |||
|
|||
.try { | |||
call void Test::read_sfield () | |||
br fail | |||
} catch [mscorlib]System.FieldAccessException { | |||
pop | |||
br continue | |||
} catch [mscorlib]System.Exception { | |||
pop | |||
br fail | |||
} | |||
|
|||
continue: | |||
.try { | |||
call void Test::read_field () | |||
br fail | |||
} catch [mscorlib]System.FieldAccessException { | |||
pop | |||
br success | |||
} catch [mscorlib]System.Exception { | |||
pop | |||
br fail | |||
} | |||
|
|||
success: | |||
ldstr "PASS" | |||
call void [mscorlib]System.Console::WriteLine(string) | |||
ldc.i4.0 | |||
ret | |||
|
|||
fail: | |||
ldstr "FAIL" | |||
call void [mscorlib]System.Console::WriteLine(string) | |||
ldc.i4.1 | |||
ret | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,83 @@ | |||
.assembly extern mscorlib {} | |||
|
|||
.assembly 'method-access' {} | |||
|
|||
.class public MethFail extends [mscorlib]System.Object { | |||
|
|||
.method private void foo () | |||
{ | |||
ret | |||
} | |||
|
|||
.method static private void sfoo () | |||
{ | |||
ret | |||
} | |||
|
|||
.method public specialname rtspecialname instance void .ctor() | |||
{ | |||
ldarg.0 | |||
call instance void [mscorlib]System.Object::.ctor() | |||
ret | |||
} | |||
} | |||
|
|||
.class Test { | |||
|
|||
.method static void call_sfoo () | |||
{ | |||
call void MethFail::sfoo () | |||
ret | |||
} | |||
|
|||
.method static void call_foo () | |||
{ | |||
.locals (MethFail mf) | |||
|
|||
newobj instance void MethFail::.ctor() | |||
stloc mf | |||
ldloc mf | |||
call instance void MethFail::foo () | |||
ret | |||
} | |||
|
|||
.method static int32 Main () | |||
{ | |||
.entrypoint | |||
|
|||
.try { | |||
call void Test::call_sfoo () | |||
br fail | |||
} catch [mscorlib]System.MethodAccessException { | |||
pop | |||
br continue | |||
} catch [mscorlib]System.Exception { | |||
pop | |||
br fail | |||
} | |||
|
|||
continue: | |||
.try { | |||
call void Test::call_foo () | |||
br fail | |||
} catch [mscorlib]System.MethodAccessException { | |||
pop | |||
br success | |||
} catch [mscorlib]System.Exception { | |||
pop | |||
br fail | |||
} | |||
|
|||
success: | |||
ldstr "PASS" | |||
call void [mscorlib]System.Console::WriteLine(string) | |||
ldc.i4.0 | |||
ret | |||
|
|||
fail: | |||
ldstr "FAIL" | |||
call void [mscorlib]System.Console::WriteLine(string) | |||
ldc.i4.1 | |||
ret | |||
} | |||
} |