
This interpreter currently complements the Go SSA level interpreter. It may stay complementary or may be the only interpreter in the future. This interpreter is experimental and not yet finished (there are known bugs!) so it is disabled by default. It can be enabled by passing the -initinterp flag. The goal is to be able to run all initializations at compile time except for the ones having side effects. This mostly works except perhaps for a few edge cases. In the future, this interpeter may be used to actually run regular Go code, perhaps in a shell.
17 строки
377 Б
Go
17 строки
377 Б
Go
package interp
|
|
|
|
// This file provides useful types for errors encountered during IR evaluation.
|
|
|
|
import (
|
|
"github.com/aykevl/go-llvm"
|
|
)
|
|
|
|
type Unsupported struct {
|
|
Inst llvm.Value
|
|
}
|
|
|
|
func (e Unsupported) Error() string {
|
|
// TODO: how to return the actual instruction string?
|
|
// It looks like LLVM provides no function for that...
|
|
return "interp: unsupported instruction"
|
|
}
|