Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion lib/compiler/aro/aro/Builtins/Builtin.zig
Original file line numberDiff line numberDiff line change
Expand Up@@ -5165,7 +5165,7 @@ const dafsa = [_]Node{
.{ .char = 'e', .end_of_word = false, .end_of_list = true, .number = 1, .child_index = 4913 },
};
pub const data = blk: {
@setEvalBranchQuota(3986);
@setEvalBranchQuota(30_000);
break :blk [_]@This(){
// _Block_object_assign
.{ .tag = @enumFromInt(0), .properties = .{ .param_str = "vv*vC*iC", .header = .blocks, .attributes = .{ .lib_function_without_prefix = true } } },
Expand Down
2 changes: 2 additions & 0 deletions lib/compiler/aro/aro/Parser.zig
Original file line numberDiff line numberDiff line change
Expand Up@@ -4802,6 +4802,7 @@ const CallExpr = union(enum) {
}

fn shouldPromoteVarArg(self: CallExpr, arg_idx: u32) bool {
@setEvalBranchQuota(2000);
return switch (self) {
.standard => true,
.builtin => |builtin| switch (builtin.tag) {
Expand DownExpand Up@@ -4902,6 +4903,7 @@ const CallExpr = union(enum) {
}

fn returnType(self: CallExpr, p: *Parser, callable_ty: Type) Type {
@setEvalBranchQuota(6000);
return switch (self) {
.standard => callable_ty.returnType(),
.builtin => |builtin| switch (builtin.tag) {
Expand Down
2 changes: 2 additions & 0 deletions lib/std/crypto/aes/soft.zig
Original file line numberDiff line numberDiff line change
Expand Up@@ -629,6 +629,8 @@ fn generateSbox(invert: bool) [256]u8 {

// Generate lookup tables.
fn generateTable(invert: bool) [4][256]u32 {
@setEvalBranchQuota(50000);

var table: [4][256]u32 = undefined;

for (generateSbox(invert), 0..) |value, index| {
Expand Down
4 changes: 2 additions & 2 deletions lib/std/crypto/blake2.zig
Original file line numberDiff line numberDiff line change
Expand Up@@ -786,7 +786,7 @@ test "blake2b384 streaming" {

test "comptime blake2b384" {
comptime {
@setEvalBranchQuota(10000);
@setEvalBranchQuota(20000);
var block = [_]u8{0} ** Blake2b384.block_length;
var out: [Blake2b384.digest_length]u8 = undefined;

Expand DownExpand Up@@ -878,7 +878,7 @@ test "blake2b512 keyed" {

test "comptime blake2b512" {
comptime {
@setEvalBranchQuota(10000);
@setEvalBranchQuota(12000);
var block = [_]u8{0} ** Blake2b512.block_length;
var out: [Blake2b512.digest_length]u8 = undefined;

Expand Down
2 changes: 1 addition & 1 deletion lib/std/crypto/pcurves/p384.zig
Original file line numberDiff line numberDiff line change
Expand Up@@ -393,7 +393,7 @@ pub const P384 = struct {
}

const basePointPc = pc: {
@setEvalBranchQuota(50000);
@setEvalBranchQuota(70000);
break :pc precompute(P384.basePoint, 15);
};

Expand Down
2 changes: 1 addition & 1 deletion lib/std/enums.zig
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,7 @@ const testing = std.testing;
const EnumField = std.builtin.Type.EnumField;

/// Increment this value when adding APIs that add single backwards branches.
const eval_branch_quota_cushion = 5;
const eval_branch_quota_cushion = 10;

/// Returns a struct with a field matching each unique named enum element.
/// If the enum is extern and has multiple names for the same value, only
Expand Down
2 changes: 1 addition & 1 deletion lib/std/hash/xxhash.zig
Original file line numberDiff line numberDiff line change
Expand Up@@ -890,7 +890,7 @@ test "xxhash32 smhasher" {
}
};
try Test.do();
@setEvalBranchQuota(75000);
@setEvalBranchQuota(85000);
comptime try Test.do();
}

Expand Down
24 changes: 8 additions & 16 deletions lib/std/math.zig
Original file line numberDiff line numberDiff line change
Expand Up@@ -749,31 +749,23 @@ test rotl {
try testing.expect(rotl(@Vector(1, u32), @Vector(1, u32){1 << 31}, @as(isize, -1))[0] == @as(u32, 1) << 30);
}

/// Returns an unsigned int type that can hold the number of bits in T
/// - 1. Suitable for 0-based bit indices of T.
/// Returns an unsigned int type that can hold the number of bits in T - 1.
/// Suitable for 0-based bit indices of T.
pub fn Log2Int(comptime T: type) type {
// comptime ceil log2
if (T == comptime_int) return comptime_int;
comptime var count = 0;
comptime var s = @typeInfo(T).Int.bits - 1;
inline while (s != 0) : (s >>= 1) {
count += 1;
}

return std.meta.Int(.unsigned, count);
const bits: u16 = @typeInfo(T).Int.bits;
const log2_bits = 16 - @clz(bits - 1);
return std.meta.Int(.unsigned, log2_bits);
}

/// Returns an unsigned int type that can hold the number of bits in T.
pub fn Log2IntCeil(comptime T: type) type {
// comptime ceil log2
if (T == comptime_int) return comptime_int;
comptime var count = 0;
comptime var s = @typeInfo(T).Int.bits;
inline while (s != 0) : (s >>= 1) {
count += 1;
}

return std.meta.Int(.unsigned, count);
const bits: u16 = @typeInfo(T).Int.bits;
const log2_bits = 16 - @clz(bits);
return std.meta.Int(.unsigned, log2_bits);
}

/// Returns the smallest integer type that can hold both from and to.
Expand Down
1 change: 1 addition & 0 deletions lib/std/math/hypot.zig
Original file line numberDiff line numberDiff line change
Expand Up@@ -114,6 +114,7 @@ test "hypot.precise" {
}

test "hypot.special" {
@setEvalBranchQuota(2000);
inline for (.{ f16, f32, f64, f128 }) |T| {
try expect(math.isNan(hypot(nan(T), 0.0)));
try expect(math.isNan(hypot(0.0, nan(T))));
Expand Down
2 changes: 1 addition & 1 deletion lib/std/math/nextafter.zig
Original file line numberDiff line numberDiff line change
Expand Up@@ -144,7 +144,7 @@ test "int" {
}

test "float" {
@setEvalBranchQuota(3000);
@setEvalBranchQuota(4000);

// normal -> normal
try expect(nextAfter(f16, 0x1.234p0, 2.0) == 0x1.238p0);
Expand Down
1 change: 1 addition & 0 deletions lib/std/unicode.zig
Original file line numberDiff line numberDiff line change
Expand Up@@ -535,6 +535,7 @@ fn testUtf16CountCodepoints() !void {
}

test "utf16 count codepoints" {
@setEvalBranchQuota(2000);
try testUtf16CountCodepoints();
try comptime testUtf16CountCodepoints();
}
Expand Down
Loading