Skip to content

Commit

Permalink
ci: merges spectests into normal make test (#2273)
Browse files Browse the repository at this point in the history
Previously, only specification tests are run separately
from the rest of the tests just to run in a separate
GHA workflow (named spectest) to have a badge to brag.
This used to unnecessarily use CI resources, and no need to
do so anymore.

Signed-off-by: Takeshi Yoneda <[email protected]>
  • Loading branch information
mathetake authored Jun 27, 2024
1 parent f937311 commit 77222b7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 113 deletions.
92 changes: 0 additions & 92 deletions .github/workflows/spectest.yaml

This file was deleted.

13 changes: 1 addition & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ build.spectest.threads:

.PHONY: test
test:
@go test $(go_test_options) $$(go list ./... | grep -vE '$(spectest_v1_dir)|$(spectest_v2_dir)')
@go test $(go_test_options) ./...
@cd internal/version/testdata && go test $(go_test_options) ./...
@cd internal/integration_test/fuzz/wazerolib && CGO_ENABLED=0 WASM_BINARY_PATH=testdata/test.wasm go test ./...

Expand All @@ -178,17 +178,6 @@ coverage: ## Generate test coverage
@go test -coverprofile=coverage.txt -covermode=atomic --coverpkg=$(coverpkg) $(main_packages)
@go tool cover -func coverage.txt

.PHONY: spectest
spectest:
@$(MAKE) spectest.v1
@$(MAKE) spectest.v2

spectest.v1:
@go test $(go_test_options) $$(go list ./... | grep $(spectest_v1_dir))

spectest.v2:
@go test $(go_test_options) $$(go list ./... | grep $(spectest_v2_dir))

golangci_lint_path := $(shell go env GOPATH)/bin/golangci-lint

$(golangci_lint_path):
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# wazero: the zero dependency WebAssembly runtime for Go developers

[![WebAssembly Core Specification Test](https://github.com/tetratelabs/wazero/actions/workflows/spectest.yaml/badge.svg)](https://github.com/tetratelabs/wazero/actions/workflows/spectest.yaml) [![Go Reference](https://pkg.go.dev/badge/github.com/tetratelabs/wazero.svg)](https://pkg.go.dev/github.com/tetratelabs/wazero) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Go Reference](https://pkg.go.dev/badge/github.com/tetratelabs/wazero.svg)](https://pkg.go.dev/github.com/tetratelabs/wazero) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

WebAssembly is a way to safely run code compiled in other languages. Runtimes
execute WebAssembly Modules (Wasm), which are most often binaries with a `.wasm`
Expand Down
26 changes: 18 additions & 8 deletions internal/engine/interpreter/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -3901,14 +3901,9 @@ func (ce *callEngine) callNativeFunc(ctx context.Context, m *wasm.ModuleInstance
case operationKindV128Dot:
x2Hi, x2Lo := ce.popValue(), ce.popValue()
x1Hi, x1Lo := ce.popValue(), ce.popValue()
ce.pushValue(
uint64(uint32(int32(int16(x1Lo>>0))*int32(int16(x2Lo>>0))+int32(int16(x1Lo>>16))*int32(int16(x2Lo>>16)))) |
(uint64(uint32(int32(int16(x1Lo>>32))*int32(int16(x2Lo>>32))+int32(int16(x1Lo>>48))*int32(int16(x2Lo>>48)))) << 32),
)
ce.pushValue(
uint64(uint32(int32(int16(x1Hi>>0))*int32(int16(x2Hi>>0))+int32(int16(x1Hi>>16))*int32(int16(x2Hi>>16)))) |
(uint64(uint32(int32(int16(x1Hi>>32))*int32(int16(x2Hi>>32))+int32(int16(x1Hi>>48))*int32(int16(x2Hi>>48)))) << 32),
)
lo, hi := v128Dot(x1Hi, x1Lo, x2Hi, x2Lo)
ce.pushValue(lo)
ce.pushValue(hi)
frame.pc++
case operationKindV128ITruncSatFromF:
hi, lo := ce.popValue(), ce.popValue()
Expand Down Expand Up @@ -4584,3 +4579,18 @@ func (ce *callEngine) callGoFuncWithStack(ctx context.Context, m *wasm.ModuleIns
ce.stack = ce.stack[0 : len(ce.stack)-shrinkLen]
}
}

// v128Dot performs a dot product of two 64-bit vectors.
// Note: for some reason (which I suspect is due to a bug in Go compiler's regalloc),
// inlining this function causes a bug which happens **only when** we run with -race AND arm64 AND Go 1.22.
func v128Dot(x1Hi, x1Lo, x2Hi, x2Lo uint64) (uint64, uint64) {
r1 := int32(int16(x1Lo>>0)) * int32(int16(x2Lo>>0))
r2 := int32(int16(x1Lo>>16)) * int32(int16(x2Lo>>16))
r3 := int32(int16(x1Lo>>32)) * int32(int16(x2Lo>>32))
r4 := int32(int16(x1Lo>>48)) * int32(int16(x2Lo>>48))
r5 := int32(int16(x1Hi>>0)) * int32(int16(x2Hi>>0))
r6 := int32(int16(x1Hi>>16)) * int32(int16(x2Hi>>16))
r7 := int32(int16(x1Hi>>32)) * int32(int16(x2Hi>>32))
r8 := int32(int16(x1Hi>>48)) * int32(int16(x2Hi>>48))
return uint64(uint32(r1+r2)) | (uint64(uint32(r3+r4)) << 32), uint64(uint32(r5+r6)) | (uint64(uint32(r7+r8)) << 32)
}

0 comments on commit 77222b7

Please sign in to comment.