Commit Graph

74 Commits

Author SHA1 Message Date
Steve
75a5b68b06 .NET: Improve NativeAOT compilation and unsupported execution error mode (#8637)
We only support running .NET code on CoreCLR and Mono, so we should reject execution on other compilers otherwise this can confuse users a lot.

In addition, removing the --notrimwarn and --noaotwarn so that users can see warnings during NativeAOT compilations, and adding missing arguments to ilc.
2026-05-02 08:05:38 -05:00
Steve
17d1898b3a Add support for additional compiler options in .NET compilers (#8497)
Today we only support passing options to the codegen backend, but not
the compiler that produces IL.

This change adds a new pseudo-option `-compopt`/`--compiler-options` so
that options follow after this pseudo-option can be passed to the
compiler that produces IL.
2026-02-22 17:09:28 -06:00
Matt Godbolt
53c7dd328b Configure Biome import organiser with grouped imports (#8431)
Enable Biome's `organizeImports` with groups matching the original
ESLint `import/order` configuration:

1. **Node builtins** (`node:fs`, `path`, etc.)
2. *(blank line)*
3. **Third-party packages** (`express`, `@sentry/node`, etc.)
4. *(blank line)*
5. **Local/relative imports** (`../foo.js`, `./bar.js`, aliases)

This resolves the inconsistency where Biome wasn't enforcing import
grouping, meaning new files would lose the blank-line separation that
the old ESLint config enforced.

### Impact
- **354 files** updated out of 738 checked (~48%)
- **+188 / -240 lines** (net -52) — almost entirely single blank line
additions/removals between import groups
- No import reordering; purely group separator consistency

Fixes #7373

🤖 Generated by LLM (Claude, via OpenClaw)
2026-02-01 20:50:46 -06:00
Steve
9a8f2b4ecf Add .NET 10 (#8314)
Add .NET 10 compilers.

Depends on https://github.com/compiler-explorer/infra/pull/1913
2026-01-25 16:28:56 -05:00
Matt Godbolt
8734c3e492 Update biome (#7956)
- latest biome, and fix its configuration
- fixes "static" content to be globally configured too (instead of
per-line)
- fixes issues:
  - imports fixed up
  - `Date.now()` vs `+new Date()`
  - some unused things `_` prefixed
 
After discussion with the team, turned off the unused parameter warning.
2025-07-28 10:34:46 -05:00
Steve
948382018e .NET: Add multiple architectures support for NativeAOT (#7496)
Depends on https://github.com/compiler-explorer/dotnet-builder/pull/25
2025-03-27 13:52:41 -05:00
Matt Godbolt
86536fc8bc Port compilers over to using node:fs et al (#7449)
- use utils functions where necessary
- introduce a few asyncs where needed.

Some local testing done (e.g. with sway and clang). Will need testing in
staging for the best outcome.
2025-02-26 10:56:10 -06:00
Mats Jun Larsen
5eea63328f Migrate to Biome for linting and formatting (#7033) 2025-02-02 17:54:31 +00:00
Steve
d37e1f458a .NET: Add cross-arch codegen support for crossgen2 (#7215)
This allows users to inspect the disassembly other than x64.
2024-12-13 04:32:31 -06:00
Steve
77bbd0b6dc Make the argument parsing more robust (#7185)
Instead of skipping the exactly the last option, skip all options after
the input filename.

Otherwise, in some cases there can be options like `-Wl` and etc. being
passed to the compiler and cause build failures.
2024-12-05 08:13:28 -06:00
Steve
13eabd6d04 .NET: Fix the redundant options in some cases (#7152)
#7143 accidentally broke the compilation for mono as it would pass an
unnecessary option `--parallalism 1` to `mono`. Missed this in my local
test as the result of mono was cached.
This option is only used by Crossgen2 and NativeAOT.
2024-12-01 02:58:45 -06:00
Steve
1e02873328 Remove the restrictions on compiler options (#7143)
Follow up to #7141

As per
https://github.com/compiler-explorer/compiler-explorer/pull/7141#issuecomment-2506116434,
remove the restrictions on compiler options.

cc: @junlarsen
2024-11-28 15:52:14 -06:00
Steve
f667fb700b Allow passing --help to compilers (#7141)
As per
https://github.com/compiler-explorer/compiler-explorer/issues/6199#issuecomment-2505980377,
allowing passing `--help` to compilers so that users can know what
options and switches are available (though part of them will be filtered
out, but still better than having nothing).
2024-11-28 22:37:39 +09:00
Steve
f311fbb3e9 .NET: Set languageId for ILSpy (#7138)
The compile result of ILSpy is C# code, so use `csharp` for
highlighting.
2024-11-28 10:01:33 +09:00
Steve
2a55dce7fc Add support for .NET 9.0 and ILSpy (#7124)
- Adding support for .NET 9.0
- Adding support for ILSpy
- Make some changes to the compiler name so that the meaning of the
version is more cleared
- Adding missing compilers for existing .NET versions

cc: @mattgodbolt
2024-11-26 13:20:02 -06:00
Steve
35cd137722 Do not cache the sdk version and compiler path (#6973)
Godbolt caches the compiler instance so that the version string won't be
recalculated if there's an update to the compiler image.
Do not cache that information, instead reevaluate them whenever we do
the compilation.
2024-10-21 08:52:37 -05:00
Steve
06068ef1e0 .NET: Stop using a response file (#6943)
Using a response file can prevent nsjail from replacing the file name in
args. Passing all args directly to the compiler instead.

Fixes
https://github.com/compiler-explorer/compiler-explorer/pull/6928#issuecomment-2398361491
2024-10-08 09:48:13 -05:00
Steve
c2de66114b .NET: Invoke compiler directly to speed up compilation (#6928)
After this PR, compilers will be invoked directly instead of relying on
the built-in `dotnet build` command which involves restore and many
other expensive resolution operations.
This should speed up the compilation process a lot.
2024-10-02 20:56:22 -05:00
Steve
30b77d380e IL: Fixes include path for Linux (#6922) 2024-10-01 14:32:19 +02:00
Ofek
f5f00606f8 Tsifications galore (#6916)
Still mostly mindless numb work, one rename that touched many files
(`getArgumentParser` -> `getArgumentParserCls`), and a few real
improvements.
The goal is to be able to turn on `noImplicitAny` for the project, to
enforce higher code quality. 600 violations to go.
2024-10-01 12:26:46 +03:00
Steve
ee2dc8ab00 Update asm parser and add support for IL and IL disassembler (#6856)
Supersedes #6842 

- We now have the upstream issue of `JitDisasmAssemblies` fixed. Enable
it for net9.0+.
- Update asm-parser to support CoreCLR and NativeAOT (Fixes #6833)
- Adding support for IL language
- Adding support for IL disassembler
- Fixes #6629
2024-09-29 13:15:47 -05:00
Ofek
f715dc2932 More tsification (#6877)
About half way through. Only 708 tsification errors to go..
2024-09-28 10:32:36 +03:00
Ofek
9ef46fbafe Binge of (mostly) mindless tsification (#6838)
Turned on `noImplicitAny` in tsconfig, then went around fixing some
random easy stuff.
Hopefully tsification-PRs with more real content coming up.
2024-09-07 14:36:43 +03:00
Steve
81816f29ac .NET: Enhance NativeAOT compilation (#6792) 2024-09-07 10:15:07 +02:00
Steve
ef323ab4ba .NET: Add mono and NativeAOT support (#6788)
Adding support for mono and NativeAOT.

As for NativeAOT, we have some upstream issues need to be resolved
before we can use `JitDisasmAssemblies` to print disasm for the
specified assembly only, where it would fail with:
```
Unhandled exception: ILCompiler.CodeGenerationFailedException: Code generation failed for method '[S.P.CoreLib]<Module>..cctor()'
 ---> System.NotImplementedException: getClassModule
   at Internal.JitInterface.CorInfoImpl.getClassModule(CORINFO_CLASS_STRUCT_*) + 0x2b
   at Internal.JitInterface.CorInfoImpl._getClassModule(IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*) + 0x39
   --- End of inner exception stack trace ---
   at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode, MethodIL) + 0x273
   at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode, MethodIL) + 0x63
   at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl, MethodCodeNode) + 0x97
   at ILCompiler.RyuJitCompilation.CompileSingleThreaded(List`1) + 0xee
   at ILCompiler.RyuJitCompilation.ComputeDependencyNodeDependencies(List`1) + 0x173
   at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() + 0x159
   at ILCompiler.RyuJitCompilation.CompileInternal(String, ObjectDumper) + 0x26
   at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String, ObjectDumper) + 0x5d
   at ILCompiler.Program.Run() + 0x2a55
   at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass240_0.<.ctor>b__0(ParseResult) + 0x321
   at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult) + 0x6f
```
For now, workaround with removing `JitDisasmAssemblies` and print disasm
for all assemblies instead. (see the second commit)

/cc: @MichalStrehovsky We need to implement `getClassModule`,
`getModuleAssembly` and `getAssemblyName` in ilc to make
`JitDisasmAssemblies` work correctly.

Closes #5668
2024-08-24 08:52:15 -05:00
Steve
b8df2e3dab Refactor and adding new dotnet compilers (#6522)
Depends on https://github.com/compiler-explorer/infra/pull/1312.

I'm considering to unify all old compiler versions per dotnet minor
version as patch upgrade in dotnet doesn't change the codegen. New patch
versions come with quality updates like bug and security fixes, we only
need the latest version per minor dotnet version instead. Here a version
is consisting of `major.minor.patch`, such as `7.0.3` and `8.0.5`.

i.e.
- `dotnet6030csharp:dotnet6018csharp:dotnet6014csharp:dotnet6011csharp`
-> `dotnet60csharp`, and rename it to `.NET 6.0`, as `6.0.30`, `6.0.18`,
`6.0.14` and `6.0.11` are all `6.0`
- `dotnet6030fsharp:dotnet6018fsharp:dotnet6014fsharp:dotnet6011fsharp`
-> `dotnet60fsharp`, and rename it to `.NET 6.0`, as `6.0.30`, `6.0.18`,
`6.0.14` and `6.0.11` are all `6.0`
- `dotnet6030vb:dotnet6018vb:dotnet6014vb:dotnet6011vb` -> `dotnet60vb`,
and rename it to `.NET 6.0`, as `6.0.30`, `6.0.18`, `6.0.14` and
`6.0.11` are all `6.0`
- `dotnet7019csharp:dotnet707csharp:dotnet703csharp:dotnet701csharp` ->
`dotnet70csharp`, and rename it to `.NET 7.0`, as `7.0.19`, `7.0.7`,
`7.0.3` and `7.0.1` are all `7.0`
- `dotnet7019fsharp:dotnet707fsharp:dotnet703fsharp:dotnet701fsharp` ->
`dotnet70fsharp`, and rename it to `.NET 7.0`, as `7.0.19`, `7.0.7`,
`7.0.3` and `7.0.1` are all `7.0`
- `dotnet7019vb:dotnet707vb:dotnet703vb:dotnet701vb` -> `dotnet70vb`,
and rename it to `.NET 7.0`, as `7.0.19`, `7.0.7`, `7.0.3` and `7.0.1`
are all `7.0`

I'm keeping the minor version (ie. `.0`) in the name as there may be
updates like `.NET Core 3.1` to `.NET Core 3.0` which does change the
codegen.

The compiler structure now is:

```
group: dotnetcoreclr
.NET (main)
.NET 8
.NET 7
group: dotnetcrossgen2
.NET (main)
.NET 8
.NET 7
.NET 6
group: dotnetlegacy
existing compilers for backward compact
```

---------

Co-authored-by: Patrick Quist <partouf@gmail.com>
2024-06-11 14:09:23 -05:00
Patrick Quist
d2c7a5222e Local/Remote Execution environment (#6413) 2024-05-26 22:09:01 +02:00
Patrick Quist
b8325cf0c6 eslint root setting and fixes (#6307) 2024-04-16 21:26:53 +02:00
Matt Godbolt
a7e6ec61e3 Bump remaining deps (#5781)
And reformat everything.
2023-11-20 22:04:57 -06:00
Steve
6b94b29f55 Disable diffable asm for dotnet 8.0+ by default (#5739)
Since .NET 8.0, the JIT disasm no longer prints encoded bytes of
instructions by default, so we can disable diffable asm by default.
2023-11-13 20:08:43 -06:00
Patrick Quist
455d92916a Execution with heaptrack (#5644) 2023-11-07 23:59:40 +01:00
Steve
2f0b8028c7 Always get version string for dotnet (#5648) 2023-10-30 16:23:54 +01:00
Steve
9daa1a9447 Fix crossgen2 compilation (#5661) 2023-10-30 16:19:04 +01:00
Steve
c5ffd00598 Allow disabling diffable asm manually (#5585)
When we see JitDisasmDiffable being set manually, we can stop
automatically emitting JitDisasmDiffable.
2023-10-23 19:53:09 -05:00
Steve
58697ccf38 Improve the disassembly format for dotnet (#5419)
This is an improvement that can improve the disassembly format to make
it more friendly to a diff checker.

All versions tested:

net6.0:

![image](https://github.com/compiler-explorer/compiler-explorer/assets/14960345/1ae4fda5-db73-4703-88f9-abd640b4e5e1)

net7.0:

![image](https://github.com/compiler-explorer/compiler-explorer/assets/14960345/6dfe1a74-a09a-40c4-b586-425b8ee84b12)

trunk:

![image](https://github.com/compiler-explorer/compiler-explorer/assets/14960345/36247f19-1e26-4bb8-ab1d-040d7145854f)
2023-08-25 06:48:18 -05:00
Steve
6601a41423 Bring back crossgen2 (#5415)
It turns out we still need crossgen2 for net6.0.
So bring crossgen2 back for net6.0 only.

Also fix some bugs around `indexOf`.

No image rebuilding is required.
2023-08-24 19:23:53 -05:00
Steve
564ffed567 Use corerun and DisassemblyLoader for dotnet (#5391)
Depends on https://github.com/compiler-explorer/dotnet-builder/pull/4

- Use corerun instead of crossgen2 to do disassemble
- This can skip emitting actual executable by crossgen2 and speed up the
compilation
- Filter disasm to only show disasm for user code

We need to rebuild images for old compilers.
2023-08-23 11:03:36 -05:00
kasperk81
b3fd6f5c5c dotnet: show the actual error when compilation fails (#5410)
instead of ENOENT from the next line (fs.readFile), return the failed
compilation result.
2023-08-22 19:30:16 -05:00
kasperk81
c8e70680c5 add dotnet aot support for linux-x64 (#5345)
limitations:

* linux-x64 only
* no execution support

all of which can be added later after this initial support

---------

Co-authored-by: kasperk81 k <3082615+kasperk81@users.noreply.github.com>
2023-08-21 21:19:17 -05:00
Jeremy Rifkin
ddb4ed8c05 Improve the type of ExecutionOptions.env (#5206) 2023-06-28 08:15:24 -04:00
Matt Godbolt
54a99f6d51 Upgrade all minor versions; format; bump sonar and css minimizer (#4920) 2023-04-01 20:29:06 -05:00
kasperk81
289e9fd241 add back --parallelism (#4885)
missed --parallelism in
https://github.com/compiler-explorer/compiler-explorer/pull/4821.
2023-03-17 09:59:03 -05:00
Matt Godbolt
3461db6c19 Bump all minor versions - npm update; also bump webpack version speculatively... (#4851)
also npm lint and format to make sure any changes turn up.
2023-03-12 11:29:57 -05:00
kasperk81
610658c0b7 rename jit option for dotnet 8 (#4821) 2023-03-11 16:07:53 -06:00
Mats Jun Larsen
633eb82d18 Transition to ECMAScript Modules (#4780)
Makes the Compiler Explorer app, and all the tooling ESM compatible.
Things that have been done:

1. The package.json has `type: module` now
2. All relative imports have a .js ending
3. All directory imports are now directory/index.js to comply with ESM
standards
4. Dependency node-graceful is now imported into tree, because the
package is broken under esm
5. Dependency p-queue has been bumped to 7.x with ESM support
6. Dependency profanities has been bumped to 3.x with ESM support
7. Webpack config is now both ESM and CommonJS compatible
8. Non-ESM compatible imports have been rewritten
9. ESLint configuration has been tweaked to not fail on .js imports
10. Mocha is now hacked together and ran with ts-node-esm
11. Webpack is now hacked together and ran with ts-node-esm
12. Webpack config is now ESM compatible, so that it can be used in the
dev server
13. Cypress code still runs commonjs, and has been excluded from the
tsconfig
14. All sinon mock tests have been commented out, because sinon module
mocks do not work with ESModules (because ESModules are immutable)

A lot of tests are now giving warnings/errors to stdout, yet still pass.
Docenizer codegenerator scripts have been updated, but I did not re-run
them, and instead just changed their code.

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2023-02-27 18:06:38 -06:00
Jeremy Rifkin
384c297906 Fix trailing comma issue (#4775)
Make trailing commas more consistent throughout the project, fixes
config conflict between eslint and prettier. Resolves an oversight in
#4766.
2023-02-26 12:21:35 -05:00
Jeremy Rifkin
2b06c69111 Turn some auto-fixable eslint rules back on (#4766)
This PR turns comma-dangle and indent eslint rules on for lib/. These
are rules inherited from the eslint config for static/, this PR just
makes things more consistent. Also turned
@typescript-eslint/no-var-requires back on while I was here.
2023-02-23 17:16:17 -05:00
Jeremy Rifkin
563b220cb9 Type work for some handlers and stuff related to the compiler-finder (#4752) 2023-02-22 17:45:55 -05:00
Jeremy Rifkin
6a6efaefe6 Tsify lib/compilers (#4609) 2023-01-29 13:22:30 -05:00
kasperk81
f7c94061ee display crossgen2 version in asm output (#4526)
dotnet 6 and 7 will also show the version once there is a new deployment. for now they are showing 7.0.0-dev and <unknown version> respectively
2023-01-02 16:57:20 -06:00