Commit Graph

3 Commits

Author SHA1 Message Date
Minero Aoki d514300aef * net/loveruby/cflat/compiler/Visitor.java: make all return types generic.
* net/loveruby/cflat/compiler/TypeChecker.java: ditto.
* net/loveruby/cflat/ast/*.java: ditto.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4132 1b9489fe-b721-0410-924e-b54b9192deb8
2009-04-12 06:31:12 +00:00
Minero Aoki 043859df0b * net/loveruby/cflat/ast/ASTVisitor.java: #visit returns a node which has same type with the argument, to allow non-destructive AST rewriting.
* net/loveruby/cflat/ast/*Node.java (#accept): ditto.
* net/loveruby/cflat/compiler/Visitor.java: ditto.
* net/loveruby/cflat/compiler/*.java: ditto.
* net/loveruby/cflat/compiler/TypeChecker.java: make non-destructive.
* net/loveruby/cflat/parser/Parser.jj: use StmtNode/ExprNode instead of Node.


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4130 1b9489fe-b721-0410-924e-b54b9192deb8
2009-04-04 14:47:11 +00:00
Minero Aoki 355873c1ea * net/loveruby/cflat/parser/Parser.jj: parse sizeof expr.
* net/loveruby/cflat/compiler/Visitor.java: support SizeofTypeNode, SizeofExprNode.
* net/loveruby/cflat/compiler/TypeResolver.java: ditto.
* net/loveruby/cflat/compiler/CodeGenerator.java: ditto.
* net/loveruby/cflat/ast/ASTVisitor.java: ditto.
* net/loveruby/cflat/ast/SizeofTypeNode.java: new file.
* net/loveruby/cflat/ast/SizeofExprNode.java: new file.
* net/loveruby/cflat/type/Type.java: default alignment equals to size, not allocSize (e.g. int[4] should be aligned on 4, not 16).
* net/loveruby/cflat/type/StructType.java: element offset calculation was wrong. Elements should be aligned on its own alignment.
* net/loveruby/cflat/type/StructType.java: size calculation was wrong.  Struct size is align(last-offset, max-element-alignment).
* net/loveruby/cflat/type/UnionType.java: union's alignment equals to element's max alignment.
* net/loveruby/cflat/type/ComplexType.java: cache computed alignment.
* net/loveruby/cflat/type/ArrayType.java: array's alignment equals to elements' alignment.
* net/loveruby/cflat/ast/Slot.java: new method #allocSize, #alignment.
* net/loveruby/cflat/asm/Assembler.java: new method #align (moved from CodeGenerator).
* test


git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3999 1b9489fe-b721-0410-924e-b54b9192deb8
2008-09-06 20:10:49 +00:00