Commit Graph
2504 Commits
Author SHA1 Message Date
Mats Larsen 7252326213 Migrate tests for formatting 2024-11-30 12:07:18 +09:00
Mats Larsen 3683b60513 De-couple formatter for http server 2024-11-30 12:07:17 +09:00
Mats Jun Larsen 09adb2795a Add re-usable middleware functions to http server (#7154)
Just add the headers you want to the handler list :)

It's basically the addStaticHeaders function again, but this time more
composable. End goal is to replace that function and all its uses with
this as I go with the api improvements

This technically also fixes a cors regression from earlier patches
2024-11-30 11:37:57 +09: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
Matt Godbolt 6fa1dede79 Add lfortran and a slightly hacky path to clang (#7149)
Advice sought: I didn't want to plumb through a whole new compiler flag
for `clang` so used a top-level one for `fortran` in the form of a
`ceProp` (which doesn't cascade through all the groups etc). I think
this is _ok_ but ugly and surprising (To me...) and I wonder if we
should actually consider making each compiler's `ceProps` use the same
logic as the logic in the discovery process with parent properties
etc...or not. (cc @partouf in case I've missed something obvious!)
2024-11-28 15:51:51 -06:00
Thirumalai Shaktivel d5ccd7cf20 [feat] Add LFortran as a new fortran compiler (#7119)
Details:
LFortran is a modern open-source (BSD licensed) interactive Fortran
compiler built on top of LLVM. See, https://lfortran.org for more
details.
 There was an interest in the community to add the compiler into the 
 Compiler Explorer: https://github.com/lfortran/lfortran/issues/623. 
 So, this PR adds it.

LFortran is in alpha (the source code compiles to binary and execute. 
 But, users are expected that their code can break). It can emits AST, 
 ASR, LLVM, C, C++, WAT, Julia, Fortran, etc. It has multiple backend
 like LLVM (default), C, C++, x86, WASM, fortran and mlir. 
 For more options run `--help`.

Changes in this PR:
- Add LFortran as a new Fortran compiler.
- `-g` options is enabled by default in `optionsForFilter`. Providing an
option
to disabling it helps other compilers (that doesn't have complete
support for
 debug information) to compile successfully
2024-11-28 10:45:01 -06:00
Mats Jun Larsen 0c51a94d14 Move site-templates loader file (#7146)
File doesn't have anything to do with the http server anymore
2024-11-29 01:18:21 +09:00
Mats Jun Larsen 788e576762 Add controller for healthcheck endpoint (#7145)
Follow up to building separate express routers for each domain. Now
handles the healthcheck in a separate controller
2024-11-29 01:06:50 +09:00
Mats Jun Larsen eb45763ff0 Add correct types to healthcheck endpoints (#7144)
Removes the any types and properly types the option
2024-11-29 00:24:04 +09:00
Mats Jun Larsen b29a0809ad Introduce HttpController interface for http routers (#7142)
By requiring controllers to declare their own routes, we ensure
consistency between tests and the actual server
2024-11-29 00:12:06 +09:00
Mats Jun Larsen 52e27d5a37 Rewrite assembly documentation handler to controller form (#7130)
Follow-up to #7090
2024-11-28 22:39:10 +09: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
Benjamin MaxwellandMats d5a016471c Support LLVM IR filters for the output of mlir-translate (#6881)
This enables the LLVM IR filters for the output of `mlir-translate`
(with `-mlir-to-llvmir`). The filters are still disabled for `mlir-opt`
(which only outputs MLIR) as there's currently no support for MLIR
filtering.

<!-- THIS COMMENT IS INVISIBLE IN THE FINAL PR, BUT FEEL FREE TO REMOVE
IT
Thanks for taking the time to improve CE. We really appreciate it.
Before opening the PR, please make sure that the tests & linter pass
their checks,
  by running `make check`.
In the best case scenario, you are also adding tests to back up your
changes,
  but don't sweat it if you don't. We can discuss them at a later date.
Feel free to append your name to the CONTRIBUTORS.md file
Thanks again, we really appreciate this!
-->

---------

Co-authored-by: Mats <mats@jun.codes>
2024-11-28 22:13:19 +09:00
Mats b09b027201 Add controller for site templates (#7131)
Equivalent of #7130 for site templates
2024-11-28 21:55: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
Patrick Quist 4615e7fb88 Don't keep possibleArguments to reduce memory footprint (#7134)
Hotfix to reduce memory footprint
2024-11-27 17:46:20 +01:00
Mats ea29a6e9d6 Separate list and load actions for source API (#7090)
This is the first PR in API consistency with more to come:

1. The source API urls have been properly defined with
`/source/:source/list` and `/source/:source/load/:language/:filename`
- These used to be two API endpoints mushed together into one `handle()`
function. They are now separate
- While it may appear from the tests that this is an API breakage,
there's currently no way to have the source API spit out responses for
stuff like `/source/moose/load/Grunkle`.
2. The frontend code calling the list api now has shared types
3. Code has been migrated to `/lib/handlers/api/source.ts`
- I've moved code here, because I would like to separate the stuff
that's under the API and the stuff that isn't (e.g., healthcheck)
- The source endpoint is currently not under /api, but I believe it
makes sense to move it.
4. GitHub is terrible at showing the diff, but the `browser.ts` file has
been removed, since it's never actually used. Our frontend only calls
`/source/builtin/...` and it never had any entries. Besides, the type
used on the frontend for the locally stored stuff is different...
2024-11-27 13:54:47 +09:00
kevinjeon-g b2b39017c0 Support system properties in the R8/D8 invocation (#7113)
This change supports JVM system property input by reordering user-input
compiler options that begin with '-D' or '-J'. The latter is an R8/D8
convention; the 'J' is stripped before being used.

Other compiler options are assumed to still apply to R8/D8.
2024-11-26 18:45:33 -06:00
chibitanaka 86f439fc92 Add Vyper support (#7088)
Hello! I'm a big fan of Godbolt and use it regularly to test gas
optimizations in Solidity. However, to this day, there is no support for
Vyper, the second most popular language targeting the EVM, related issue
#4165. We at Statemind.io thought that adding Vyper support would
greatly benefit developers and security researchers, so here is our
attempt to get it working :)

This PR **is not ready** for merging, as `vyper.defaults.properties` and
`vyper.amazon.properties` are not yet defined. I have a few questions to
clarify how to integrate it on the public instance and infrastructure
repository:

Because Vyper compiler is basically a python module, I've found success
in testing multiple versions via separate `venv` environments. In my
local tests `vyper.local.properties` was the following:
```INI
compilers=vyper
compilerType=vyper

versionFlag=--version

compiler.vyper.exe=/opt/research/godbolt/venv/bin/vyper
compiler.vyper.isSemVer=true
compiler.vyper.instructionSet=evm
compiler.vyper.options=--optimize none
```

The versions tested are the latest major Vyper release 0.4.0, along with
0.3.10 and earlier 0.3.xx releases.

It appears that there is support for running python in a virtual
environment in the infra repository:

https://github.com/compiler-explorer/infra/blob/main/bin/lib/installable/python.py

However, I've had difficulties getting started with it and would greatly
appreciate any assistance. Thank you!
2024-11-26 16:38:40 -06: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
Ofek 20b8ccaa6f Remove ICompiler, other minor type fixes (#7079) 2024-11-25 18:36:20 +02:00
Cr0a3 636675c476 [FIX] fixed argument passing for ygen (#7120) 2024-11-24 18:42:55 +01:00
Mats Jun 73ee43da66 Handle site template importing asynchronously (#7089)
1. Gives a proper type to the metadata
2. Fixes a typo in `screenshot_dimentions`
3. Removes home-made partition function in favor of underscore
4. Reads file asynchronously (and consequently rest of API is async)
5. Strips the `https://godbolt.org/#` from each entry in the config file

As an added benefit this should also cut some startup time reading this
file before it's used :)
2024-11-15 10:03:12 +09:00
Ofek 717c9173ad Unify OptCodeEntry and LLVMOptInfo (#7077) 2024-11-14 13:05:26 +02:00
Ofek b321566b09 Fix #7096: consider the rust case where an IR label can include '[' (#7098) 2024-11-14 13:01:08 +02:00
Mats Jun 050e135197 Remove unnecessary type assertion (#7081)
Removes an old TODO of mine :)

p-queue conditionally returns `undefined` if throwOnTimeout is not set
to true. We currently operate our own timeout check, so I haven't
changed that.

Setting timeout to undefined should give us the correct type without
affecting behavior.
https://github.com/sindresorhus/p-queue/blob/main/source/index.ts#L253
2024-11-12 21:30:23 +09:00
Partouf 9e8e5620e4 Revert "Small typing fix for UnparsedExecutionParams (#7078)"
This reverts commit 5116285318.
2024-11-11 16:51:43 +01:00
Mats Jun 3f2aaa6c4b Remove void type from eachLine (#7080) 2024-11-10 20:20:21 +01:00
Ofek 5116285318 Small typing fix for UnparsedExecutionParams (#7078) 2024-11-09 22:50:05 +02:00
Partouf e5d329b4cf eliminate some logging during discovery 2024-11-08 17:01:09 +01:00
Partouf 6544587d35 fix 2024-11-08 16:34:31 +01:00
Spencer Fricke 13bd12a975 Add SPIRV-Cross and SPIRV-Reflect (#7056) 2024-11-08 16:31:51 +01:00
Spencer Fricke 7a19db3378 Add success message for validator tool (#7055) 2024-11-08 16:29:05 +01:00
Spencer Fricke 4651cbd7bb Add Glslang Argument Parser (#7051) 2024-11-08 16:28:00 +01:00
Spencer Fricke 721b45b35b Add richer comments to SPIR-V assembly output (#7052) 2024-11-08 16:27:32 +01:00
Matt Godbolt 0d2fc74419 Deduplicate ARM opcodes (#7067)
Prevents us generating duplicate case statements, though this doesn't
mean we correctly collate things. This has no functional change (as the
duplicate switches the first one wins) but reduces the amount of code
generated.
2024-11-05 07:31:20 -06:00
Spencer Fricke 35527dd3b4 Fix OpLabel being in previous block (#7054)
SPIR-V is like LLVM in there are "Blocks" used for Control Flow,
`OpLabel` has a special text in the SPIR-V spec

> A block always starts with an
[OpLabel](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpLabel)
instruction. This may be immediately preceded by an
[OpLine](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpLine)
instruction, but the OpLabel is considered as the beginning of the
block.

But currently the coloring is off-by-1


![image](https://github.com/user-attachments/assets/4ec20d7d-0beb-49de-ba32-204f708a08c2)

This change now moves it up a line so it is the start of the block


![image](https://github.com/user-attachments/assets/3d6d1742-469f-4b29-a644-7677056bce9e)

This can be better seen why looking at the [SPIR-V
Visualizer](spirv-visualizer) tool output


![image](https://github.com/user-attachments/assets/10cbad0b-f093-4bd5-98dd-b38e78615218)
2024-11-03 19:37:45 +09:00
Sirui Mu a6ca0fed18 Add ClangIR compilation options (#6914)
This patch adds two options to the clangir pane that affects the clangir
compilation pipeline:

* Flat CIR enables the emission of flat clangir CFG;
* -fclangir-mem2reg enables the mem2reg pass on the flat clangir CFG.
2024-11-02 10:53:33 +02:00
goto40 7476cf387c fix: changed ClientStateExecutor.arguments type to string (was: any[]) - closes #7037 (#7044)
Just a small fix concerning the type (and the default value!) of
`ClientStateExecutor.arguments`.

This solves #7037 .

**Please have a detailed look at my changes**, since I have no deep
insight in all dependencies of this software (however, the tests pass)!

I tested the new code with the link in #7037 - and I tested the error
(wrong type) with [this link (the arguments are a list
here)](http://localhost:10240/clientstate/eNpNUEFqwzAQ/MqiQrCJS0jSk5205AW9hF7qHGRFuAJ5baQVpAj9vSvjmCKENLOj2dVE4bX3ZkQvaviOwtz53FcgrMQ+yF4zFGq7FUz5MTg1Ey2+GFQ23DWcJmeQ3lv05IIiuEBkDI/qt0lNiy2SHiYriZXKSu/hylqD1qAGxW0JrhsY5AOKBcFGVrDeuxIiu5DTFByChBN08MG7Bsn2KXfI/QZpsJi1AJ7udT2PZbFoBZsXx+qtPMfU8jeesGyydrebiUvcV4dUXSJXUq6k/GE1DpOx2s3Z3JjQD60CjW4JS7o+DBpprT8fMF6iFL1HOfmfkbKhNd2qHSdaYhevPPGZQz4cRfrn8hloCvRlvOlsjp0D1unG6w9dpIzQ).

**Note:** I check manually for the correct type and throw a `TypeError`
in case of problems. We could add a proper JSON-Schema definition of
important Data Types and include a Schema-check (I have good experience
with `zod`, but there are many of such libs). **If you are interested**,
I could prepare a demo-PR with e.g. `zod` for the `ClientStateExecutor`?
2024-11-01 10:32:06 +02:00
Spencer Fricke 868be5dc99 Add GLSL Logo (#7041)
Follow-up of
https://github.com/compiler-explorer/compiler-explorer/pull/6883

Someone pointed out today (since GLSL went live) that the OpenGL logo
would be best reprentation for the language as the `GL` in `GLSL` does
stand for the `GL` in `OpenGL`... also there is no other official logo
and it feels like a bug that there is no logo for it 😆
2024-10-30 23:30:54 +09:00
Partouf a4d8560877 fix 2024-10-29 10:31:22 +01:00
Partouf 9ad3a6ef6f bugfix/workaround windows 2024-10-29 09:40:11 +01:00
Spencer Fricke 02603a6371 Add SPIR-V language with SPIRV-Tools compilers (#6947)
for https://github.com/compiler-explorer/compiler-explorer/issues/2331

Hey, so I am currently trying to improve the SPIR-V ecosystem, in-charge
of the [SPIR-V Guide](https://github.com/KhronosGroup/SPIRV-Guide), and
part of the SPIR-V Working Group. We talked at our last Face-2-Face
gathering about getting more support for GPU tooling in something like
Compiler Explorer because you have all made this such an amazing tool!

I have enjoyed working in this codebase and happy to help keep improving
the SPIR-V as people find issues or want enhancements (I was already
about to spend time rebuilding Compiler Explorer, so happy to donate my
time to a single tool's effort)

(For those who haven't spent last few years staring at SPIR-V)

- SPIR-V is a an IR (very much like LLVM IR) but for GPUs
- SPIR-V can be used for Graphics and Compute
- Compute:
    - Can be tied to things like clang, llvm, mlir, OpenCL, etc
- One could take `spirv` as a language and compile it to something like
x86
      - (Future PRs for this realm of things)
- Graphics:
- Much harder to actually "compile" to any ISA because other graphics
pipeline information is missing that will effect the final ISA
- Microsoft has even now planned to move to [SPIR-V for DirectX
soon](https://devblogs.microsoft.com/directx/directx-adopting-spir-v/)
- Both:
- There are many tools that run on SPIR-V regardless (hence why they
share the same IR)
    - Being able to do tooling in compiler explorer would be AMAZING

This PR adds `SPIR-V` as a language and a new `SPIRV-Tools` compiler as
an initial compiler for it the language (since we already have the
SPIRV-Tools repo being pulled in on the infra side!)

I personally use `spirv-opt` and `spirv-val` the most and have been
testing this locally for a few days and feel it is ready to go. I plan
to slowly add more tools (ex. `spirv-fuzz`, `spirv-cross`,
`spirv-reflect`, etc)

Cheers!

(some screenshots of course)

![image](https://github.com/user-attachments/assets/419feab0-d030-4578-b32a-ef1cf95701da)

![image](https://github.com/user-attachments/assets/a00fa60f-7f05-4522-a9fc-1c43ecee1c42)
2024-10-28 21:24:50 -05:00
Ofek 63dd5e35a5 Various tsifications (#7025) 2024-10-27 15:28:38 +02:00
Partouf f3e369d5dd bugfix cmake execution 2024-10-26 19:09:39 +02:00
Partouf b5644fc22f bit more logging 2024-10-26 18:48:42 +02:00
Ofek 3fc9fcabd2 Add types to remote-execution files (#7024) 2024-10-26 18:26:56 +02:00
Partouf 025be9c495 fix types 2024-10-26 17:53:46 +02:00
Ofek f6438f9c4d Store times in numbers only (#7023)
Also fixes #4655
2024-10-26 18:43:59 +03:00
Patrick Quist 4fe8397fac Remote execution (#6700) 2024-10-26 17:42:22 +02:00