ci: use llgo test instead
ci: use llgo test instead
This commit is contained in:
@@ -10,14 +10,6 @@ import (
|
||||
//go:linkname getsp llgo.stackSave
|
||||
func getsp() unsafe.Pointer
|
||||
|
||||
// link here for testing
|
||||
//
|
||||
//go:linkname memset C.memset
|
||||
func memset(unsafe.Pointer, int, uintptr) unsafe.Pointer
|
||||
|
||||
//go:linkname memcpy C.memcpy
|
||||
func memcpy(unsafe.Pointer, unsafe.Pointer, uintptr)
|
||||
|
||||
//go:linkname _heapStart _heapStart
|
||||
var _heapStart [0]byte
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
package tinygogc
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
_ "unsafe"
|
||||
)
|
||||
|
||||
@@ -22,14 +21,3 @@ var _stackStart [0]byte
|
||||
var _globals_start [0]byte
|
||||
|
||||
var _globals_end [0]byte
|
||||
|
||||
//go:linkname memclrNoHeapPointers runtime.memclrNoHeapPointers
|
||||
func memclrNoHeapPointers(unsafe.Pointer, uintptr) unsafe.Pointer
|
||||
|
||||
//go:linkname memcpy runtime.memmove
|
||||
func memcpy(to unsafe.Pointer, from unsafe.Pointer, size uintptr)
|
||||
|
||||
func memset(ptr unsafe.Pointer, n int, size uintptr) unsafe.Pointer {
|
||||
memclrNoHeapPointers(ptr, size)
|
||||
return ptr
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ func initGC() {
|
||||
endBlock = (uintptr(metadataStart) - heapStart) / bytesPerBlock
|
||||
stackTop = uintptr(unsafe.Pointer(&_stackStart))
|
||||
|
||||
memset(metadataStart, 0, metadataSize)
|
||||
c.Memset(metadataStart, 0, metadataSize)
|
||||
}
|
||||
|
||||
func lazyInit() {
|
||||
@@ -339,7 +339,7 @@ func Alloc(size uintptr) unsafe.Pointer {
|
||||
}
|
||||
unlock(&gcMutex)
|
||||
// Return a pointer to this allocation.
|
||||
return memset(gcPointerOf(thisAlloc), 0, size)
|
||||
return c.Memset(gcPointerOf(thisAlloc), 0, size)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -363,7 +363,7 @@ func Realloc(ptr unsafe.Pointer, size uintptr) unsafe.Pointer {
|
||||
}
|
||||
|
||||
newAlloc := Alloc(size)
|
||||
memcpy(newAlloc, ptr, oldSize)
|
||||
c.Memcpy(newAlloc, ptr, oldSize)
|
||||
free(ptr)
|
||||
|
||||
return newAlloc
|
||||
|
||||
@@ -5,6 +5,8 @@ package tinygogc
|
||||
import (
|
||||
"testing"
|
||||
"unsafe"
|
||||
|
||||
c "github.com/goplus/llgo/runtime/internal/clite"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -95,7 +97,7 @@ func (env *mockGCEnv) setupMockGC() {
|
||||
endBlock = (uintptr(metadataStart) - heapStart) / bytesPerBlock
|
||||
|
||||
// Clear metadata using memset like initGC does
|
||||
memset(metadataStart, 0, metadataSize)
|
||||
c.Memset(metadataStart, 0, metadataSize)
|
||||
|
||||
// Reset allocator state (initGC doesn't reset these, but we need to)
|
||||
nextAlloc = 0
|
||||
|
||||
Reference in New Issue
Block a user