January 2009 Archives

今年 1 月 27 日发表的 《GCC运行环境豁免条款 (英文版)》 再次狠狠地打了苹果的耳光。

原先的豁免条款如下:

// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.

新的豁免条款则强调了一些新增的限制。我们关注其中的两段,定义:

A Compilation Process is "Eligible" if it is done using GCC, alone or with other GPL-compatible software, or if it is done without using any work based on GCC. For example, using non-GPL-compatible Software to optimize any GCC intermediate representations would not qualify as an Eligible Compilation Process.

授权:

You have permission to propagate a work of Target Code formed by combining the Runtime Library with Independent Modules, even if such propagation would otherwise violate the terms of GPLv3, provided that all Target Code was generated by Eligible Compilation Processes. You may then convey such a combination under terms of your choice, consistent with the licensing of the Independent Modules.

这些条款是希望打击类似 llvm-gcc 这样的妥协产物,llvm-gcc使用gcc前端,并使用llvm的优化器来优化生成的代码。当然,这些条款本身并不直接导致 llvm-gcc 项目的问题,但其间接后果是人们无法继续通过改良 llvm 来改善 gcc 的优化结果,更具体地说,相当于是给了向 gcc 投资多年并贡献了相当多代码的 Apple 公司一记响亮的耳光。

这是意料之中的事情(去年 LLVM 在 Cupertino 召开峰会的时候,llvm-gcc已经基本停止开发,而 clang 的开发则热火朝天地进行并得到了大量资助),也更加坚定了为 llvm/clang 投资的商业公司离开 gcc 的决心。FSF完成了这场争议中自己的历史使命,双方从此各走各路了。

Progress on LLVM clang

| 1 Comment | No TrackBacks

As some of you already know, FreeBSD, along with some other Open Source projects, is moving away from GCC due to GPLv3. From a technology perspective, this also makes sense since the (likely) candidate, BSD-style licensed, LLVM based clang, a C compiler, is making reasonably good progress.

So, what should we expect from LLVM or clang?

Here is a good comparison between GCC and clang. Despite GCC is popular, considerably more mature, and supports more languages (especially C++, which clang's support is incomplete at this moment), clang provides cleaner AST (Abstract Syntax Tree), much more modularized (if you take a look at GCC's history, Richard Stallman intentionally made GCC's code not reusable in other software), provided much more information for optimizer, is much faster and use much less memory, etc.

For FreeBSD, currently, clang can compile its kernel with only very few tweaks.

New strlen(3) committed

| 1 Comment | No TrackBacks

Finally, I got my strlen(3) [1] committed against -HEAD. This is a long story, to put it short, I had proposed assembly version of some string operations at the point of 2005, but these was never committed due to a hard disk failure, and as Bruce pointed out, having the hand optimized assembly code use a different algorithm is not good in general.

Therefore, I have take some time on it and reimplemented the idea in C, resulting in a portable (say, you can use it on any 32-bit or 64-bit processors, and it can be easily extended to 128-bit) version.

So, is it important for *YOU*?

Generally speaking, it should not. Performance sensitive programs should, by all means, avoid C style string operations. Think a 5x better strlen(3) would boost performance of your application since it uses strlen(3) in critical path? Think again!

However, I found it valuable. There is difference in worldstone, where I saw some minor improvements. Micro-benchmark indicates that this version is at most 2x slower when the string is very short, but 5x faster for strings that is at least word-length long.

[1] Note: the version has been further revised to provide better comment and match style(9).

Happy Niu (牛) Year!

| 3 Comments | No TrackBacks

Ok so it's something that happen only once in 12 years - this year, we have the Bull as totem of the lunar year in China, the pronounciation of the Chinese character, "牛" is very similar to English word "new".

So, happy new year, and happy 牛 year, my friends.

今天讲个小故事

| 4 Comments | No TrackBacks

忘记在哪里看到的了,应该是小时候看过的某本书。先不要管故事的合理性,我只是想说明一个很简单的道理。

说从前有一个国王,他有两个儿子,这两个儿子总是互相攀比,搞的国王头疼不已。

有一天,国王想出了一个主意。他把两个儿子带到沙漠边上,给了他们一个人一匹马。他对两个儿子说,你们两个穿过这片沙漠,但是今天不要比谁的马快,我要比的是你们谁的马后走出沙漠,后走出沙漠的人就可以得到王位。

两个儿子在沙漠里互相抱怨着父王的这个馊主意。突然,哥哥灵机一动,对弟弟说了几句话。

接着,两个人骑马飞奔而去。

故事讲完了,你知道哥哥的主意是什么吗?

প্রাণ

| 8 Comments | No TrackBacks

ভুলবো না আর সহজেতে
সেই প্রাণে মন উঠবে মেতে
মৃত্যু মাঝে ঢাকা আছে
যে অন্তহীন প্রাণ
বজ্রে তোমার বাজে বাঁশি
সেকি সহজ গান
সেই সুরেতে জাগবো আমি
সেই ঝড় যেন সই আনন্দে
চিত্তবীণার তারে
সপ্তসিন্ধু দশ দিগন্ত
নাচাও যে ঝঙ্কারে
বজ্রে তোমার বাজে বাঁশি
সেকি সহজ গান
সেই সুরেতে জাগবো আমি

很不错。有空发中文大意。

2009硬盘磨损年开始

| 2 Comments | No TrackBacks

第三块硬盘了......

许多老派的 FreeBSD 用户喜欢用源代码方式升级。运行了十多年的基于 cvsup 的同步机制由于有很多镜像支持因此一直没有遇到太大的问题,但是 FreeBSD 6.1 开始引入的 freebsd-update 提供了新的以二进制形式更新系统的方法,最近几年 FreeBSD 内核的许多改进已经使编译自定义的内核不再像以前那样重要了。

最近几天发布的 FreeBSD 7.1-RELEASE 引发了升级的热潮。由于 7.1-RELEASE 导致的流量冲击,而现存的 freebsd-update 服务器和 portsnap-master 是同一台,导致现在 portsnap 服务不太正常。目前 security officer 已经在建立新的 FreeBSD update 服务器。

Monthly Archives

Pages

OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.2.3