diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-01-22 16:55:23 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-01-22 16:55:23 +0000 |
commit | daf9227e7323c31257fe34bb4f2d38c7c1abbff1 (patch) | |
tree | fa7f4e59e132cc707e3d767353247edf936e7a94 /src/msil | |
parent | ac9fb6ad28b88ee4e7896c93d26c76e80bd3ece3 (diff) | |
download | scala-daf9227e7323c31257fe34bb4f2d38c7c1abbff1.tar.gz scala-daf9227e7323c31257fe34bb4f2d38c7c1abbff1.tar.bz2 scala-daf9227e7323c31257fe34bb4f2d38c7c1abbff1.zip |
fix several issues in .net backend / type parsing.
Diffstat (limited to 'src/msil')
-rw-r--r-- | src/msil/ch/epfl/lamp/compiler/msil/PEFile.java | 16 | ||||
-rw-r--r-- | src/msil/ch/epfl/lamp/compiler/msil/PEModule.java | 13 |
2 files changed, 23 insertions, 6 deletions
diff --git a/src/msil/ch/epfl/lamp/compiler/msil/PEFile.java b/src/msil/ch/epfl/lamp/compiler/msil/PEFile.java index 459bb39a20..457a1d8c2b 100644 --- a/src/msil/ch/epfl/lamp/compiler/msil/PEFile.java +++ b/src/msil/ch/epfl/lamp/compiler/msil/PEFile.java @@ -854,10 +854,18 @@ public class PEFile { while (getByte() == ELEMENT_TYPE_CMOD_OPT || getByte() == ELEMENT_TYPE_CMOD_REQD) { - Type t = decodeType(); - System.err.println("CMOD: " + t); - if (getByte() == ELEMENT_TYPE_CMOD_REQD) - throw new RuntimeException("Reqired CMOD: " + t); + // skip the tag 23.2.7 + readByte(); + // skip the TypeDefOrRefEncoded (23.2.8) + readByte(); + readByte(); + + // @FIXME: could be 4 bytes, not always 2... + + //Type t = decodeType(); + //System.err.println("CMOD: " + t); + //if (getByte() == ELEMENT_TYPE_CMOD_REQD) + //throw new RuntimeException("Reqired CMOD: " + t); } } diff --git a/src/msil/ch/epfl/lamp/compiler/msil/PEModule.java b/src/msil/ch/epfl/lamp/compiler/msil/PEModule.java index a6e7bb31b2..78c17038cb 100644 --- a/src/msil/ch/epfl/lamp/compiler/msil/PEModule.java +++ b/src/msil/ch/epfl/lamp/compiler/msil/PEModule.java @@ -143,8 +143,17 @@ final class PEModule extends Module { Assembly assem = getAssembly(name); type = assem.GetType(typeName); if (type == null) { - throw new RuntimeException("Failed to locate type " + - typeName + " in assembly " + assem); + // HACK: the IKVM.OpenJDK.Core assembly is compiled against mscorlib.dll v2.0 + // The MSIL library cannot parse the v2.0 mscorlib because of generics, so we + // use the v1.0 + // However, the java.io.FileDescriptor.FlushFileBuffers method uses a type + // Microsoft.Win32.SafeHandles.SafeFileHandle, which only exists in mscorlib + // v2.0 + // For now, jsut return Object (fine as long as we don't use that method). + Assembly asmb = getAssembly("mscorlib"); + type = asmb.GetType("System.Object"); + //throw new RuntimeException("Failed to locate type " + + //typeName + " in assembly " + assem); } break; case ModuleDef.ID: |