Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stage1 caching #1494

Merged
merged 22 commits into from
Sep 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2d4b959
stage1: import blake2b implementation
andrewrk Sep 4, 2018
97c9f61
start creating a hash of input parameters
andrewrk Sep 5, 2018
b4d5d4d
assume evenly divided base64
andrewrk Sep 6, 2018
173fc84
basic compiler id hash working
andrewrk Sep 9, 2018
c0bdcc7
`zig id` command
andrewrk Sep 10, 2018
fbe5737
stage1: always optimize blake and softfloat even in debug mode
andrewrk Sep 10, 2018
32be6e9
caching is working
andrewrk Sep 10, 2018
5ee5933
stage1 caching: zig no longer uses zig-cache
andrewrk Sep 10, 2018
67735c6
ability to disable cache. off by default except for...
andrewrk Sep 11, 2018
4af8447
Merge remote-tracking branch 'origin/master' into stage1-caching
andrewrk Sep 11, 2018
15c67d2
fix docgen tests
andrewrk Sep 11, 2018
9227315
zig build: better placement of test exe artifact
andrewrk Sep 11, 2018
a1132ff
stage1: build blake code with -std=c99
andrewrk Sep 11, 2018
1a4dcf1
darwin fixups
andrewrk Sep 11, 2018
04dc5cd
zig build: make the cache root dir before building
andrewrk Sep 11, 2018
7e9f25d
stage1: clean up timing report in test mode
andrewrk Sep 12, 2018
25466ff
Merge remote-tracking branch 'origin/master' into stage1-caching
andrewrk Sep 12, 2018
ee263a1
bring back zig-cache
andrewrk Sep 12, 2018
014cc60
rename --enable-timing-info to -ftime-report to match clang
andrewrk Sep 12, 2018
ff0b7fe
error messages for attempted cache when zig cannot perfectly do it
andrewrk Sep 12, 2018
1caa48c
windows os.cpp implementations
andrewrk Sep 12, 2018
3a49d11
fix zig build cache dir path
andrewrk Sep 12, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ if(MSVC)
)
else()
set_target_properties(embedded_softfloat PROPERTIES
COMPILE_FLAGS "-std=c99"
COMPILE_FLAGS "-std=c99 -O3"
)
endif()
target_include_directories(embedded_softfloat PUBLIC
Expand All @@ -409,7 +409,9 @@ set(ZIG_SOURCES
"${CMAKE_SOURCE_DIR}/src/bigint.cpp"
"${CMAKE_SOURCE_DIR}/src/buffer.cpp"
"${CMAKE_SOURCE_DIR}/src/c_tokenizer.cpp"
"${CMAKE_SOURCE_DIR}/src/cache_hash.cpp"
"${CMAKE_SOURCE_DIR}/src/codegen.cpp"
"${CMAKE_SOURCE_DIR}/src/compiler.cpp"
"${CMAKE_SOURCE_DIR}/src/errmsg.cpp"
"${CMAKE_SOURCE_DIR}/src/error.cpp"
"${CMAKE_SOURCE_DIR}/src/ir.cpp"
Expand All @@ -424,6 +426,9 @@ set(ZIG_SOURCES
"${CMAKE_SOURCE_DIR}/src/util.cpp"
"${CMAKE_SOURCE_DIR}/src/translate_c.cpp"
)
set(BLAKE_SOURCES
"${CMAKE_SOURCE_DIR}/src/blake2b.c"
)
set(ZIG_CPP_SOURCES
"${CMAKE_SOURCE_DIR}/src/zig_llvm.cpp"
"${CMAKE_SOURCE_DIR}/src/windows_sdk.cpp"
Expand Down Expand Up @@ -790,6 +795,7 @@ else()
set(EXE_CFLAGS "${EXE_CFLAGS} -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -fno-exceptions -fno-rtti -Werror=strict-prototypes -Werror=old-style-definition -Werror=type-limits -Wno-missing-braces")
endif()

set(BLAKE_CFLAGS "-std=c99")

set(EXE_LDFLAGS " ")
if(MINGW)
Expand All @@ -811,6 +817,11 @@ set_target_properties(zig_cpp PROPERTIES
COMPILE_FLAGS ${EXE_CFLAGS}
)

add_library(embedded_blake STATIC ${BLAKE_SOURCES})
set_target_properties(embedded_blake PROPERTIES
COMPILE_FLAGS "${BLAKE_CFLAGS} -O3"
)

add_executable(zig ${ZIG_SOURCES})
set_target_properties(zig PROPERTIES
COMPILE_FLAGS ${EXE_CFLAGS}
Expand All @@ -819,6 +830,7 @@ set_target_properties(zig PROPERTIES

target_link_libraries(zig LINK_PUBLIC
zig_cpp
embedded_blake
${SOFTFLOAT_LIBRARIES}
${CLANG_LIBRARIES}
${LLD_LIBRARIES}
Expand Down
3 changes: 2 additions & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ pub fn build(b: *Builder) !void {
var docgen_exe = b.addExecutable("docgen", "doc/docgen.zig");

const rel_zig_exe = try os.path.relative(b.allocator, b.build_root, b.zig_exe);
const langref_out_path = os.path.join(b.allocator, b.cache_root, "langref.html") catch unreachable;
var docgen_cmd = b.addCommand(null, b.env_map, [][]const u8{
docgen_exe.getOutputPath(),
rel_zig_exe,
"doc" ++ os.path.sep_str ++ "langref.html.in",
os.path.join(b.allocator, b.cache_root, "langref.html") catch unreachable,
langref_out_path,
});
docgen_cmd.step.dependOn(&docgen_exe.step);

Expand Down
7 changes: 7 additions & 0 deletions doc/docgen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const max_doc_file_size = 10 * 1024 * 1024;
const exe_ext = std.build.Target(std.build.Target.Native).exeFileExt();
const obj_ext = std.build.Target(std.build.Target.Native).oFileExt();
const tmp_dir_name = "docgen_tmp";
const test_out_path = tmp_dir_name ++ os.path.sep_str ++ "test" ++ exe_ext;

pub fn main() !void {
var direct_allocator = std.heap.DirectAllocator.init();
Expand Down Expand Up @@ -821,6 +822,8 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
zig_exe,
"test",
tmp_source_file_name,
"--output",
test_out_path,
});
try out.print("<pre><code class=\"shell\">$ zig test {}.zig", code.name);
switch (code.mode) {
Expand Down Expand Up @@ -863,6 +866,8 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
"--color",
"on",
tmp_source_file_name,
"--output",
test_out_path,
});
try out.print("<pre><code class=\"shell\">$ zig test {}.zig", code.name);
switch (code.mode) {
Expand Down Expand Up @@ -918,6 +923,8 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
zig_exe,
"test",
tmp_source_file_name,
"--output",
test_out_path,
});
switch (code.mode) {
builtin.Mode.Debug => {},
Expand Down
Loading