projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #3748 from akoeplinger/fix-rng-monotouch
[mono.git]
/
mcs
/
class
/
PEAPI
/
Code.cs
diff --git
a/mcs/class/PEAPI/Code.cs
b/mcs/class/PEAPI/Code.cs
index af8ae771cfa48247779c2f81463aa9719be4c282..b681a4cf24deabaef67e19b0c29f70ee3f240bf4 100644
(file)
--- a/
mcs/class/PEAPI/Code.cs
+++ b/
mcs/class/PEAPI/Code.cs
@@
-284,7
+284,6
@@
namespace PEAPI {
internal class BranchInstr : Instr {
CILLabel dest;
private bool shortVer = true;
internal class BranchInstr : Instr {
CILLabel dest;
private bool shortVer = true;
- private static readonly byte longInstrOffset = 13;
private int target = 0;
internal BranchInstr(int inst, CILLabel dst) : base(inst)
private int target = 0;
internal BranchInstr(int inst, CILLabel dst) : base(inst)
@@
-359,7
+358,6
@@
namespace PEAPI {
private static readonly ushort MoreSects = 0x8;
private static readonly ushort InitLocals = 0x10;
private static readonly uint FatSize = 12;
private static readonly ushort MoreSects = 0x8;
private static readonly ushort InitLocals = 0x10;
private static readonly uint FatSize = 12;
- private static readonly uint FatWords = FatSize/4;
private static readonly byte FatExceptTable = 0x41;
private static readonly byte SmlExceptTable = 0x01;
private static readonly byte FatExceptTable = 0x41;
private static readonly byte SmlExceptTable = 0x01;
@@
-701,6
+699,7
@@
namespace PEAPI {
exceptions = new ArrayList();
else if (exceptions.Contains(tryBlock)) return;
exceptions.Add(tryBlock);
exceptions = new ArrayList();
else if (exceptions.Contains(tryBlock)) return;
exceptions.Add(tryBlock);
+ tryBlock.ResolveCatchBlocks (metaData);
}
/// <summary>
}
/// <summary>
@@
-975,6
+974,16
@@
namespace PEAPI {
return fatFormat;
}
return fatFormat;
}
+ //Hackish
+ internal void ResolveCatchBlocks (MetaData md)
+ {
+ for (int i=0; i < handlers.Count; i++) {
+ Catch c = handlers [i] as Catch;
+ if (c != null)
+ c.ResolveType (md);
+ }
+ }
+
internal override void Write(FileImage output, bool fatFormat)
{
// Console.WriteLine("writing exception details");
internal override void Write(FileImage output, bool fatFormat)
{
// Console.WriteLine("writing exception details");
@@
-1013,7
+1022,7
@@
namespace PEAPI {
/// </summary>
public class Catch : HandlerBlock {
/// </summary>
public class Catch : HandlerBlock {
-
Class
exceptType;
+
MetaDataElement
exceptType;
/// <summary>
/// Create a new catch clause
/// <summary>
/// Create a new catch clause
@@
-1021,12
+1030,23
@@
namespace PEAPI {
/// <param name="except">the exception to be caught</param>
/// <param name="handlerStart">start of the handler code</param>
/// <param name="handlerEnd">end of the handler code</param>
/// <param name="except">the exception to be caught</param>
/// <param name="handlerStart">start of the handler code</param>
/// <param name="handlerEnd">end of the handler code</param>
- public Catch(Class except, CILLabel handlerStart, CILLabel handlerEnd)
+ public Catch(Class except, CILLabel handlerStart, CILLabel handlerEnd)
+ : base(handlerStart, handlerEnd)
+ {
+ exceptType = except;
+ }
+
+ public Catch(Type except, CILLabel handlerStart, CILLabel handlerEnd)
: base(handlerStart,handlerEnd)
{
exceptType = except;
}
: base(handlerStart,handlerEnd)
{
exceptType = except;
}
+ internal void ResolveType (MetaData md)
+ {
+ exceptType = ((Type) exceptType).GetTypeSpec (md);
+ }
+
internal override void Write(FileImage output, bool fatFormat)
{
base.Write(output,fatFormat);
internal override void Write(FileImage output, bool fatFormat)
{
base.Write(output,fatFormat);
@@
-1274,10
+1294,17
@@
namespace PEAPI {
int tide = 0;
CILInstruction labInstr;
uint offset = 0;
int tide = 0;
CILInstruction labInstr;
uint offset = 0;
+ bool absolute;
- public CILLabel (uint offset)
+
+ public CILLabel (uint offset, bool absolute)
{
this.offset = offset;
{
this.offset = offset;
+ this.absolute = absolute;
+ }
+
+ public CILLabel (uint offset) : this (offset, false)
+ {
}
}
@@
-1310,6
+1337,7
@@
namespace PEAPI {
internal uint GetLabelOffset()
{
internal uint GetLabelOffset()
{
+ if (absolute) return offset;
if (labInstr == null) return 0;
return labInstr.offset + offset;
}
if (labInstr == null) return 0;
return labInstr.offset + offset;
}