mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 13:03:39 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 14121f4b0e | |||
| 7768195835 | |||
| c095b7e9c4 | |||
| 1f6d34d995 | |||
| 9951eb9990 | |||
| c8f77d26a8 |
@@ -64,7 +64,6 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
build-contexts: tinygo-llvm-build=docker-image://tinygo/llvm-17
|
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
- name: Trigger Drivers repo build on Github Actions
|
- name: Trigger Drivers repo build on Github Actions
|
||||||
|
|||||||
+15
-1
@@ -1,3 +1,17 @@
|
|||||||
|
0.31.1
|
||||||
|
---
|
||||||
|
|
||||||
|
* **general**
|
||||||
|
* fix Binaryen build in make task
|
||||||
|
* update final build stage of Docker `dev` image to go1.22
|
||||||
|
* only use GHA cache for building Docker `dev` image
|
||||||
|
* update the `net` submodule to latest version
|
||||||
|
|
||||||
|
* **compiler**
|
||||||
|
* `interp`: make getelementptr offsets signed
|
||||||
|
* `interp`: return a proper error message when indexing out of range
|
||||||
|
|
||||||
|
|
||||||
0.31.0
|
0.31.0
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -64,7 +78,7 @@
|
|||||||
* `mksnanov3`: add support for the MKS Robin Nano V3.x
|
* `mksnanov3`: add support for the MKS Robin Nano V3.x
|
||||||
* `nrf52840-generic`: add generic nrf52840 chip support
|
* `nrf52840-generic`: add generic nrf52840 chip support
|
||||||
* `thumby`: add support for Thumby
|
* `thumby`: add support for Thumby
|
||||||
* `wasm`: add new `wasm-generic` target that doesn't depend on WASI or a browser
|
* `wasm`: add new `wasm-unknown` target that doesn't depend on WASI or a browser
|
||||||
* **boards**
|
* **boards**
|
||||||
* `arduino-mkrwifi1010`, `arduino-nano33`, `nano-rp2040`, `matrixportal-m4`, `metro-m4-airlift`, `pybadge`, `pyportal`: add `ninafw` build tag and some constants for BLE support
|
* `arduino-mkrwifi1010`, `arduino-nano33`, `nano-rp2040`, `matrixportal-m4`, `metro-m4-airlift`, `pybadge`, `pyportal`: add `ninafw` build tag and some constants for BLE support
|
||||||
* `gopher-badge`: fix typo in USB product name
|
* `gopher-badge`: fix typo in USB product name
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ RUN cd /tinygo/ && \
|
|||||||
|
|
||||||
# tinygo-compiler copies the compiler build over to a base Go container (without
|
# tinygo-compiler copies the compiler build over to a base Go container (without
|
||||||
# all the build tools etc).
|
# all the build tools etc).
|
||||||
FROM golang:1.21 AS tinygo-compiler
|
FROM golang:1.22 AS tinygo-compiler
|
||||||
|
|
||||||
# Copy tinygo build.
|
# Copy tinygo build.
|
||||||
COPY --from=tinygo-compiler-build /tinygo/build/release/tinygo /tinygo
|
COPY --from=tinygo-compiler-build /tinygo/build/release/tinygo /tinygo
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// Version of TinyGo.
|
// Version of TinyGo.
|
||||||
// Update this value before release of new version of software.
|
// Update this value before release of new version of software.
|
||||||
const version = "0.31.0"
|
const version = "0.31.1"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// This variable is set at build time using -ldflags parameters.
|
// This variable is set at build time using -ldflags parameters.
|
||||||
|
|||||||
+23
-9
@@ -427,7 +427,11 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, mem, r.errorAt(inst, err)
|
return nil, mem, r.errorAt(inst, err)
|
||||||
}
|
}
|
||||||
methodSetPtr, err := mem.load(typecodePtr.addOffset(-int64(r.pointerSize)), r.pointerSize).asPointer(r)
|
typecodePtrOffset, err := typecodePtr.addOffset(-int64(r.pointerSize))
|
||||||
|
if err != nil {
|
||||||
|
return nil, mem, r.errorAt(inst, err) // unlikely
|
||||||
|
}
|
||||||
|
methodSetPtr, err := mem.load(typecodePtrOffset, r.pointerSize).asPointer(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, mem, r.errorAt(inst, err)
|
return nil, mem, r.errorAt(inst, err)
|
||||||
}
|
}
|
||||||
@@ -473,7 +477,11 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, mem, r.errorAt(inst, err)
|
return nil, mem, r.errorAt(inst, err)
|
||||||
}
|
}
|
||||||
methodSetPtr, err := mem.load(typecodePtr.addOffset(-int64(r.pointerSize)), r.pointerSize).asPointer(r)
|
typecodePtrOffset, err := typecodePtr.addOffset(-int64(r.pointerSize))
|
||||||
|
if err != nil {
|
||||||
|
return nil, mem, r.errorAt(inst, err)
|
||||||
|
}
|
||||||
|
methodSetPtr, err := mem.load(typecodePtrOffset, r.pointerSize).asPointer(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, mem, r.errorAt(inst, err)
|
return nil, mem, r.errorAt(inst, err)
|
||||||
}
|
}
|
||||||
@@ -636,11 +644,11 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
|
|||||||
case llvm.GetElementPtr:
|
case llvm.GetElementPtr:
|
||||||
// GetElementPtr does pointer arithmetic, changing the offset of the
|
// GetElementPtr does pointer arithmetic, changing the offset of the
|
||||||
// pointer into the underlying object.
|
// pointer into the underlying object.
|
||||||
var offset uint64
|
var offset int64
|
||||||
for i := 1; i < len(operands); i += 2 {
|
for i := 1; i < len(operands); i += 2 {
|
||||||
index := operands[i].Uint()
|
index := operands[i].Int()
|
||||||
elementSize := operands[i+1].Uint()
|
elementSize := operands[i+1].Int()
|
||||||
if int64(elementSize) < 0 {
|
if elementSize < 0 {
|
||||||
// This is a struct field.
|
// This is a struct field.
|
||||||
offset += index
|
offset += index
|
||||||
} else {
|
} else {
|
||||||
@@ -654,11 +662,14 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
|
|||||||
return nil, mem, r.errorAt(inst, err)
|
return nil, mem, r.errorAt(inst, err)
|
||||||
}
|
}
|
||||||
// GEP on fixed pointer value (for example, memory-mapped I/O).
|
// GEP on fixed pointer value (for example, memory-mapped I/O).
|
||||||
ptrValue := operands[0].Uint() + offset
|
ptrValue := operands[0].Uint() + uint64(offset)
|
||||||
locals[inst.localIndex] = makeLiteralInt(ptrValue, int(operands[0].len(r)*8))
|
locals[inst.localIndex] = makeLiteralInt(ptrValue, int(operands[0].len(r)*8))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ptr = ptr.addOffset(int64(offset))
|
ptr, err = ptr.addOffset(int64(offset))
|
||||||
|
if err != nil {
|
||||||
|
return nil, mem, r.errorAt(inst, err)
|
||||||
|
}
|
||||||
locals[inst.localIndex] = ptr
|
locals[inst.localIndex] = ptr
|
||||||
if r.debug {
|
if r.debug {
|
||||||
fmt.Fprintln(os.Stderr, indent+"gep:", operands, "->", ptr)
|
fmt.Fprintln(os.Stderr, indent+"gep:", operands, "->", ptr)
|
||||||
@@ -756,7 +767,10 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent
|
|||||||
if inst.opcode == llvm.Add {
|
if inst.opcode == llvm.Add {
|
||||||
// This likely means this is part of a
|
// This likely means this is part of a
|
||||||
// unsafe.Pointer(uintptr(ptr) + offset) pattern.
|
// unsafe.Pointer(uintptr(ptr) + offset) pattern.
|
||||||
lhsPtr = lhsPtr.addOffset(int64(rhs.Uint()))
|
lhsPtr, err = lhsPtr.addOffset(int64(rhs.Uint()))
|
||||||
|
if err != nil {
|
||||||
|
return nil, mem, r.errorAt(inst, err)
|
||||||
|
}
|
||||||
locals[inst.localIndex] = lhsPtr
|
locals[inst.localIndex] = lhsPtr
|
||||||
} else if inst.opcode == llvm.Xor && rhs.Uint() == 0 {
|
} else if inst.opcode == llvm.Xor && rhs.Uint() == 0 {
|
||||||
// Special workaround for strings.noescape, see
|
// Special workaround for strings.noescape, see
|
||||||
|
|||||||
+3
-3
@@ -517,12 +517,12 @@ func (v pointerValue) offset() uint32 {
|
|||||||
// addOffset essentially does a GEP operation (pointer arithmetic): it adds the
|
// addOffset essentially does a GEP operation (pointer arithmetic): it adds the
|
||||||
// offset to the pointer. It also checks that the offset doesn't overflow the
|
// offset to the pointer. It also checks that the offset doesn't overflow the
|
||||||
// maximum offset size (which is 4GB).
|
// maximum offset size (which is 4GB).
|
||||||
func (v pointerValue) addOffset(offset int64) pointerValue {
|
func (v pointerValue) addOffset(offset int64) (pointerValue, error) {
|
||||||
result := pointerValue{v.pointer + uint64(offset)}
|
result := pointerValue{v.pointer + uint64(offset)}
|
||||||
if checks && v.index() != result.index() {
|
if checks && v.index() != result.index() {
|
||||||
panic("interp: offset out of range")
|
return result, fmt.Errorf("interp: offset %d out of range for object %v", offset, v)
|
||||||
}
|
}
|
||||||
return result
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v pointerValue) len(r *runner) uint32 {
|
func (v pointerValue) len(r *runner) uint32 {
|
||||||
|
|||||||
Vendored
+7
@@ -10,6 +10,8 @@ target triple = "x86_64--linux"
|
|||||||
@main.exposedValue1 = global i16 0
|
@main.exposedValue1 = global i16 0
|
||||||
@main.exposedValue2 = global i16 0
|
@main.exposedValue2 = global i16 0
|
||||||
@main.insertedValue = global {i8, i32, {float, {i64, i16}}} zeroinitializer
|
@main.insertedValue = global {i8, i32, {float, {i64, i16}}} zeroinitializer
|
||||||
|
@main.gepArray = global [8 x i8] zeroinitializer
|
||||||
|
@main.negativeGEP = global ptr null
|
||||||
|
|
||||||
declare void @runtime.printint64(i64) unnamed_addr
|
declare void @runtime.printint64(i64) unnamed_addr
|
||||||
|
|
||||||
@@ -88,6 +90,11 @@ entry:
|
|||||||
%agg2 = insertvalue {i8, i32, {float, {i64, i16}}} %agg, i64 5, 2, 1, 0
|
%agg2 = insertvalue {i8, i32, {float, {i64, i16}}} %agg, i64 5, 2, 1, 0
|
||||||
store {i8, i32, {float, {i64, i16}}} %agg2, ptr @main.insertedValue
|
store {i8, i32, {float, {i64, i16}}} %agg2, ptr @main.insertedValue
|
||||||
|
|
||||||
|
; negative GEP instruction
|
||||||
|
%ngep1 = getelementptr [8 x i8], ptr @main.negativeGEP, i32 0, i32 5
|
||||||
|
%ngep2 = getelementptr [8 x i8], ptr %ngep1, i32 0, i32 -3
|
||||||
|
store ptr %ngep2, ptr @main.negativeGEP
|
||||||
|
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
@@ -9,6 +9,8 @@ target triple = "x86_64--linux"
|
|||||||
@main.exposedValue1 = global i16 0
|
@main.exposedValue1 = global i16 0
|
||||||
@main.exposedValue2 = local_unnamed_addr global i16 0
|
@main.exposedValue2 = local_unnamed_addr global i16 0
|
||||||
@main.insertedValue = local_unnamed_addr global { i8, i32, { float, { i64, i16 } } } zeroinitializer
|
@main.insertedValue = local_unnamed_addr global { i8, i32, { float, { i64, i16 } } } zeroinitializer
|
||||||
|
@main.gepArray = local_unnamed_addr global [8 x i8] zeroinitializer
|
||||||
|
@main.negativeGEP = global ptr getelementptr inbounds (i8, ptr @main.negativeGEP, i64 2)
|
||||||
|
|
||||||
declare void @runtime.printint64(i64) unnamed_addr
|
declare void @runtime.printint64(i64) unnamed_addr
|
||||||
|
|
||||||
|
|||||||
+1
-1
Submodule src/net updated: c134160ae4...fcee4f5c46
Reference in New Issue
Block a user