1. 14 1月, 2015 1 次提交
  2. 17 10月, 2014 1 次提交
  3. 06 10月, 2014 2 次提交
  4. 02 10月, 2014 1 次提交
    • T
      This shelveset implements following changes to metadata reference compiler API... · 4fc808ea
      TomasMatousek 提交于
      This shelveset implements following changes to metadata reference compiler API in order to remove duplication in the public surface and prevent users from unexpected metadata lifetime issues:
      
           1) MetadataImageReference and MetadataFileReference overlap
           Currently MetadataImageReference can be constructed from a Stream. MetadataImageReference supports metadata prefetch (reading the blob into memory and close the underlying stream) as well deferred reading (no content is read until the reference is consumed during compilation). MetadataFileReference only supports deferred reading.
      
           Lifetime of MetadataFileReference is non-deterministic, the underlying file is locked until no references exist and we GC the metadata.  On the other hand, it is possible to construct MetadataImageReference in such a way that allows controlling the underlying resources deterministically.
      
           Remove MetadataFileReference, use MetadataImageReference instead.
      
           2) Lifetime management
           AssemblyMetadata and ModuleMetadata objects hold on resources and implement IDisposable. When using MetadataFileReference constructors and some MetadataImageReference constructors to create references the underlying metadata objects are created implicitly and the user doesn’t have a way to explicitly dispose them.
      
           Make MetadataImageReference constructors internal and instead add factory method GetReference on AssemblyMetadata/ModuleMetadata. The usage pattern is:
      
           using (var metadata = AssemblyMetadata.CreateFromXxx(…))
           {
               var compilation = CSharpCompilation.Create(syntaxTrees, new[] { metadata.GetReference() });
               …
           }
      
           In addition the shelveset makes MetadataImageReference internal and adds the following convenience APIs, that are not the most efficient but are very convenient, easy to discover and safe to use for customers that don’t wanna explicitly manage the lifetime of metadata objects. (changeset 1345987)
      4fc808ea
  5. 27 9月, 2014 1 次提交
  6. 26 9月, 2014 1 次提交
    • T
      AssemblyMetadata and ModuleMetadata factories should not read the content of... · 06979fd8
      TomasMatousek 提交于
       AssemblyMetadata and ModuleMetadata factories should not read the content of the PE file/metadata blob.
      
           Currently the factories read the headers, Assembly and Modules tables, which might result in BadImageFormatException being thrown. This exception is not turned into a compilation diagnostic because it happens before the compilation is created. A user of the Roslyn API thus needs to handle these errors in two places (as an exception and as a diagnostics). The content reading should be deferred until the AssemblyMetadata/ModuleMetadata is queried for content.
      
           This change defers metadata/PE headers reading and decoding until the AssemblyMetadata and ModuleMetadata properties/methods are called.
           For metadata created from files it aims to match the usage pattern of other APIs working with FileStream. The metadata factory opens the file, which might throw IO exception, but doesn't start reading the stream until the compiler asks for it, therefore it doesn't throw BadImageFormatException. The functionality is equivalent to the user opening a FileStream and creating metadata from that stream (except for a slight complication with multi-module assemblies, which are rare). Thus the API for metadata creation are consistent among in-memory byte array, stream, and file path.  (changeset 1342462)
      06979fd8
  7. 25 9月, 2014 2 次提交
  8. 15 8月, 2014 3 次提交
  9. 18 7月, 2014 1 次提交
    • T
      Adjusting conditional branches for EnC. · b0615ac8
      TomasMatousek 提交于
      For every conditional branch that consumes a value of an expression that might contain calls to user code and that jumps across user code with sequence points, we need to store the value into a synthesized named local, emit stloc and ldloc and place a hidden sequence point on the ldloc instruction. Furthermore, the synthesized local variable has to be associated with the statement syntax whose lowering produces the conditional branch so that EnC infrastructure can map the local variable defined for the branch to the previous generation.
      
      In essence this is what’s going on:
      
      [|if (F())|]
      { … true … }
      else
      { … false … }
      
      IL:
      call F()
      stloc $value
      <-- hidden sequence point -->
      ldloc $value
      brfalse label_false
      <-- sequence point for “{“ of true-block -->
      … true …
      br label_end
      label_false:
      <-- sequence point for “{“of false-block -->
      … false …
      label_end:
      
      When the call to F() returns after an update has been performed on the caller the code execution continues in the old version of the caller body until a special remapping breakpoint is hit. These breakpoints are put on all sequence points of the method. If we didn’t put the hidden sequence point in front of the conditional branch the execution would continue in the old code until another sequence point is hit. Such a sequence point can be arbitrary (suppose e.g. that the else block of the if statement is deleted by an edit). The debugger only knows how to map IP of active statements in the old IL to an IP in the new IL, not arbitrary sequence points. By inserting the hidden sequence point we force the mapping to be performed at well-defined point that we can map to the new method body.
      
      The presence of the hidden sequence point then implies the need of storing the value of the if-statement condition to a long-lived local and reloading it back right after the sequence point. The store will happen before the IP is remapped and the load will happen in the new frame. The synthesized local must be allocated the same slot in the new frame so that its value is transferred from the old frame to the new frame.
      
      Fixes bug 927151: Edit and Continue breaks If statements while inside the conditional method.
      
      This change also includes an update to the test infrastructure to
      1) make it easier to update failing test that checks for an expected IL
      If a VerifyIL fails it synthesizes a temp file containing the unit test source and prints out a link that launches a diff tool (using ROSLYN_DIFFTOOL environment variable).
      2) to be able to directly test correspondence of sequence points to IL.
      VerifyIL has now an optional argument “sequencePoints”. When specified the printed IL will contain marks that designate presence of sequence points at IL offsets. “-“ for regular sequence point, “~” for hidden sequence points.
      I have updated some tests that are supposed to validate correspondence of sequence points to IL instructions to use this new format.  (changeset 1299447)
      b0615ac8
  10. 20 6月, 2014 1 次提交
  11. 01 4月, 2014 1 次提交
    • T
      Remove Cci.IResource and Cci.IResourceReference types and move ManagedResource... · 6f3a338a
      TomasMatousek 提交于
      Remove Cci.IResource and Cci.IResourceReference types and move ManagedResource class to Microsoft.Cci namespace -- the type doesn't depend on symbols, the indirection thru interfaces is unnecessary.
      Rename AliasForType<T> to TypeExport<T> and move it to Emit namespace -- the type depends on symbols.
      Delete unused code and useless comments on internal types. (changeset 1219205)
      6f3a338a
  12. 27 3月, 2014 1 次提交
    • T
      The goal of this change is to allow specification of multiple aliases for a... · bc3a4be3
      TomasMatousek 提交于
      The goal of this change is to allow specification of multiple aliases for a metadata reference and thus simplify code in services and also allow for moving non-portable part of metadata reference property merging out of the compiler.
           As a byproduct this change fixes 2 bugs in the compiler:
           1) Given two copies of a signed strongly named assembly foo.dll copied in two directories A and B one could trick the compiler to accept an incorrect input for which an error should be reported:
               csc /reference:A\foo.dll /link:B\foo.dll
      
               Currently this just ignored one of the argument (the first one) and embedded interop types. We already reported an error if the references were merged due to paths being the same, but when the identities were the same we just ignored the reference.
               This change reports an error.
           2) <externinfo> custom debug info was only emitted for the first of the extern aliases associated with a metadata reference. We should emit the info for all aliases. I have filed bug 913022 to track a related issue with usings.
      
           Details:
           Currently MetadataReferenceProperties only allow to specify at most one alias for the reference. User can however possible to specify more than one alias both on the command line and in VS.
      
           On command line this is done by repeating the /r argument with the same (normalized) path. A couple of examples:
           1)  csc /r:A=foo.dll csc /r:B=foo.dll
                 Symbols from foo.dll can be referred to via extern aliases A or B.
           2)  csc /r:A=foo.dll csc /r:foo.dll
                 Symbols from foo.dll can be referred to via an extern alias A or without an extern alias.
           3)  csc /r:A=A\..\foo.dll csc /r:B=FOO.DLL
                 Symbols from foo.dll can be referred to via extern aliases A or B. The normalized paths are equal.
      
           In VS the Properties window for a reference has "Aliases" entry where one can type comma separated list of aliases, e.g. "A,B" which corresponds to case 1) above, or "A,global" meaning the same as 2)
           msbuild actually converts these values to multiple references on command line.
      
           Roslyn VS language service currently needs to create and keep track of instances of MetadataReference for each specified alias, which is complicating already complex code dealing with project and metadata references.
      
           The ReferenceManager in the compiler compares normalized paths of metadata references in order to find out that it should merge two metadata references. This change keeps that behavior for now, but enables us to move this logic outside of the compiler to csc.exe/vbc.exe. I'll follow up with that change.
       (changeset 1216193)
      bc3a4be3
  13. 26 3月, 2014 1 次提交
  14. 19 3月, 2014 1 次提交