This patch decouples the formatting logic (which is used by the
clang-format feature) from the http API logic.
This is done with the new FormattingService populates the formatters
from the config, and wraps formatter execution. This way, both the http
controller and the clang-format functionality can use it, reducing tight
coupling.
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
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!)
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
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>
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...
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.
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!
- 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
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 :)
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
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.
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.
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 😆
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)

