From dd253e564832e467f50455df879b16ce32298df6 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Tue, 17 Mar 2026 09:48:23 +0300 Subject: [PATCH] all: vfmt 4 files --- vlib/builtin/vgc_d_vgc.c.v | 16 ++++++++-------- vlib/goroutines/chan.v | 10 +++++----- vlib/goroutines/examples/goroutine_benchmark.v | 10 ++++++---- vlib/v2/transformer/transformer.v | 16 ++++++++++------ 4 files changed, 29 insertions(+), 23 deletions(-) diff --git a/vlib/builtin/vgc_d_vgc.c.v b/vlib/builtin/vgc_d_vgc.c.v index 7b195e126..9d1cb456b 100644 --- a/vlib/builtin/vgc_d_vgc.c.v +++ b/vlib/builtin/vgc_d_vgc.c.v @@ -70,14 +70,14 @@ const vgc_phase_sweep = u32(3) // Translated from Go's runtime.mspan. struct VGC_Span { mut: - base usize // start address of the span - npages u32 // number of pages in this span - elem_size u32 // size of each object in bytes - nelems u32 // number of elements (objects) in the span - class_idx u8 // size class index (0 for large objects) - noscan bool // true if objects contain no pointers (noscan variant) - in_use bool // true if span is allocated to a size class - has_ptrmap bool // true if ptrmap is valid (precise scanning available) + base usize // start address of the span + npages u32 // number of pages in this span + elem_size u32 // size of each object in bytes + nelems u32 // number of elements (objects) in the span + class_idx u8 // size class index (0 for large objects) + noscan bool // true if objects contain no pointers (noscan variant) + in_use bool // true if span is allocated to a size class + has_ptrmap bool // true if ptrmap is valid (precise scanning available) // Pointer bitmap: bit N = word offset N contains a pointer. // Covers objects up to 512 bytes (64 words on 64-bit). // For larger objects, falls back to conservative scanning. diff --git a/vlib/goroutines/chan.v b/vlib/goroutines/chan.v index ef282404d..14a5c8152 100644 --- a/vlib/goroutines/chan.v +++ b/vlib/goroutines/chan.v @@ -20,11 +20,11 @@ module goroutines pub struct Chan { pub mut: mu SpinLock // protects all fields (spinlock is ucontext-safe) - qcount u32 // total data in the queue - dataqsiz u32 // size of the circular buffer - buf voidptr // circular buffer for buffered channels - elemsize u16 // size of each element - closed bool // true if channel is closed + qcount u32 // total data in the queue + dataqsiz u32 // size of the circular buffer + buf voidptr // circular buffer for buffered channels + elemsize u16 // size of each element + closed bool // true if channel is closed sendx u32 // send index into circular buffer recvx u32 // receive index into circular buffer diff --git a/vlib/goroutines/examples/goroutine_benchmark.v b/vlib/goroutines/examples/goroutine_benchmark.v index 41801135b..d84fff428 100644 --- a/vlib/goroutines/examples/goroutine_benchmark.v +++ b/vlib/goroutines/examples/goroutine_benchmark.v @@ -52,7 +52,8 @@ fn bench_fan_out_fan_in(n int) { elapsed := sw.elapsed() us := elapsed.microseconds() ns_per := elapsed.nanoseconds() / n - C.printf(c'fan-out/fan-in %d goroutines: %lld us (%lld ns/goroutine)\n', n, us, ns_per) + C.printf(c'fan-out/fan-in %d goroutines: %lld us (%lld ns/goroutine)\n', n, us, + ns_per) } // --- ping-pong --- @@ -90,7 +91,8 @@ fn bench_ping_pong(n int) { elapsed := sw.elapsed() us := elapsed.microseconds() ns_per := elapsed.nanoseconds() / n - C.printf(c'ping-pong %d round-trips: %lld us (%lld ns/round-trip)\n', n, us, ns_per) + C.printf(c'ping-pong %d round-trips: %lld us (%lld ns/round-trip)\n', n, us, + ns_per) } // --- contended channel --- @@ -131,8 +133,8 @@ fn bench_contended_channel(num_producers int, msgs_per_producer int) { elapsed := sw.elapsed() us := elapsed.microseconds() ns_per := elapsed.nanoseconds() / total - C.printf(c'contended chan %d producers x %d msgs: %lld us (%lld ns/msg)\n', - num_producers, msgs_per_producer, us, ns_per) + C.printf(c'contended chan %d producers x %d msgs: %lld us (%lld ns/msg)\n', num_producers, + msgs_per_producer, us, ns_per) } fn main() { diff --git a/vlib/v2/transformer/transformer.v b/vlib/v2/transformer/transformer.v index 0387392c8..90cf09d4c 100644 --- a/vlib/v2/transformer/transformer.v +++ b/vlib/v2/transformer/transformer.v @@ -9110,9 +9110,11 @@ fn (mut t Transformer) generate_go_wrapper_functions() []ast.Stmt { args: [ ast.Expr(ast.KeywordOperator{ op: .key_sizeof - exprs: [ast.Expr(ast.Ident{ - name: struct_name - })] + exprs: [ + ast.Expr(ast.Ident{ + name: struct_name + }), + ] }), ] }), @@ -9182,9 +9184,11 @@ fn (mut t Transformer) generate_go_wrapper_functions() []ast.Stmt { }), ast.Expr(ast.KeywordOperator{ op: .key_sizeof - exprs: [ast.Expr(ast.Ident{ - name: struct_name - })] + exprs: [ + ast.Expr(ast.Ident{ + name: struct_name + }), + ] }), ] } -- 2.39.5