Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 54 for cgocheck (0.21 sec)

  1. src/runtime/cgocheck.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // Code to check that pointer writes follow the cgo rules.
    // These functions are invoked when GOEXPERIMENT=cgocheck2 is enabled.
    
    package runtime
    
    import (
    	"internal/abi"
    	"internal/goarch"
    	"unsafe"
    )
    
    const cgoWriteBarrierFail = "unpinned Go pointer stored into non-Go memory"
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 09 04:07:57 UTC 2024
    - 7.6K bytes
    - Viewed (0)
  2. src/cmd/cgo/internal/testerrors/ptr_test.go

    	// executions in parallel, to avoid overloading the system.
    	runcmd := func(cgocheck string) ([]byte, error) {
    		csem <- true
    		defer func() { <-csem }()
    		x := exe
    		if cgocheck == "2" {
    			x = exe2
    			cgocheck = "1"
    		}
    		cmd := exec.Command(x, pt.name)
    		cmd.Env = append(os.Environ(), "GODEBUG=cgocheck="+cgocheck)
    		return cmd.CombinedOutput()
    	}
    
    	if pt.expensive {
    		buf, err := runcmd("1")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Aug 03 16:07:49 UTC 2023
    - 21.2K bytes
    - Viewed (0)
  3. src/runtime/runtime1.go

    							*v.value = n
    						} else if v.atomic != nil {
    							v.atomic.Store(n)
    						}
    					}
    				}
    			}
    		}
    	}
    
    	if debug.cgocheck > 1 {
    		throw("cgocheck > 1 mode is no longer supported at runtime. Use GOEXPERIMENT=cgocheck2 at build time instead.")
    	}
    }
    
    //go:linkname setTraceback runtime/debug.SetTraceback
    func setTraceback(level string) {
    	var t uint32
    	switch level {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 17:52:17 UTC 2024
    - 19.3K bytes
    - Viewed (0)
  4. src/internal/goexperiment/flags.go

    	// Arenas causes the "arena" standard library package to be visible
    	// to the outside world.
    	Arenas bool
    
    	// CgoCheck2 enables an expensive cgo rule checker.
    	// When this experiment is enabled, cgo rule checks occur regardless
    	// of the GODEBUG=cgocheck setting provided at runtime.
    	CgoCheck2 bool
    
    	// LoopVar changes loop semantics so that each iteration gets its own
    	// copy of the iteration variable.
    	LoopVar bool
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 21 16:19:47 UTC 2024
    - 4.2K bytes
    - Viewed (0)
  5. src/runtime/extern.go

    	and thereby use of AVX instructions.
    
    	cgocheck: setting cgocheck=0 disables all checks for packages
    	using cgo to incorrectly pass Go pointers to non-Go code.
    	Setting cgocheck=1 (the default) enables relatively cheap
    	checks that may miss some errors. A more complete, but slow,
    	cgocheck mode can be enabled using GOEXPERIMENT (which
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 17:52:17 UTC 2024
    - 18.9K bytes
    - Viewed (0)
  6. src/runtime/pinner_test.go

    		t.Fatal("did not panic")
    	}
    }
    
    func assertCgoCheckPanics(t *testing.T, p any) {
    	defer func() {
    		if recover() == nil {
    			t.Fatal("cgoCheckPointer() did not panic, make sure the tests run with cgocheck=1")
    		}
    	}()
    	runtime.CgoCheckPointer(p, true)
    }
    
    func TestPinnerSimple(t *testing.T) {
    	var pinner runtime.Pinner
    	p := new(obj)
    	addr := unsafe.Pointer(p)
    	if runtime.IsPinned(addr) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 13 18:36:12 UTC 2023
    - 11K bytes
    - Viewed (0)
  7. src/runtime/cgocall.go

    // pointers.)
    
    // cgoCheckPointer checks if the argument contains a Go pointer that
    // points to an unpinned Go pointer, and panics if it does.
    func cgoCheckPointer(ptr any, arg any) {
    	if !goexperiment.CgoCheck2 && debug.cgocheck == 0 {
    		return
    	}
    
    	ep := efaceOf(&ptr)
    	t := ep._type
    
    	top := true
    	if arg != nil && (t.Kind_&abi.KindMask == abi.Pointer || t.Kind_&abi.KindMask == abi.UnsafePointer) {
    		p := ep.data
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:16:47 UTC 2024
    - 24.2K bytes
    - Viewed (0)
  8. src/runtime/pinner.go

    		panic(errorString("runtime.Pinner: object was allocated into an arena"))
    	}
    	return e.data
    }
    
    // isPinned checks if a Go pointer is pinned.
    // nosplit, because it's called from nosplit code in cgocheck.
    //
    //go:nosplit
    func isPinned(ptr unsafe.Pointer) bool {
    	span := spanOfHeap(uintptr(ptr))
    	if span == nil {
    		// this code is only called for Go pointer, so this must be a
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 04 14:29:45 UTC 2024
    - 11K bytes
    - Viewed (0)
  9. src/cmd/cgo/doc.go

    controlled by the cgocheck setting of the GODEBUG environment
    variable. The default setting is GODEBUG=cgocheck=1, which implements
    reasonably cheap dynamic checks. These checks may be disabled
    entirely using GODEBUG=cgocheck=0. Complete checking of pointer
    handling, at some cost in run time, is available by setting
    GOEXPERIMENT=cgocheck2 at build time.
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 17:12:16 UTC 2024
    - 42.2K bytes
    - Viewed (0)
  10. src/runtime/crash_cgo_test.go

    	// Try it 10 times to avoid flakiness.
    	const tries = 10
    	var tot1, tot2 time.Duration
    	for i := 0; i < tries; i++ {
    		cmd := testenv.CleanCmdEnv(exec.Command(exe, "CgoCheckBytes"))
    		cmd.Env = append(cmd.Env, "GODEBUG=cgocheck=0", fmt.Sprintf("GO_CGOCHECKBYTES_TRY=%d", i))
    
    		start := time.Now()
    		cmd.Run()
    		d1 := time.Since(start)
    
    		cmd = testenv.CleanCmdEnv(exec.Command(exe, "CgoCheckBytes"))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 15 16:44:47 UTC 2024
    - 22.2K bytes
    - Viewed (0)
Back to top