[interp] Reduce computation under calc_section mutex
[mono-project.git] / README.md
blob5cdbd38762d6e55e639a36e3cae348b60739eae2
1 Mono is a software platform designed to allow developers to easily
2 create cross platform applications.  It is an open source
3 implementation of Microsoft's .NET Framework based on the ECMA
4 standards for C# and the Common Language Runtime.
6 The Mono project is part of the [.NET Foundation](https://www.dotnetfoundation.org/)
8 [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mono/mono?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
10 1. [Compilation and Installation](#compilation-and-installation)
11 2. [Using Mono](#using-mono)
12 3. [Directory Roadmap](#directory-roadmap)
13 4. [Contributing to Mono](#contributing-to-mono)
14 5. [Reporting bugs](#reporting-bugs)
15 6. [Configuration Options](#configuration-options)
16 7. [Working with Submodules](#working-with-submodules)
18 ### Build Status
20 | OS           | Architecture       | Status                       |
21 |--------------|--------------------|------------------------------|
22 | Debian 9     | amd64              | [![debian-9-amd64][1]][2]    |
23 | Debian 9     | i386               | [![debian-9-i386][3]][4]     |
24 | Debian 9     | armel              | [![debian-9-armel][5]][6]    |
25 | Debian 9     | armhf              | [![debian-9-armhf][7]][8]    |
26 | Debian 9     | arm64              | [![debian-9-arm64][9]][10]   |
27 | OS X         | amd64              | [![osx-amd64][11]][12]       |
28 | OS X         | i386               | [![osx-i386][13]][14]        |
29 | Windows      | amd64              | [![windows-amd64][15]][16]   |
30 | Windows      | i386               | [![windows-i386][17]][18]    |
31 | CentOS       | s390x (cs)         | [![centos-s390x][19]][20]    |
32 | Debian 9     | ppc64el (cs)       | [![debian-9-ppc64el][21]][22]|
33 | AIX          | ppc64 (cs)         | [![aix-ppc64][23]][24]       |
35 _(cs) = community supported architecture_
37 [1]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-amd64/badge/icon
38 [2]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-amd64
39 [3]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-i386/badge/icon
40 [4]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-i386/
41 [5]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armel/badge/icon
42 [6]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armel/
43 [7]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armhf/badge/icon
44 [8]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armhf/
45 [9]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-arm64/badge/icon
46 [10]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-arm64/
47 [11]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/badge/icon
48 [12]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/
49 [13]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/badge/icon
50 [14]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/
51 [15]: https://jenkins.mono-project.com/job/z/label=w64/badge/icon
52 [16]: https://jenkins.mono-project.com/job/z/label=w64/
53 [17]: https://jenkins.mono-project.com/job/z/label=w32/badge/icon
54 [18]: https://jenkins.mono-project.com/job/z/label=w32/
55 [19]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=centos-s390x/badge/icon
56 [20]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=centos-s390x
57 [21]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-9-ppc64el/badge/icon
58 [22]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-9-ppc64el
59 [23]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64/badge/icon
60 [24]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64
62 Compilation and Installation
63 ============================
65 Building the Software
66 ---------------------
68 Please see our guides for building Mono on
69 [Mac OS X](https://www.mono-project.com/docs/compiling-mono/mac/),
70 [Linux](https://www.mono-project.com/docs/compiling-mono/linux/) and 
71 [Windows](https://www.mono-project.com/docs/compiling-mono/windows/).
73 Note that building from Git assumes that you already have Mono installed,
74 so please download and [install the latest Mono release](https://www.mono-project.com/download/)
75 before trying to build from Git. This is required because the Mono build
76 relies on a working Mono C# compiler to compile itself
77 (also known as [bootstrapping](https://en.wikipedia.org/wiki/Bootstrapping_(compilers))).
79 If you don't have a working Mono installation
80 ---------------------------------------------
82 If you don't have a working Mono installation, you can try a slightly
83 more risky approach: getting the latest version of the 'monolite' distribution,
84 which contains just enough to run the 'mcs' compiler. You do this with:
86     # Run the following line after ./autogen.sh
87     make get-monolite-latest
89 This will download and place the files appropriately so that you can then
90 just run:
92     make
94 The build will then use the files downloaded by `make get-monolite-latest`.
96 Testing and Installation
97 ------------------------
99 You can run the mono and mcs test suites with the command: `make check`.
101 Expect to find a few test suite failures. As a sanity check, you
102 can compare the failures you got with [https://jenkins.mono-project.com/](https://jenkins.mono-project.com/).
104 You can now install mono with: `make install`
106 You can verify your installation by using the mono-test-install
107 script, it can diagnose some common problems with Mono's install.
108 Failure to follow these steps may result in a broken installation. 
110 Using Mono
111 ==========
113 Once you have installed the software, you can run a few programs:
115 * `mono program.exe` runtime engine
117 * `mcs program.cs` C# compiler
119 * `monodis program.exe` CIL Disassembler
121 See the man pages for mono(1), mcs(1) and monodis(1) for further details.
123 Directory Roadmap
124 =================
126 * `acceptance-tests/` - Optional third party test suites used to validate Mono against a wider range of test cases.
128 * `data/` - Configuration files installed as part of the Mono runtime.
130 * `docs/` - Technical documents about the Mono runtime.
132 * `external/` - Git submodules for external libraries (Newtonsoft.Json, ikvm, etc).
134 * `ikvm-native/` - Glue code for ikvm.
136 * `libgc/` - The (deprecated) Boehm GC implementation.
138 * `llvm/` - Utility Makefiles for integrating the Mono LLVM fork.
140 * `m4/` - General utility Makefiles.
142 * `man/` - Manual pages for the various Mono commands and programs.
144 * `mcs/` - The class libraries, compiler and tools
146   * `class/` - The class libraries (like System.*, Microsoft.Build, etc.)
148   * `mcs/` - The Mono C# compiler written in C#
150   * `tools/` - Tools like gacutil, ikdasm, mdoc, etc.
152 * `mono/` - The core of the Mono Runtime.
154   * `arch/` - Architecture specific portions.
156   * `benchmark/` - A collection of benchmarks.
158   * `btls/` - Build files for the BTLS library which incorporates BoringSSL.
160   * `cil/` - Common Intermediate Representation, XML
161 definition of the CIL bytecodes.
163   * `dis/` - CIL executable Disassembler.
165   * `eglib/` - Independent implementation of the glib API.
167   * `metadata/` - The object system and metadata reader.
169   * `mini/` - The Just in Time Compiler.
171   * `profiler/` - The profiler implementation.
173   * `sgen/` - The SGen Garbage Collector implementation.
175   * `tests/` - The main runtime tests.
177   * `unit-tests/` - Additional runtime unit tests.
179   * `utils/` - Utility functions used across the runtime codebase.
181 * `msvc/` - Logic for the MSVC / Visual Studio based runtime and BCL build system.
182 The latter is experimental at the moment.
184 * `packaging/` - Packaging logic for the OS X and Windows Mono packages.
186 * `po/` - Translation files.
188 * `runtime/` - A directory that contains the Makefiles that link the
189 mono/ and mcs/ build systems.
191 * `samples/` - Some simple sample programs on uses of the Mono
192 runtime as an embedded library.
194 * `scripts/` - Scripts used to invoke Mono and the corresponding program.
196 * `sdks/` - A new way of embedding Mono into Xamarin.iOS, Xamarin.Android and other products.
198 * `support/` - Various support libraries.
200 * `tools/` - A collection of tools, mostly used during Mono development.
202 Contributing to Mono
203 ====================
205 Before submitting changes to Mono, please review the [contribution
206 guidelines](https://www.mono-project.com/community/contributing/).
207 Please pay particular attention to the [Important
208 Rules](https://www.mono-project.com/community/contributing/#important-rules)
209 section.
211 Reporting bugs
212 ==============
214 To submit bug reports, please [open an issue on the mono GitHub repo](https://github.com/mono/mono/issues/new).
216 Please use the search facility to ensure the same bug hasn't already
217 been submitted and follow our
218 [guidelines](https://www.mono-project.com/community/bugs/make-a-good-bug-report/)
219 on how to make a good bug report.
221 Configuration Options
222 =====================
224 The following are the configuration options that someone building Mono
225 might want to use:
227 * `--with-sgen=yes,no` - Generational GC support: Used to enable or
228 disable the compilation of a Mono runtime with the SGen garbage
229 collector.
231   * On platforms that support it, after building Mono, you will have
232 both a `mono-boehm` binary and a `mono-sgen` binary. `mono-boehm` uses Boehm,
233 while `mono-sgen` uses the Simple Generational GC.
235 * `--with-libgc=[included, none]` - Selects the default Boehm
236 garbage collector engine to use.
238   * *included*: (*slightly modified Boehm GC*) This is the default
239 value for the Boehm GC, and it's the most feature complete, it will
240 allow Mono to use typed allocations and support the debugger.
242   * *none*:
243 Disables the inclusion of a Boehm garbage collector.
245   * This defaults to `included`.
247 * `--enable-cooperative-suspend`
249   * If you pass this flag the Mono runtime is configured to only use
250   the cooperative mode of the garbage collector.  If you do not pass
251   this flag, then you can control at runtime the use of the
252   cooperative GC mode by setting the `MONO_ENABLE_COOP_SUSPEND` flag.
253   
254 * `--with-tls=__thread,pthread`
256   * Controls how Mono should access thread local storage,
257 pthread forces Mono to use the pthread APIs, while
258 __thread uses compiler-optimized access to it.
260   * Although __thread is faster, it requires support from
261 the compiler, kernel and libc. Old Linux systems do
262 not support with __thread.
264   * This value is typically pre-configured and there is no
265 need to set it, unless you are trying to debug a problem.
267 * `--with-sigaltstack=yes,no`
269   * **Experimental**: Use at your own risk, it is known to
270 cause problems with garbage collection and is hard to
271 reproduce those bugs.
273   * This controls whether Mono will install a special
274 signal handler to handle stack overflows. If set to
275 `yes`, it will turn stack overflows into the
276 StackOverflowException. Otherwise when a stack
277 overflow happens, your program will receive a
278 segmentation fault.
280   * The configure script will try to detect if your
281 operating system supports this. Some older Linux
282 systems do not support this feature, or you might want
283 to override the auto-detection.
285 * `--with-static_mono=yes,no`
287   * This controls whether `mono` should link against a
288 static library (libmono.a) or a shared library
289 (libmono.so). 
291   * This defaults to `yes`, and will improve the performance
292 of the `mono` program. 
294   * This only affects the `mono' binary, the shared
295 library libmono.so will always be produced for
296 developers that want to embed the runtime in their
297 application.
299 * `--with-xen-opt=yes,no` - Optimize code for Xen virtualization.
301   * It makes Mono generate code which might be slightly
302 slower on average systems, but the resulting executable will run
303 faster under the Xen virtualization system.
305   * This defaults to `yes`.
307 * `--with-large-heap=yes,no` - Enable support for GC heaps larger than 3GB.
309   * This only applies only to the Boehm garbage collector, the SGen garbage
310 collector does not use this configuration option.
312   * This defaults to `no`.
314 * `--enable-small-config=yes,no` - Enable some tweaks to reduce memory usage
315 and disk footprint at the expense of some capabilities.
317   * Typically this means that the number of threads that can be created
318 is limited (256), that the maximum heap size is also reduced (256 MB)
319 and other such limitations that still make mono useful, but more suitable
320 to embedded devices (like mobile phones).
322   * This defaults to `no`.
324 * `--with-ikvm-native=yes,no` - Controls whether the IKVM JNI interface library is
325 built or not.
327   * This is used if you are planning on
328 using the IKVM Java Virtual machine with Mono.
330   * This defaults to `yes`.
332 * `--with-profile4=yes,no` - Whether you want to build the 4.x profile libraries
333 and runtime.
335   * This defaults to `yes`.
337 * `--with-libgdiplus=installed,sibling,<path>` - Configure where Mono
338 searches for libgdiplus when running System.Drawing tests.
340   * It defaults to `installed`, which means that the
341 library is available to Mono through the regular
342 system setup.
344   * `sibling` can be used to specify that a libgdiplus
345 that resides as a sibling of this directory (mono)
346 should be used.
348  * Or you can specify a path to a libgdiplus.
350 * `--enable-minimal=LIST`
352   * Use this feature to specify optional runtime
353 components that you might not want to include.  This
354 is only useful for developers embedding Mono that
355 require a subset of Mono functionality.
356   * The list is a comma-separated list of components that
357 should be removed, these are:
359     * `aot`:
360 Disables support for the Ahead of Time compilation.
362     * `attach`:
363 Support for the Mono.Management assembly and the
364 VMAttach API (allowing code to be injected into
365 a target VM)
367     * `com`:
368 Disables COM support.
370     * `debug`:
371 Drop debugging support.
373     * `decimal`:
374 Disables support for System.Decimal.
376     * `full_messages`:
377 By default Mono comes with a full table
378 of messages for error codes. This feature
379 turns off uncommon error messages and reduces
380 the runtime size.
382     * `generics`:
383 Generics support.  Disabling this will not
384 allow Mono to run any 2.0 libraries or
385 code that contains generics.
387     * `jit`:
388 Removes the JIT engine from the build, this reduces
389 the executable size, and requires that all code
390 executed by the virtual machine be compiled with
391 Full AOT before execution.
393     * `large_code`:
394 Disables support for large assemblies.
396     * `logging`:
397 Disables support for debug logging.
399     * `pinvoke`:
400 Support for Platform Invocation services,
401 disabling this will drop support for any
402 libraries using DllImport.
404     * `portability`:
405 Removes support for MONO_IOMAP, the environment
406 variables for simplifying porting applications that 
407 are case-insensitive and that mix the Unix and Windows path separators.
409     * `profiler`:
410 Disables support for the default profiler.
412     * `reflection_emit`:
413 Drop System.Reflection.Emit support
415     * `reflection_emit_save`:
416 Drop support for saving dynamically created
417 assemblies (AssemblyBuilderAccess.Save) in
418 System.Reflection.Emit.
420     * `shadow_copy`:
421 Disables support for AppDomain's shadow copies
422 (you can disable this if you do not plan on 
423 using appdomains).
425     * `simd`:
426 Disables support for the Mono.SIMD intrinsics
427 library.
429     * `ssa`:
430 Disables compilation for the SSA optimization
431 framework, and the various SSA-based optimizations.
433 * `--enable-llvm`
434 * `--enable-loadedllvm`
436   * This enables the use of LLVM as a code generation engine
437 for Mono.  The LLVM code generator and optimizer will be 
438 used instead of Mono's built-in code generator for both
439 Just in Time and Ahead of Time compilations.
441   * See https://www.mono-project.com/docs/advanced/mono-llvm/ for the 
442 full details and up-to-date information on this feature.
444   * You will need to have an LLVM built that Mono can link
445 against.
447   * The `--enable-loadedllvm` variant will make the LLVM backend
448 into a runtime-loadable module instead of linking it directly
449 into the main mono binary.
451 * `--enable-big-arrays` - Enable use of arrays with indexes larger
452 than Int32.MaxValue.
454   * By default Mono has the same limitation as .NET on
455 Win32 and Win64 and limits array indexes to 32-bit
456 values (even on 64-bit systems).
458   * In certain scenarios where large arrays are required,
459 you can pass this flag and Mono will be built to
460 support 64-bit arrays.
462   * This is not the default as it breaks the C embedding
463 ABI that we have exposed through the Mono development
464 cycle.
466 * `--enable-parallel-mark`
468   * Use this option to enable the garbage collector to use
469 multiple CPUs to do its work.  This helps performance
470 on multi-CPU machines as the work is divided across CPUS.
472   * This option is not currently the default on OSX
473 as it runs into issues there.
475   * This option only applies to the Boehm GC.
477 * `--enable-dtrace`
479   * On Solaris and MacOS X builds a version of the Mono
480 runtime that contains DTrace probes and can
481 participate in the system profiling using DTrace.
483 * `--disable-dev-random`
485   * Mono uses /dev/random to obtain good random data for
486 any source that requires random numbers.   If your
487 system does not support this, you might want to
488 disable it.
490   * There are a number of runtime options to control this
491 also, see the man page.
493 * `--with-csc=roslyn,mcs,default`
495   * Use this option to configure which C# compiler to use.  By default
496     the configure script will pick Roslyn, except on platforms where
497     Roslyn does not work (Big Endian systems) where it will pick mcs.
499     If you specify "mcs", then Mono's C# compiler will be used.  This
500     also allows for a complete bootstrap of Mono's core compiler and
501     core libraries from source.
503     If you specify "roslyn", then Roslyn's C# compiler will be used.
504     This currently uses Roslyn binaries.
505   
506 * `--enable-nacl`
508   * This configures the Mono compiler to generate code
509 suitable to be used by Google's Native Client:
510 https://code.google.com/p/nativeclient/
512   * Currently this is used with Mono's AOT engine as
513 Native Client does not support JIT engines yet.
515 * `--enable-wasm`
517   * Use this option to configure mono to run on WebAssembly. It will
518     set both host and target to the WebAssembly triplet. This overrides
519     the values passed to `--host` or `--target` and ignored what config.sub guesses.
521     This is a workaround to enable usage of old automake versions that don't
522     recognize the wasm triplet.
525 Working With Submodules
526 =======================
528 Mono references several external git submodules, for example
529 a fork of Microsoft's reference source code that has been altered
530 to be suitable for use with the Mono runtime.
532 This section describes how to use it.
534 An initial clone should be done recursively so all submodules will also be
535 cloned in a single pass:
537         $ git clone --recursive git@github.com:mono/mono
539 Once cloned, submodules can be updated to pull down the latest changes.
540 This can also be done after an initial non-recursive clone:
542         $ git submodule update --init --recursive
544 To pull external changes into a submodule:
546         $ cd <submodule>
547         $ git pull origin <branch>
548         $ cd <top-level>
549         $ git add <submodule>
550         $ git commit
552 By default, submodules are detached because they point to a specific commit.
553 Use `git checkout` to move back to a branch before making changes:
555         $ cd <submodule>
556         $ git checkout <branch>
557         # work as normal; the submodule is a normal repo
558         $ git commit/push new changes to the repo (submodule)
560         $ cd <top-level>
561         $ git add <submodule> # this will record the new commits to the submodule
562         $ git commit
564 To switch the repo of a submodule (this should not be a common or normal thing
565 to do at all), first edit `.gitmodules` to point to the new location, then:
567         $ git submodule sync -- <path of the submodule>
568         $ git submodule update --recursive
569         $ git checkout <desired new hash or branch>
571 The desired output diff is a change in `.gitmodules` to reflect the
572 change in the remote URL, and a change in /<submodule> where you see
573 the desired change in the commit hash.
575 License
576 =======
578 See the LICENSE file for licensing information, and the PATENTS.TXT
579 file for information about Microsoft's patent grant.
581 Mono Trademark Use Policy
582 =========================
584 The use of trademarks and logos for Mono can be found [here](https://www.dotnetfoundation.org/legal/mono-tm). 
586 Maintaining the Class Library Solution Files
587 ============================================
589 Mono now ships with a solution file that can be used to build the
590 assemblies from an IDE.  Either by opening the topmost `net_4_x.sln`
591 file, or to by loading one of the individual `csproj` files located in
592 each directory.
594 These are maintained by extracting the configuration information from
595 our Makefiles, which as of May 2016 remain the canonical location for
596 configuration information.
598 When changes are made to the Makefiles, a user would need to run the
599 following command to re-generate the solution files at the top level:
601         $ make update-solution-files