authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-30 19:12:05-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-30 19:12:05-07:00
log20145016ac0d098e8e63d5107a05eca376d1e7bb
tree9fa59538541c7a92a5b593a248d00ec8be06f87d
parentea4ef832e364d48b4670c71d948782df12e5e4ca
parent56cfa8f22f69d813efedb1fa01fdcb7077ca0e5a

Merge remote-tracking branch 'origin/master' into llvm15


6 files changed, 113 insertions(+), 10 deletions(-)

ci/drone/linux_script_finalize+2-1
......@@ -19,7 +19,8 @@ pip3 install s3cmd
1919cd build
2020
2121mv ../LICENSE "$INSTALL_PREFIX/"
22mv ../zig-cache/langref.html "$INSTALL_PREFIX/"
22# https://github.com/ziglang/zig/issues/12689
23# mv ../zig-cache/langref.html "$INSTALL_PREFIX/"
2324mv "$INSTALL_PREFIX/bin/zig" "$INSTALL_PREFIX/"
2425rmdir "$INSTALL_PREFIX/bin"
2526
ci/drone/test_linux_behavior+3-1
......@@ -7,8 +7,10 @@ INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
77ZIG="$INSTALL_PREFIX/bin/zig"
88export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
99
10# Tracking issue for the disabled tests:
1011# https://github.com/ziglang/zig/issues/12689
12
1113# $ZIG build test-behavior -Dskip-non-native --zig-lib-dir lib
1214$ZIG build test-compiler-rt -Dskip-non-native --zig-lib-dir lib
1315$ZIG build test-fmt --zig-lib-dir lib
14$ZIG build docs --zig-lib-dir lib
16# $ZIG build docs --zig-lib-dir lib
ci/drone/test_linux_misc+4-2
......@@ -7,10 +7,12 @@ INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
77ZIG="$INSTALL_PREFIX/bin/zig"
88export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
99
10$ZIG build test-universal-libc -Dskip-non-native --zig-lib-dir lib
10# Tracking issue for the disabled tests:
1111# https://github.com/ziglang/zig/issues/12689
12
13$ZIG build test-universal-libc -Dskip-non-native --zig-lib-dir lib
1214# $ZIG build test-compare-output -Dskip-non-native --zig-lib-dir lib
13$ZIG build test-standalone -Dskip-non-native --zig-lib-dir lib -Dskip-release-safe
15# $ZIG build test-standalone -Dskip-non-native --zig-lib-dir lib -Dskip-release-safe
1416$ZIG build test-stack-traces -Dskip-non-native --zig-lib-dir lib
1517$ZIG build test-cli -Dskip-non-native --zig-lib-dir lib
1618$ZIG build test-asm-link -Dskip-non-native --zig-lib-dir lib
lib/std/coff.zig+78
......@@ -310,6 +310,84 @@ pub const ImageDataDirectory = extern struct {
310310 size: u32,
311311};
312312
313pub const BaseRelocationDirectoryEntry = extern struct {
314 /// The image base plus the page RVA is added to each offset to create the VA where the base relocation must be applied.
315 page_rva: u32,
316
317 /// The total number of bytes in the base relocation block, including the Page RVA and Block Size fields and the Type/Offset fields that follow.
318 block_size: u32,
319};
320
321pub const BaseRelocation = packed struct {
322 /// Stored in the remaining 12 bits of the WORD, an offset from the starting address that was specified in the Page RVA field for the block.
323 /// This offset specifies where the base relocation is to be applied.
324 offset: u12,
325
326 /// Stored in the high 4 bits of the WORD, a value that indicates the type of base relocation to be applied.
327 @"type": BaseRelocationType,
328};
329
330pub const BaseRelocationType = enum(u4) {
331 /// The base relocation is skipped. This type can be used to pad a block.
332 ABSOLUTE = 0,
333
334 /// The base relocation adds the high 16 bits of the difference to the 16-bit field at offset. The 16-bit field represents the high value of a 32-bit word.
335 HIGH = 1,
336
337 /// The base relocation adds the low 16 bits of the difference to the 16-bit field at offset. The 16-bit field represents the low half of a 32-bit word.
338 LOW = 2,
339
340 /// The base relocation applies all 32 bits of the difference to the 32-bit field at offset.
341 HIGHLOW = 3,
342
343 /// The base relocation adds the high 16 bits of the difference to the 16-bit field at offset.
344 /// The 16-bit field represents the high value of a 32-bit word.
345 /// The low 16 bits of the 32-bit value are stored in the 16-bit word that follows this base relocation.
346 /// This means that this base relocation occupies two slots.
347 HIGHADJ = 4,
348
349 /// When the machine type is MIPS, the base relocation applies to a MIPS jump instruction.
350 MIPS_JMPADDR = 5,
351
352 /// This relocation is meaningful only when the machine type is ARM or Thumb.
353 /// The base relocation applies the 32-bit address of a symbol across a consecutive MOVW/MOVT instruction pair.
354 // ARM_MOV32 = 5,
355
356 /// This relocation is only meaningful when the machine type is RISC-V.
357 /// The base relocation applies to the high 20 bits of a 32-bit absolute address.
358 // RISCV_HIGH20 = 5,
359
360 /// Reserved, must be zero.
361 RESERVED = 6,
362
363 /// This relocation is meaningful only when the machine type is Thumb.
364 /// The base relocation applies the 32-bit address of a symbol to a consecutive MOVW/MOVT instruction pair.
365 THUMB_MOV32 = 7,
366
367 /// This relocation is only meaningful when the machine type is RISC-V.
368 /// The base relocation applies to the low 12 bits of a 32-bit absolute address formed in RISC-V I-type instruction format.
369 // RISCV_LOW12I = 7,
370
371 /// This relocation is only meaningful when the machine type is RISC-V.
372 /// The base relocation applies to the low 12 bits of a 32-bit absolute address formed in RISC-V S-type instruction format.
373 RISCV_LOW12S = 8,
374
375 /// This relocation is only meaningful when the machine type is LoongArch 32-bit.
376 /// The base relocation applies to a 32-bit absolute address formed in two consecutive instructions.
377 // LOONGARCH32_MARK_LA = 8,
378
379 /// This relocation is only meaningful when the machine type is LoongArch 64-bit.
380 /// The base relocation applies to a 64-bit absolute address formed in four consecutive instructions.
381 // LOONGARCH64_MARK_LA = 8,
382
383 /// The relocation is only meaningful when the machine type is MIPS.
384 /// The base relocation applies to a MIPS16 jump instruction.
385 MIPS_JMPADDR16 = 9,
386
387 /// The base relocation applies the difference to the 64-bit field at offset.
388 DIR64 = 10,
389};
390
313391pub const DebugDirectoryEntry = extern struct {
314392 characteristics: u32,
315393 time_date_stamp: u32,
src/Module.zig+16
......@@ -1496,6 +1496,22 @@ pub const Fn = struct {
14961496 /// active Sema context. Importantly, this value is also updated when an existing
14971497 /// generic function instantiation is found and called.
14981498 branch_quota: u32,
1499
1500 /// If this is not none, this function is a generic function instantiation, and
1501 /// this is the generic function decl from which the instance was derived.
1502 /// This information is redundant with a combination of checking if comptime_args is
1503 /// not null and looking at the first decl dependency of owner_decl. This redundant
1504 /// information is useful for three reasons:
1505 /// 1. Improved perf of monomorphed_funcs when checking the eql() function because it
1506 /// can do two fewer pointer chases by grabbing the info from this field directly
1507 /// instead of accessing the decl and then the dependencies set.
1508 /// 2. While a generic function instantiation is being initialized, we need hash()
1509 /// and eql() to work before the initialization is complete. Completing the
1510 /// insertion into the decl dependency set has more fallible operations than simply
1511 /// setting this field.
1512 /// 3. I forgot what the third thing was while typing up the other two.
1513 generic_owner_decl: Decl.OptionalIndex,
1514
14991515 state: Analysis,
15001516 is_cold: bool = false,
15011517 is_noinline: bool,
src/Sema.zig+10-6
......@@ -5590,11 +5590,10 @@ const GenericCallAdapter = struct {
55905590
55915591 pub fn eql(ctx: @This(), adapted_key: void, other_key: *Module.Fn) bool {
55925592 _ = adapted_key;
5593 // The generic function Decl is guaranteed to be the first dependency
5594 // of each of its instantiations.
5595 const other_owner_decl = ctx.module.declPtr(other_key.owner_decl);
5596 const generic_owner_decl = other_owner_decl.dependencies.keys()[0];
5597 if (ctx.generic_fn.owner_decl != generic_owner_decl) return false;
5593 // Checking for equality may happen on an item that has been inserted
5594 // into the map but is not yet fully initialized. In such case, the
5595 // two initialized fields are `hash` and `generic_owner_decl`.
5596 if (ctx.generic_fn.owner_decl != other_key.generic_owner_decl.unwrap().?) return false;
55985597
55995598 const other_comptime_args = other_key.comptime_args.?;
56005599 for (other_comptime_args[0..ctx.func_ty_info.param_types.len]) |other_arg, i| {
......@@ -6447,11 +6446,14 @@ fn instantiateGenericCall(
64476446 const gop = try mod.monomorphed_funcs.getOrPutAdapted(gpa, {}, adapter);
64486447 const callee = if (!gop.found_existing) callee: {
64496448 const new_module_func = try gpa.create(Module.Fn);
6449 errdefer gpa.destroy(new_module_func);
6450
64506451 // This ensures that we can operate on the hash map before the Module.Fn
64516452 // struct is fully initialized.
64526453 new_module_func.hash = precomputed_hash;
6454 new_module_func.generic_owner_decl = module_fn.owner_decl.toOptional();
6455 new_module_func.comptime_args = null;
64536456 gop.key_ptr.* = new_module_func;
6454 errdefer gpa.destroy(new_module_func);
64556457 errdefer assert(mod.monomorphed_funcs.remove(new_module_func));
64566458
64576459 try namespace.anon_decls.ensureUnusedCapacity(gpa, 1);
......@@ -8032,11 +8034,13 @@ fn funcCommon(
80328034 } else null;
80338035
80348036 const hash = new_func.hash;
8037 const generic_owner_decl = if (comptime_args == null) .none else new_func.generic_owner_decl;
80358038 const fn_payload = try sema.arena.create(Value.Payload.Function);
80368039 new_func.* = .{
80378040 .state = anal_state,
80388041 .zir_body_inst = func_inst,
80398042 .owner_decl = sema.owner_decl_index,
8043 .generic_owner_decl = generic_owner_decl,
80408044 .comptime_args = comptime_args,
80418045 .hash = hash,
80428046 .lbrace_line = src_locs.lbrace_line,