stage2 大量优化代码使其自举编译时间大幅缩短
This commit is contained in:
1 parent
e02b0c633a
commit
846f441e3a
38 files changed
+2418
-835
No files matched your search
+4
-7
@@ -9,7 +9,7 @@
|
||||
|
||||
type .{ .Error, .Status } = @import("utils/error.spl");
|
||||
type .{ .Vec } = @import("utils/vec.spl");
|
||||
type .{ .Map } = @import("utils/map.spl");
|
||||
type .{ .Map, .hash_kind_usize } = @import("utils/map.spl");
|
||||
type .{ .ByteView } = @import("utils/byte_view.spl");
|
||||
type .{ .ByteBuffer } = @import("utils/byte_buffer.spl");
|
||||
type .{ .append_usize } = @import("utils/fmt.spl");
|
||||
@@ -69,11 +69,8 @@ type SemaResult = enum {
|
||||
// ---- 小工具 ----
|
||||
|
||||
fn list_at(v: Vec, i: usize): usize {
|
||||
match Vec.get(&v, i) {
|
||||
.Ok(ptr) => { ret (ptr as *usize).*; },
|
||||
.Err(error) => { ret 0; },
|
||||
}
|
||||
ret 0;
|
||||
if i >= v.len { ret 0; }
|
||||
ret ((v.data as *usize) + i).*;
|
||||
}
|
||||
|
||||
fn push_u(v: *Vec, x: usize) {
|
||||
@@ -234,7 +231,7 @@ fn new(ast: *Ast, diag: *Diag): SemaResult {
|
||||
.current_loop_break_tid = 0,
|
||||
.label_stack = Vec.blank(@sizeof(ByteView), @alignof(ByteView)),
|
||||
.ir_to_lang = Map.new(@sizeof(usize), @alignof(usize), @sizeof(usize), @alignof(usize),
|
||||
hash_usize, eq_usize),
|
||||
hash_kind_usize()),
|
||||
};
|
||||
ret .Ok(s);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user