From 0c71ed81a4f200f07f06ebcf025c83f878842223 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Mon, 27 Aug 2018 00:49:33 +0200 Subject: [PATCH] Rename runtime.itfmethod -> runtime.interfaceMethod --- compiler.go | 4 ++-- src/runtime/interface.go | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler.go b/compiler.go index 10f938e7..f650cd03 100644 --- a/compiler.go +++ b/compiler.go @@ -1343,7 +1343,7 @@ func (c *Compiler) parseCall(frame *Frame, instr *ssa.CallCommon, parentHandle l itf, 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") receiverValue := c.builder.CreateExtractValue(itf, 1, "invoke.func.receiver") 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 // package runtime, so we have to remove it. This should be fixed. 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}, "") } diff --git a/src/runtime/interface.go b/src/runtime/interface.go index 81e1c8a4..b4d5c231 100644 --- a/src/runtime/interface.go +++ b/src/runtime/interface.go @@ -36,19 +36,19 @@ type methodSetRange struct { // which is a dummy value, but will be bigger after the compiler has filled them // in. var ( + firstInterfaceNum uint16 // the lowest typecode that has at least one method methodSetRanges [0]methodSetRange // indexes into methodSetSignatures and methodSetFunctions methodSetSignatures [0]uint16 // uniqued method ID 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. // 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 - // in the list of signatures. The compiler will only emit runtime.itfmethod - // calls when the method actually exists on this interface (proven by the - // typechecker). + // in the list of signatures. The compiler will only emit + // runtime.interfaceMethod calls when the method actually exists on this + // interface (proven by the typechecker). i := methodSetRanges[itf.typecode-firstInterfaceNum].index for { if methodSetSignatures[i] == method {