What I did for GSoc 2024
2024-08-22
Hi everyone, this article is a requirement for my GSoc Final Submission, linking directly to the submission.
This article will include the summary of my contribution, where you can find all my filed issues and PRs.
Introduction
This summer I worked on the gccrs project, a GCC Front-end for Rust.
gccrs is a project to implement the Rust programming languages from scratch in the GCC codebase in order for rust to be able to be compiled to a wider amount of targets. It currently targets the version 1.49 of Rust and is supported by Open Source Security and Embecosm.
By doing this, it helps with a couple things:
- Targets architecture not available with rustc due to the use of LLVM. (SuperH for example, which powers the Dreamcast!)
- Benefit from the existing GCC ecosystem.
- Help with acceptance of Rust in the Linux kernel
- Help with acceptance of Rust in other fields, where having multiple compilers helps.
- Enable building Rust on targets with very old C++ compilers! (Targets with at least GCC version 4.8 (which released March 22, 2013) can build Rust)
Main contribution aspects
Overall, I contributed in 3 main aspects:
-
My main project - Inline Assembly in rust: I programmed the parser, set up the code infrastructure for TREE IR generation in the backend, along with AST, HIR lowering and typechecking.
-
CI/CD: I helped maintain and improve the CI/CD pipeline. This includes resolving dependency issues in GitHub Actions, adding support for 32 bit CI and glibc compliance CI. I also created a docker-compose dev environment for MacOS-based contributors, with all libraries and dependency installed; this helps us bypass MacOS's annoying build and link issues.
-
Code maintainance/Bug Fixes/Code Review: I maintained the code base via issues filed by my mentor and other contributors. I also helped fix some minor bugs in IR lowering and typechecking. I also help review some new, simple PRs for contributors.
Issues and PRs
Below is all the issues, PRs and commits I've made to the gccrs repository, up to Aug 22 2024, after producing this I ended up closing some resolved issues that has been silently addressed in some PRs.
The tables are produced via gh
cli tool and some I use nvim btw
love :)
Issues
Here's a formatted version of all my issues, up to Aug 22 2024, procured via gh issue list -A badumbatish --state all
:
Issue Number | Issue Status | Issue Title | Labels | Filed Date |
---|---|---|---|---|
3102 | OPEN | Set up the rest of HIR pipeline in InlineAsm | 2024-07-27T03:20:50Z | |
3099 | OPEN | parse_expr not stopping on => | 2024-07-25T19:41:07Z | |
3072 | OPEN | asm parser lacking label parse functionality |
2024-07-01T08:54:12Z | |
3069 | OPEN | Make asm parser stores parse result | 2024-06-25T16:12:44Z | |
3062 | CLOSED | Add ExprType::InlineAsm variant to ExprType enum | 2024-06-24T13:23:55Z | |
3061 | OPEN | Typechecking of asm! failed in let _ |
bug | 2024-06-24T13:24:07Z |
3057 | OPEN | asm! macro failed to exhaustively parse all of options(), clobber_abis(), and register operands | bug, expansion | 2024-06-18T13:32:24Z |
3052 | OPEN | Fully incorporate tl::expected into InlineAsm parsing | 2024-06-14T09:54:17Z | |
3051 | CLOSED | Remove unnecessary #include from rust-expr.h | good-first-pr, cleanup | 2024-07-11T09:23:53Z |
3050 | CLOSED | Safe guard InlineAsm-related structs | 2024-07-03T09:58:52Z | |
3048 | OPEN | Handle outer attributes properly for inline assembly | 2024-06-14T09:55:37Z | |
2937 | CLOSED | Docker image and container for Mac | 2024-05-10T14:53:25Z |
The closed/filed rate is 4/8, which is not high. Through out writing the parser and the backend infra, I realized that there are these little issues that's just easier to just fix and not necessary filed. There is also issues that are discussed via hackmd notes between me and my mentor that are not necessarily filed via GitHub.
PRs
Here's a formatted version of all my pull requests, up to Aug 22 2024, procured via gh pr list -A badumbatish --state all
:
PR Number | PR Status | PR Title | Filed Date |
---|---|---|---|
3133 | MERGED | Fix the disorder struct and class in inline asm | 2024-08-20T07:41:34Z |
3119 | OPEN | Add running cicd 32bit | 2024-08-04T19:47:37Z |
3109 | MERGED | Inline asm resolve expr | 2024-07-31T03:41:32Z |
3103 | MERGED | Inline asm hir pipeline | 2024-07-27T08:22:57Z |
3098 | MERGED | Fix the parser's operand and flags storage | 2024-07-25T16:38:11Z |
3093 | MERGED | Change assertion of asm operand constructor | 2024-07-21T22:46:28Z |
3090 | MERGED | Added options for ParseMode | 2024-07-20T07:48:51Z |
3081 | MERGED | Pin node16 by allowing old version | 2024-07-10T02:32:08Z |
3074 | MERGED | Safe-guard InlineAsm structs | 2024-07-01T00:43:59Z |
3073 | MERGED | Store parse result of parse_format_string(s) | 2024-07-01T00:24:42Z |
3063 | MERGED | Added ExprType::InlineAsm | 2024-06-23T18:06:02Z |
3060 | DRAFT | Asm generic il codegen | 2024-06-23T14:11:44Z |
3059 | MERGED | Add test case for using asm! outside of unsafe | 2024-06-22T06:40:27Z |
3053 | MERGED | incorporate tl::expected into InlineAsm parsing | 2024-06-14T06:08:01Z |
3011 | MERGED | Remove cstddef header from rust-fmt | 2024-05-19T03:03:05Z |
3002 | MERGED | Make gccrs recognize negative_impls | 2024-05-15T22:06:45Z |
2982 | MERGED | Inline asm | 2024-05-08T19:41:27Z |
2981 | OPEN | Cleanup macro invoc | 2024-05-08T17:47:46Z |
2980 | MERGED | Fix all tests in execute to be \r\n | 2024-05-08T06:47:12Z |
2941 | MERGED | Add an alternative solution on MacOS | 2024-04-05T03:10:57Z |
2911 | MERGED | Store visibility properly in ExternalTypeItem: Fixes #2897 | 2024-03-09T22:46:59Z |
2895 | MERGED | Add error emitting when we can't resolve id expr | 2024-03-01T10:40:34Z |
2874 | MERGED | First stab at issue 2855 by splitting the two maps | 2024-02-25T21:13:02Z |
2871 | MERGED | Fix FixMe in changing return type of builtin_macro_from_string() from BuiltinMacro to tl::optional/ | 2024-02-23T21:22:58Z |
The merged/filed rate is 22/25. Half of the PRs are easy to fix / fixable within a short amount of time (Code maintanence aspect). The other half is medium in difficulty, related to my summer project (Project aspect).
Introspection
Thinking back about the summer internship, I think I wasted a lot of time setting up dev envs, compiling and testing codes. Coding and building gcc/gccrs on a Macbook really sucks since the build step is confusing and there isn't a clear guide on how to do it. Compiling and testing requires a lot of time and for a person with ADHD, everytime I press that <space>b button, my mind goes to YouTube and Discord and it really disrupts my flow; I wish getting ADHD meds in America was easier.
As past Jasmine used to say:
idk its just hard to do stuff, i'm programming and it takes like x to compile and y minutes to test so i can't focus and then i go and change sth to test out my theory i have to wait like a bit for it to compile and test and then i just don't have any ideas cause i forgot them already and then an email comes in or a zulip msg comes in from my mentor and then fuck now i check them and then i was like "ok now what do i do" then the cycle continues
On the other hand, I did learn a lot. I learned how necessary it is to let the compiler do the work for you and how to design the software / compiler in a way that takes advantage of this as much as possible. This also applies to general stuff in my day to day tasks. Another thing is learning and using your tooling very well. This applies to neovim, git, bash shell, docker , etc etc etc; A more in-depth mastery of these tools allows me to iterate the development cycle faster and save more time to browse cute transbian on twitter :)
End words
It's been a blessing to contribute to gccrs this summer (and get paid for it hehe). I am mentored by Arthur Cohen and Pierre-Emmanuel "PEP" Patry; Arthur helped me with the direction of the project and code reviews while Pierre-Emmanuel provided me with code infrastructure navigation and PR code-reviews, both of which are much needed.
I am looking for internships/new grad gigs for 2025 in compiler and would love to connect with new people and be informed of new opportunities. Please contact me at either:
- tanghocle456@gmail.com (for job posting)
- jjasmine@berkeley.edu (for job posting)
- https://x.com/thisisjjasmine (if you like sapphic posting and compiler content)
Thank you for reading :)