Skip to content

Commit 4161a04

Browse files
committed
WIP: redesign blocks GC
1 parent 11c2b76 commit 4161a04

11 files changed

Lines changed: 547 additions & 448 deletions

File tree

builder/sizes_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ func TestBinarySize(t *testing.T) {
4242
// This is a small number of very diverse targets that we want to test.
4343
tests := []sizeTest{
4444
// microcontrollers
45-
{"hifive1b", "examples/echo", 3705, 299, 0, 2252},
46-
{"microbit", "examples/serial", 2736, 356, 8, 2248},
47-
{"wioterminal", "examples/pininterrupt", 7960, 1652, 132, 7480},
45+
{"hifive1b", "examples/echo", 3845, 299, 0, 2260},
46+
{"microbit", "examples/serial", 2838, 354, 8, 2256},
47+
{"wioterminal", "examples/pininterrupt", 8088, 1652, 132, 7488},
4848

4949
// TODO: also check wasm. Right now this is difficult, because
5050
// wasm binaries are run through wasm-opt and therefore the

compiler/asserts.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ func (b *builder) createSliceToArrayPointerCheck(sliceLen llvm.Value, arrayLen i
9393
// and unsafe.String. This function must panic if the ptr/len parameters are
9494
// invalid.
9595
func (b *builder) createUnsafeSliceStringCheck(name string, ptr, len llvm.Value, elementType llvm.Type, lenType *types.Basic) {
96+
if b.info.nobounds {
97+
// Function disabled bounds checking - skip conversion check.
98+
return
99+
}
100+
96101
// From the documentation of unsafe.Slice and unsafe.String:
97102
// > At run time, if len is negative, or if ptr is nil and len is not
98103
// > zero, a run-time panic occurs.
@@ -162,6 +167,11 @@ func (b *builder) createChanBoundsCheck(elementSize uint64, bufSize llvm.Value,
162167
// It has no effect in well-behaved programs, but makes sure no uncaught nil
163168
// pointer dereferences exist in valid Go code.
164169
func (b *builder) createNilCheck(inst ssa.Value, ptr llvm.Value, blockPrefix string) {
170+
if b.info.nobounds {
171+
// Function disabled bounds checking - skip nil check.
172+
return
173+
}
174+
165175
// Check whether we need to emit this check at all.
166176
if !ptr.IsAGlobalValue().IsNil() {
167177
return

0 commit comments

Comments
 (0)