Replace own dummy syscall with standard library syscall

This makes it easier to support other standard library packages.
Этот коммит содержится в:
Ayke van Laethem 2018-08-30 05:58:54 +02:00
родитель e01259ba77
коммит 906e061e37
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: E97FF5335DFDFDED
4 изменённых файлов: 17 добавлений и 8 удалений

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

@ -97,10 +97,9 @@ Implemented compiler passes:
Requirements: Requirements:
* Go 1.10+ (Go 1.9 has a * Go 1.11+
[known bug](https://github.com/aykevl/tinygo/issues/2)).
* LLVM dependencies, see the Software section in the * LLVM dependencies, see the Software section in the
[LLVM build guide](https://llvm.org/docs/GettingStarted.html#software). [LLVM build guide](https://llvm.org/docs/GettingStarted.html#software)
First download the sources (this takes a while): First download the sources (this takes a while):

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

@ -1321,6 +1321,11 @@ func (c *Compiler) parseBuiltin(frame *Frame, args []ssa.Value, callName string)
} }
func (c *Compiler) parseFunctionCall(frame *Frame, args []ssa.Value, llvmFn llvm.Value, blocking bool, parentHandle llvm.Value) (llvm.Value, error) { func (c *Compiler) parseFunctionCall(frame *Frame, args []ssa.Value, llvmFn llvm.Value, blocking bool, parentHandle llvm.Value) (llvm.Value, error) {
if llvmFn.Name() == "sync.runtime_registerPoolCleanup" || llvmFn.Name() == "sync.runtime_notifyListCheck" {
// Ignore these functions calls for now, as a hack.
// TODO: implement //go:linkname.
return llvm.Value{}, nil
}
var params []llvm.Value var params []llvm.Value
if blocking { if blocking {
if parentHandle.IsNil() { if parentHandle.IsNil() {

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

@ -67,6 +67,16 @@ func (p *Program) interpret(instrs []ssa.Instruction, paramKeys []*ssa.Parameter
if callee == nil { if callee == nil {
return i, nil // don't understand dynamic dispatch return i, nil // don't understand dynamic dispatch
} }
if callee.String() == "syscall.runtime_envs" {
// TODO: replace this with some //go:linkname magic.
// For now, do as if it returned a zero-length slice.
var err error
locals[instr], err = p.getZeroValue(callee.Signature.Results().At(0).Type())
if err != nil {
return i, err
}
continue
}
if canInterpret(callee) { if canInterpret(callee) {
params := make([]Value, len(common.Args)) params := make([]Value, len(common.Args))
for i, arg := range common.Args { for i, arg := range common.Args {

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

@ -1,5 +0,0 @@
package syscall
// dummy
type Errno uintptr