GNU Mes and the 0.28 release
本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。
Ekaitz’s tech blog: I make stuff at ElenQ Technology and I talk about it. It’s been a while since the latest blog post in the series but we have been working very hard behind the scenes. This means I’ll probably forget a few things from all we did, but there’s a good reason for that: we were making a release.
Ekaitz 的技术博客:我在 ElenQ Technology 搞开发,并在此分享心得。距离本系列的上一篇博文已经过去一段时间了,但我们在幕后一直在努力工作。这意味着我可能会遗漏掉我们所做的一些事情,但理由很充分:我们正在准备发布版本。
Background: This is the first official and serious release I make as a (co-)maintainer, and the whole thing makes me uncomfortable. Even though people treat me as an expert programmer sometimes, there are many things in programming that I struggle a lot with. The first one, that I think I improved on in the last few years, is writing software from scratch. The second is delivering things to people. This is normal, as all my career has been focused on R&D and that’s the way I’ve been trained to work.
背景:这是我作为(联合)维护者所做的第一个正式且严肃的发布,整个过程让我感到不适。尽管有时人们把我当作专家程序员,但在编程方面我仍有许多感到吃力的地方。第一点是我认为过去几年有所进步的——从零开始编写软件;第二点是向他人交付成果。这很正常,因为我的整个职业生涯都专注于研发,而我受到的训练也是如此。
In the case of this specific release, something inside me still thinks my most valuable contribution was that: the idea and demonstration that this attempt could work. Most of my career has been based on learning in a short time period the right amount of information so I can achieve a reasonable result. Then I normally move on to the next project. Thinking about that, trying to read through my feelings, I started to realize more and more that whatever that drives me is pushing me to somewhere else, maybe to those parts I struggle more with…
就这次发布而言,我内心深处仍认为我最有价值的贡献在于:提出并证明了这一尝试是可行的。我的大部分职业生涯都建立在短时间内学习适量信息以达成合理结果的基础上,之后我通常会转向下一个项目。思考这些,并试图理清自己的感受时,我开始愈发意识到,驱动我的某种力量正将我推向别处,也许是推向那些我更感到吃力的领域……
Releases: Releasing code is important. It’s the only way to make people actually enjoy the result of your work. I have no problem to admit I struggle with this. As an R&D guy I’ve always considered myself an “enabler”. I do something, I show how it is done and let people learn from it and actually implement it. That’s fine in some contexts but it has been driving me to some level of frustration recently, as the size of the projects I take part in grow.
发布:发布代码很重要。这是让人们真正享受到你工作成果的唯一途径。我毫不避讳承认我在这一点上感到困难。作为一名研发人员,我一直认为自己是一个“赋能者”。我做一些事情,展示它是如何完成的,并让人们从中学习并付诸实践。这在某些情况下没问题,但随着我参与的项目规模不断扩大,这最近让我感到有些沮丧。
An example of this is the RISC-V bootstrap on Guix. I spent a couple of years of my life working on it. We made a working bootstrap for live-bootstrap. But it’s not yet included in Guix because I delegated the final step. Now, even after the years I spent on that, all the sleepless nights and everything, it’s something I cannot enjoy fully, and you cannot enjoy at all. This “my job here is done” mentality is not enough for me anymore. The kind of projects I do now deserve something else. I deserve better. You deserve better.
一个例子是 Guix 上的 RISC-V 引导程序。我花了几年的时间在上面。我们为 live-bootstrap 制作了一个可用的引导程序,但它尚未被纳入 Guix,因为我把最后一步委托出去了。现在,即使在我投入了多年心血、经历了无数不眠之夜后,这依然是我无法完全享受、而你们根本无法享用的成果。“我的工作完成了”这种心态对我来说已经不够了。我现在所做的项目值得更好的对待。我值得更好的,你们也值得更好的。
GNU Mes: In Mes I had like 300 commits in a branch, pretty ugly, doing, undoing and redoing some stuff over and over again. The whole codebase was upside down, the commit messages were sometimes good and sometimes lacking, I had fixup commits that fixed things that were changed so much the amount of conflicts the reordering produced was overwhelming… It was a mess. It was me trying new things, learning and cleaning things up as I went. My arborescent thought process at its fullest.
GNU Mes:在 Mes 项目中,我有一个分支里大约有 300 次提交,非常混乱,反复地做、撤销、重做某些事情。整个代码库被搞得天翻地覆,提交信息有时详尽有时缺失,我还有一些修复提交,用来修正那些被改动得面目全非的内容,以至于重新排序产生的冲突量令人难以承受……那简直是一团糟。那是我在尝试新事物、边学边清理的过程。这是我树状思维过程的极致体现。
In my usual way of doing things, I decided to promise NlNet a release, something I’ve never done before. Once the bytecode adventure was done, showing some good performance improvement was possible and that Janneke made me a co-maintainer, it was the only acceptable thing to do. But, if I wanted to do it, I would need to slow down. Thankfully, Tim is with me.
按照我一贯的行事风格,我决定向 NlNet 承诺一个发布版本,这是我从未做过的事情。一旦字节码的冒险结束,证明了性能提升是可能的,且 Janneke 让我担任联合维护者,这就是唯一可行的做法了。但是,如果我想完成它,我就必须放慢脚步。幸运的是,Tim 与我同行。
In the last part of the bytecode adventures, you remember how we included Popsyntax, and we reworked the whole macro expansion game. That wasn’t me, but Tim Sample. I don’t remember very well how he joined my efforts here but I guess I bothered him with questions because he’s a long term Mes contributor and he’s also the author of Popsyntax, the Germ scheme implementation and many interesting things more. He decided to start over. Chose a Mes release and walked through my steps. Removed the macro expander from the internals and wrote one in Scheme. From there, the direction was set.
在字节码冒险的最后阶段,你还记得我们是如何引入 Popsyntax 并重构了整个宏展开机制的吗?那不是我,而是 Tim Sample。我不记得他是如何加入我的工作的,但我猜是我用问题烦扰了他,因为他是 Mes 的长期贡献者,也是 Popsyntax、Germ Scheme 实现以及许多其他有趣项目的作者。他决定从头开始,选择了一个 Mes 版本并重走了我的步骤。他从内部移除了宏展开器,并用 Scheme 重写了一个。从那时起,方向就确定了。
I worked through the huge branch that I had, removing the stuff that turned out to be unnecessary, and he took over the git history, and made sure that every single commit was working. I cannot imagine how many conflicts the guy has been resolving. But damn this looks good now.
我处理了我那个庞大的分支,删除了那些被证明是不必要的内容,而他接管了 Git 历史记录,并确保每一次提交都能正常工作。我无法想象他解决了多少冲突。但该死,现在看起来真不错。
GNU Mes 0.28: This week, I released GNU Mes 0.28. The first release that I do as a GNU maintainer. Janneke has been guiding me through the whole process — including the part of publishing the website to GNU using CVS. I’m sure I would’ve never been able to figure out everything on my own. What a ride it has been! But after more than a year of work, I’m very happy that most of the comments on the release have been positive, specially the ones from people that I worked with and I have a huge respect for.
GNU Mes 0.28:本周,我发布了 GNU Mes 0.28。这是我作为 GNU 维护者所做的第一次发布。Janneke 在整个过程中一直指导我——包括使用 CVS 将网站发布到 GNU 的部分。我确信如果靠我自己,永远无法搞定这一切。这一路走来真是跌宕起伏!但在一年多的工作之后,我很高兴看到关于此次发布的大多数评论都是积极的,尤其是来自那些我曾共事过且非常尊敬的人们的评价。
But, what will you find in GNU Mes 0.28 that we didn’t mention in the blog yet? M2-Planet, MesCC and GCC: First of all, the main difference from the earlier blogpost is now Mes can be compiled with both M2-Planet and MesCC, and also with GCC as before. It’s a tricky process, because the error reporting is very limited (I’m being benevolent here), and I was being a very nasty boy with some gotos inside switch statements. After some wrestling with allowed C syntax, I figured it out.
那么,在 GNU Mes 0.28 中,有哪些我们之前在博客中未提及的内容呢?M2-Planet、MesCC 和 GCC:首先,与之前博文的主要区别在于,现在 Mes 既可以用 M2-Planet 编译,也可以用 MesCC 编译,当然也可以像以前一样用 GCC 编译。这是一个棘手的过程,因为错误报告非常有限(我这里说得还算客气),而且我在 switch 语句中使用了一些 goto 语句,表现得非常糟糕。在与允许使用的 C 语法进行了一番博弈后,我终于搞定了。
M2-Planet is limited, and we had to leave some things out. When Mes is compiled with M2-Planet it doesn’t have support for errors (aka exceptions) and those abort the interpreter, this is because M2-Planet’s C library doesn’t include setjmp. The stack operations had also to be rewritten as functions for M2-Planet, as the macros with array access were too complex for it. With that, Mes is a little bit slower when compiled with M2-Planet. None of those are a big deal because that’s only the starting point of the bootstrap process and Mes is rebuilt with MesCC right after it.
M2-Planet 功能有限,我们不得不舍弃一些东西。当 Mes 使用 M2-Planet 编译时,它不支持错误(即异常),这些错误会导致解释器中止,这是因为 M2-Planet 的 C 库不包含 setjmp。栈操作也必须重写为 M2-Planet 的函数,因为带有数组访问的宏对它来说太复杂了。因此,当使用 M2-Planet 编译时,Mes 的速度会慢一点。这些都不是什么大问题,因为这只是引导过程的起点,Mes 紧接着就会用 MesCC 重新构建。
Mes C lib: The 0.28 release has been tested on real RISC-V hardware that I have access to, uncovering a few issues here and there in the Mes C Library. First, the assembly parts that take care of program initialization in RISC-V (written by myself a few years ago, when I was working on the bootstrap) were broken. setjmp and longjmp that we use for error…
Mes C 库:0.28 版本已经在我有权访问的真实 RISC-V 硬件上进行了测试,发现了 Mes C 库中存在的一些零星问题。首先,负责 RISC-V 程序初始化的汇编部分(几年前我从事引导程序工作时编写的)损坏了。我们用于错误处理的 setjmp 和 longjmp……