Rename runtime.itfmethod -> runtime.interfaceMethod

Этот коммит содержится в:
Ayke van Laethem 2018-08-27 00:49:33 +02:00
родитель 64e478ef36
коммит 0c71ed81a4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: E97FF5335DFDFDED
2 изменённых файлов: 7 добавлений и 7 удалений

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

@ -1343,7 +1343,7 @@ func (c *Compiler) parseCall(frame *Frame, instr *ssa.CallCommon, parentHandle l
itf, itf,
llvm.ConstInt(llvm.Int16Type(), uint64(c.ir.MethodNum(instr.Method)), false), llvm.ConstInt(llvm.Int16Type(), uint64(c.ir.MethodNum(instr.Method)), false),
} }
fn := c.builder.CreateCall(c.mod.NamedFunction("runtime.itfmethod"), values, "invoke.func") fn := c.builder.CreateCall(c.mod.NamedFunction("runtime.interfaceMethod"), values, "invoke.func")
fnCast := c.builder.CreateBitCast(fn, llvmFnType, "invoke.func.cast") fnCast := c.builder.CreateBitCast(fn, llvmFnType, "invoke.func.cast")
receiverValue := c.builder.CreateExtractValue(itf, 1, "invoke.func.receiver") receiverValue := c.builder.CreateExtractValue(itf, 1, "invoke.func.receiver")
args := []llvm.Value{receiverValue} args := []llvm.Value{receiverValue}
@ -1510,7 +1510,7 @@ func (c *Compiler) parseExpr(frame *Frame, expr ssa.Value) (llvm.Value, error) {
// TODO: runtime.lookupBoundsCheck is undefined in packages imported by // TODO: runtime.lookupBoundsCheck is undefined in packages imported by
// package runtime, so we have to remove it. This should be fixed. // package runtime, so we have to remove it. This should be fixed.
lookupBoundsCheck := c.mod.NamedFunction("runtime.lookupBoundsCheck") lookupBoundsCheck := c.mod.NamedFunction("runtime.lookupBoundsCheck")
if !lookupBoundsCheck.IsNil() && frame.fn.llvmFn.Name() != "runtime.itfmethod" { if !lookupBoundsCheck.IsNil() && frame.fn.llvmFn.Name() != "runtime.interfaceMethod" {
c.builder.CreateCall(lookupBoundsCheck, []llvm.Value{buflen, index}, "") c.builder.CreateCall(lookupBoundsCheck, []llvm.Value{buflen, index}, "")
} }

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

@ -36,19 +36,19 @@ type methodSetRange struct {
// which is a dummy value, but will be bigger after the compiler has filled them // which is a dummy value, but will be bigger after the compiler has filled them
// in. // in.
var ( var (
firstInterfaceNum uint16 // the lowest typecode that has at least one method
methodSetRanges [0]methodSetRange // indexes into methodSetSignatures and methodSetFunctions methodSetRanges [0]methodSetRange // indexes into methodSetSignatures and methodSetFunctions
methodSetSignatures [0]uint16 // uniqued method ID methodSetSignatures [0]uint16 // uniqued method ID
methodSetFunctions [0]*uint8 // function pointer of method methodSetFunctions [0]*uint8 // function pointer of method
firstInterfaceNum uint16 // the lowest typecode that has at least one method
) )
// Get the function pointer for the method on the interface. // Get the function pointer for the method on the interface.
// This is a compiler intrinsic. // This is a compiler intrinsic.
func itfmethod(itf _interface, method uint16) *uint8 { func interfaceMethod(itf _interface, method uint16) *uint8 {
// This function doesn't do bounds checking as the supplied method must be // This function doesn't do bounds checking as the supplied method must be
// in the list of signatures. The compiler will only emit runtime.itfmethod // in the list of signatures. The compiler will only emit
// calls when the method actually exists on this interface (proven by the // runtime.interfaceMethod calls when the method actually exists on this
// typechecker). // interface (proven by the typechecker).
i := methodSetRanges[itf.typecode-firstInterfaceNum].index i := methodSetRanges[itf.typecode-firstInterfaceNum].index
for { for {
if methodSetSignatures[i] == method { if methodSetSignatures[i] == method {