Compiler knowedge -- gcc & mem management
来源:互联网 发布:深圳龙华行知小学网站 编辑:程序博客网 时间:2024/06/09 20:38
The project about compiler?
This is source address: http://code.google.com/p/afe/wiki/ThinkingInAFE
Introduction
My comments on compiler writing
Details
on gcc
I had learned gcc in the year 2010 for several months. gcc is huge andthe code is hard to understand. It is possible to understand a certainpart of the code base, just leave other parts as abstractions.Basically,I read the codes on tree and parser. Even this part is stillvery hard to follow. They mixed lots of other interfaces, for e.g. themiddle end(gimple). For a software, if you cannot see the overallarchitecture, you cannot understand it well. I also had read somepapers of gcc summit and others'. Most of the time, the code is notdirectly expressing the meanings but for a common purpose aim, the codeintends to support as many as possible languages and targets. Till now,gcc becomes a huge system that needs a person many many time to masterthe source code well. I learned some software design skills in gcc, butthere are too much waiting there for me to decode. gcc documents arenot written well and I think the code itself is just the only rightplace to start with. Although I got some benefit from studying gccsource code, but now I will stop and change my direction to some smallscale compilers. I think to learn a small compiler source code willbenefit me much more than digging into gcc. Sometimes I even considerto learn gccv1 or v2, but I think some of the code is not worth tolearn. In the early version of gcc, the parser is generated by bison,no need to learn bison tool. So, I will miss some very good or goodsoftware techniques for not studying gcc, it is a pity. But I do nothave so much time to learn it well. My goal is to learn compilertechniques and concentrate much of my time on myself project. To writecodes, to create something useful and cool is where the happy shouldhappened, but not reading some good software code again and again. Ishould create my own things. I will stop reading gcc source code rightnow(2011/07/25) and go to other compiler. Concentrate more on the basictheories on AFE.
I will put my thoughts on learning other compilertechniques here. These thoughts should be a combination of booktheories and a practical compiler implementation details.
memory management and symbol table
Memory is a hot area for research. There are lots of ways to manage thememory.Whatever the way is, the basic semantics are "malloc" and"free". For efficiency, compiler, game engine and some kinds ofapplications have implemented special memory manage method. Whenthinking about symbol table, it is not very hard to implement and youjust define the suitable structures for the programming elements andmake some links between the elements. But when truely implementingit,it is hard. There are lots of details to cover. For example, thetype is a part that needs to be a hard consideration:
struct people
long int
int* const p
ret(int* p,...)
The above are types. Compiler should define the suitable structure that can describe these types.
using tools or hand craft
There are a bunch of compiler construction tools, each one has itsusing semantics. It is good that you can use these tools to quicklybuild something. It is bad that you loss the absolute control of yourcode, you have to obey the rules that tool enforced. Sometimes you wantto solve a problem on theory but firstly you should think about a wayof hacking that tool to make your research easily.There are lots oftricks on using the tool, you have to goole some certain usage of thattool. You can use tools to build models of your application, let yourapplication run first. In the long run, hand craft everything and getall the control of the code is the real programming.
code::blocks error
I do not know if this is an error of code blocks. But when I deleted abunch of comments in source code. An fatal inconvenience isdismissed.With those comments, when I change some bits of a grammarheader, the whole project will be compiled again, but it is really noneed to do this.
- Compiler knowedge -- gcc & mem management
- mem management
- compiler.h & compiler-gcc.h分析
- compiler.h & compiler-gcc.h分析
- mem
- Using GCC’s C++ Compiler
- Using GCC’s C++ Compiler
- Using GCC’s C++ Compiler
- GCC=GNU Compiler Collection
- Using GCC’s C++ Compiler
- Using GCC’s C++ Compiler
- Using GCC’s C++ Compiler
- GCC the GNU Compiler Collection
- GCC, LLVM, and compiler plugins
- GCC, the GNU Compiler Collection
- GCC Explorer - An Interactive Compiler
- Using GCC’s C++ Compiler
- GCC主要数据结构之compiler
- 工作笔记2012-1-4号前
- hdu 1217 map+floyd
- 0年级码农的2011年终总结
- 局域网聊天软件的设计思路
- jQuery调用WCF
- Compiler knowedge -- gcc & mem management
- WebGL three.js
- hive脚本运行查看错误日志方式
- 我要反三俗
- AIDL文件中 in类型和out类型数据的区别
- Cover flow基本原理及Tapku实现方法
- 身份证号码的测试
- GlusterFS分析
- Glusterfs 源码分析后随笔