Этот коммит содержится в:
shivay 2023-03-24 12:22:18 +01:00 коммит произвёл Damian Gryski
родитель 4b0e56cbec
коммит d73e12db63
9 изменённых файлов: 34 добавлений и 34 удалений

Просмотреть файл

@ -416,7 +416,7 @@
- `interp`: always run atomic and volatile loads/stores at runtime - `interp`: always run atomic and volatile loads/stores at runtime
- `interp`: bump timeout to 180 seconds - `interp`: bump timeout to 180 seconds
- `interp`: handle type assertions on nil interfaces - `interp`: handle type assertions on nil interfaces
- `loader`: elminate goroot cache inconsistency - `loader`: eliminate goroot cache inconsistency
- `loader`: respect $GOROOT when running `go list` - `loader`: respect $GOROOT when running `go list`
- `transform`: allocate the correct amount of bytes in an alloca - `transform`: allocate the correct amount of bytes in an alloca
- `transform`: remove switched func lowering - `transform`: remove switched func lowering
@ -1115,7 +1115,7 @@
- `sync`: add WaitGroup - `sync`: add WaitGroup
* **targets** * **targets**
- `arm`: allow nesting in DisableInterrupts and EnableInterrupts - `arm`: allow nesting in DisableInterrupts and EnableInterrupts
- `arm`: make FPU configuraton consistent - `arm`: make FPU configuration consistent
- `arm`: do not mask fault handlers in critical sections - `arm`: do not mask fault handlers in critical sections
- `atmega2560`: fix pin mapping for pins D2, D5 and the L port - `atmega2560`: fix pin mapping for pins D2, D5 and the L port
- `atsamd`: return an error when an incorrect PWM pin is used - `atsamd`: return an error when an incorrect PWM pin is used
@ -1144,7 +1144,7 @@
- `nrf`: add microbit-s110v8 target - `nrf`: add microbit-s110v8 target
- `nrf`: fix bug in SPI.Tx - `nrf`: fix bug in SPI.Tx
- `nrf`: support debugging the PCA10056 - `nrf`: support debugging the PCA10056
- `pygamer`: add Adafruit PyGamer suport - `pygamer`: add Adafruit PyGamer support
- `riscv`: fix interrupt configuration bug - `riscv`: fix interrupt configuration bug
- `riscv`: disable linker relaxations during gp init - `riscv`: disable linker relaxations during gp init
- `stm32f4disco`: add new target with ST-Link v2.1 debugger - `stm32f4disco`: add new target with ST-Link v2.1 debugger

Просмотреть файл

@ -544,7 +544,7 @@ func (b *builder) createRunDefers() {
forwardParams = append(forwardParams, forwardParam) forwardParams = append(forwardParams, forwardParam)
} }
// Plain TinyGo functions add some extra parameters to implement async functionality and function recievers. // Plain TinyGo functions add some extra parameters to implement async functionality and function receivers.
// These parameters should not be supplied when calling into an external C/ASM function. // These parameters should not be supplied when calling into an external C/ASM function.
if !b.getFunctionInfo(callback).exported { if !b.getFunctionInfo(callback).exported {
// Add the context parameter. We know it is ignored by the receiving // Add the context parameter. We know it is ignored by the receiving

Просмотреть файл

@ -70,7 +70,7 @@ object. Every memory object is given an index, and pointers use that index to
look up the current active object for the pointer to load from or to copy look up the current active object for the pointer to load from or to copy
when storing to it. when storing to it.
Rolling back a function should roll back everyting, including the few Rolling back a function should roll back everything, including the few
instructions emitted at runtime. This is done by treating instructions much instructions emitted at runtime. This is done by treating instructions much
like memory objects and removing the created instructions when necessary. like memory objects and removing the created instructions when necessary.
@ -88,7 +88,7 @@ LLVM than initialization code. Also, there are a few other benefits:
they can be propagated and provide some opportunities for other they can be propagated and provide some opportunities for other
optimizations (like dead code elimination when branching on the contents of optimizations (like dead code elimination when branching on the contents of
a global). a global).
* Constants are much more efficent on microcontrollers, as they can be * Constants are much more efficient on microcontrollers, as they can be
allocated in flash instead of RAM. allocated in flash instead of RAM.
The Go SSA package does not create constant initializers for globals. The Go SSA package does not create constant initializers for globals.

Просмотреть файл

@ -254,7 +254,7 @@ func (r *runner) compileFunction(llvmFn llvm.Value) *function {
} }
} }
case llvm.BitCast, llvm.IntToPtr, llvm.PtrToInt: case llvm.BitCast, llvm.IntToPtr, llvm.PtrToInt:
// Bitcasts are ususally used to cast a pointer from one type to // Bitcasts are usually used to cast a pointer from one type to
// another leaving the pointer itself intact. // another leaving the pointer itself intact.
inst.name = llvmInst.Name() inst.name = llvmInst.Name()
inst.operands = []value{ inst.operands = []value{

Просмотреть файл

@ -12,7 +12,7 @@ package interp
// done in interp and results in a revert. // done in interp and results in a revert.
// //
// Right now the memory is assumed to be little endian. This will need an update // Right now the memory is assumed to be little endian. This will need an update
// for big endian arcitectures, if TinyGo ever adds support for one. // for big endian architectures, if TinyGo ever adds support for one.
import ( import (
"encoding/binary" "encoding/binary"

Просмотреть файл

@ -46,7 +46,7 @@ type channelBlockedList struct {
// t is the task associated with this channel operation. // t is the task associated with this channel operation.
// If this channel operation is not part of a select, then the pointer field of the state holds the data buffer. // If this channel operation is not part of a select, then the pointer field of the state holds the data buffer.
// If this channel operation is part of a select, then the pointer field of the state holds the recieve buffer. // If this channel operation is part of a select, then the pointer field of the state holds the receive buffer.
// If this channel operation is a receive, then the data field should be set to zero when resuming due to channel closure. // If this channel operation is a receive, then the data field should be set to zero when resuming due to channel closure.
t *task.Task t *task.Task
@ -319,10 +319,10 @@ func (ch *channel) trySend(value unsafe.Pointer) bool {
interrupt.Restore(i) interrupt.Restore(i)
return false return false
case chanStateRecv: case chanStateRecv:
// unblock reciever // unblock receiver
dst := ch.resumeRX(true) dst := ch.resumeRX(true)
// copy value to reciever // copy value to receiver
memcpy(dst, value, ch.elementSize) memcpy(dst, value, ch.elementSize)
// change state to empty if there are no more receivers // change state to empty if there are no more receivers
@ -348,12 +348,12 @@ func (ch *channel) trySend(value unsafe.Pointer) bool {
return false return false
} }
// try to recieve a value from a channel, without really blocking // try to receive a value from a channel, without really blocking
// returns whether a value was recieved // returns whether a value was received
// second return is the comma-ok value // second return is the comma-ok value
func (ch *channel) tryRecv(value unsafe.Pointer) (bool, bool) { func (ch *channel) tryRecv(value unsafe.Pointer) (bool, bool) {
if ch == nil { if ch == nil {
// recieve from nil channel blocks forever // receive from nil channel blocks forever
// this is non-blocking, so just say no // this is non-blocking, so just say no
return false, false return false, false
} }
@ -402,7 +402,7 @@ func (ch *channel) tryRecv(value unsafe.Pointer) (bool, bool) {
interrupt.Restore(i) interrupt.Restore(i)
return false, false return false, false
case chanStateRecv, chanStateEmpty: case chanStateRecv, chanStateEmpty:
// something else is already waiting to recieve // something else is already waiting to receive
interrupt.Restore(i) interrupt.Restore(i)
return false, false return false, false
case chanStateClosed: case chanStateClosed:
@ -411,7 +411,7 @@ func (ch *channel) tryRecv(value unsafe.Pointer) (bool, bool) {
return true, true return true, true
} }
// channel closed - nothing to recieve // channel closed - nothing to receive
memzero(value, ch.elementSize) memzero(value, ch.elementSize)
interrupt.Restore(i) interrupt.Restore(i)
return true, false return true, false
@ -426,8 +426,8 @@ func (ch *channel) tryRecv(value unsafe.Pointer) (bool, bool) {
type chanState uint8 type chanState uint8
const ( const (
chanStateEmpty chanState = iota // nothing in channel, no senders/recievers chanStateEmpty chanState = iota // nothing in channel, no senders/receivers
chanStateRecv // nothing in channel, recievers waiting chanStateRecv // nothing in channel, receivers waiting
chanStateSend // senders waiting, buffer full if present chanStateSend // senders waiting, buffer full if present
chanStateBuf // buffer not empty, no senders waiting chanStateBuf // buffer not empty, no senders waiting
chanStateClosed // channel closed chanStateClosed // channel closed
@ -477,7 +477,7 @@ func chanSend(ch *channel, value unsafe.Pointer, blockedlist *channelBlockedList
deadlock() deadlock()
} }
// wait for reciever // wait for receiver
sender := task.Current() sender := task.Current()
ch.state = chanStateSend ch.state = chanStateSend
sender.Ptr = value sender.Ptr = value
@ -493,8 +493,8 @@ func chanSend(ch *channel, value unsafe.Pointer, blockedlist *channelBlockedList
} }
// chanRecv receives a single value over a channel. // chanRecv receives a single value over a channel.
// It blocks if there is no available value to recieve. // It blocks if there is no available value to receive.
// The recieved value is copied into the value pointer. // The received value is copied into the value pointer.
// Returns the comma-ok value. // Returns the comma-ok value.
func chanRecv(ch *channel, value unsafe.Pointer, blockedlist *channelBlockedList) bool { func chanRecv(ch *channel, value unsafe.Pointer, blockedlist *channelBlockedList) bool {
i := interrupt.Disable() i := interrupt.Disable()

Просмотреть файл

@ -6,7 +6,7 @@
// symbols from the included files in the reference implementation directly into // symbols from the included files in the reference implementation directly into
// the source. It has also been modified to include the conditional logic from // the source. It has also been modified to include the conditional logic from
// the CircuitPython implementation that supports additional flash chips. The // the CircuitPython implementation that supports additional flash chips. The
// CiruitPython source is here: // CircuitPython source is here:
// https://github.com/adafruit/circuitpython/blob/main/ports/raspberrypi/stage2.c.jinja // https://github.com/adafruit/circuitpython/blob/main/ports/raspberrypi/stage2.c.jinja
// //
// This file cannot be assembled directly, instead assemble the board-specific file // This file cannot be assembled directly, instead assemble the board-specific file

12
testdata/channel.go предоставленный
Просмотреть файл

@ -158,16 +158,16 @@ func main() {
ch = make(chan int, 2) ch = make(chan int, 2)
ch <- 1 ch <- 1
ch <- 2 ch <- 2
println("non-concurrent channel recieve:", <-ch) println("non-concurrent channel receive:", <-ch)
println("non-concurrent channel recieve:", <-ch) println("non-concurrent channel receive:", <-ch)
// test closing channels with buffered data // test closing channels with buffered data
ch <- 3 ch <- 3
ch <- 4 ch <- 4
close(ch) close(ch)
println("closed buffered channel recieve:", <-ch) println("closed buffered channel receive:", <-ch)
println("closed buffered channel recieve:", <-ch) println("closed buffered channel receive:", <-ch)
println("closed buffered channel recieve:", <-ch) println("closed buffered channel receive:", <-ch)
// test using buffered channels as regular channels with special properties // test using buffered channels as regular channels with special properties
wg.Add(6) wg.Add(6)
@ -184,7 +184,7 @@ func main() {
for range ch { for range ch {
count++ count++
} }
println("hybrid buffered channel recieve:", count) println("hybrid buffered channel receive:", count)
// test blocking selects // test blocking selects
ch = make(chan int) ch = make(chan int)

12
testdata/channel.txt предоставленный
Просмотреть файл

@ -26,10 +26,10 @@ select n from chan: 55
select n from closed chan: 0 select n from closed chan: 0
select send select send
sum: 235 sum: 235
non-concurrent channel recieve: 1 non-concurrent channel receive: 1
non-concurrent channel recieve: 2 non-concurrent channel receive: 2
closed buffered channel recieve: 3 closed buffered channel receive: 3
closed buffered channel recieve: 4 closed buffered channel receive: 4
closed buffered channel recieve: 0 closed buffered channel receive: 0
hybrid buffered channel recieve: 2 hybrid buffered channel receive: 2
blocking select sum: 3 blocking select sum: 3