compiler,runtime: make panic functions camelCase

Rename panic functions to be runtime.nilPanic, runtime.lookupPanic, and
runtime.slicePanic.
Этот коммит содержится в:
Ayke van Laethem 2019-05-24 15:00:40 +02:00 коммит произвёл Ayke
родитель 191a076956
коммит 3313decb68
3 изменённых файлов: 10 добавлений и 10 удалений

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

@ -42,7 +42,7 @@ func (c *Compiler) emitLookupBoundsCheck(frame *Frame, arrayLen, index llvm.Valu
// Fail: this is a nil pointer, exit with a panic.
c.builder.SetInsertPointAtEnd(faultBlock)
c.createRuntimeCall("lookuppanic", nil, "")
c.createRuntimeCall("lookupPanic", nil, "")
c.builder.CreateUnreachable()
// Ok: this is a valid pointer.
@ -103,7 +103,7 @@ func (c *Compiler) emitSliceBoundsCheck(frame *Frame, capacity, low, high llvm.V
// Fail: this is a nil pointer, exit with a panic.
c.builder.SetInsertPointAtEnd(faultBlock)
c.createRuntimeCall("slicepanic", nil, "")
c.createRuntimeCall("slicePanic", nil, "")
c.builder.CreateUnreachable()
// Ok: this is a valid pointer.
@ -146,7 +146,7 @@ func (c *Compiler) emitNilCheck(frame *Frame, ptr llvm.Value, blockPrefix string
// Fail: this is a nil pointer, exit with a panic.
c.builder.SetInsertPointAtEnd(faultBlock)
c.createRuntimeCall("nilpanic", nil, "")
c.createRuntimeCall("nilPanic", nil, "")
c.builder.CreateUnreachable()
// Ok: this is a valid pointer.

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

@ -154,17 +154,17 @@ func (c *Compiler) LowerFuncValues() {
// What we'll do is transform the following:
// rawPtr := runtime.getFuncPtr(fn)
// if func.rawPtr == nil {
// runtime.nilpanic()
// runtime.nilPanic()
// }
// result := func.rawPtr(...args, func.context)
// into this:
// if false {
// runtime.nilpanic()
// runtime.nilPanic()
// }
// var result // Phi
// switch fn.id {
// case 0:
// runtime.nilpanic()
// runtime.nilPanic()
// case 1:
// result = call first implementation...
// case 2:
@ -222,7 +222,7 @@ func (c *Compiler) LowerFuncValues() {
// The 0 case, which is actually a nil check.
nilBlock := llvm.InsertBasicBlock(nextBlock, "func.nil")
c.builder.SetInsertPointAtEnd(nilBlock)
c.createRuntimeCall("nilpanic", nil, "")
c.createRuntimeCall("nilPanic", nil, "")
c.builder.CreateUnreachable()
sw.AddCase(llvm.ConstInt(c.uintptrType, 0, false), nilBlock)

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

@ -36,16 +36,16 @@ func isnil(ptr *uint8) bool {
}
// Panic when trying to dereference a nil pointer.
func nilpanic() {
func nilPanic() {
runtimePanic("nil pointer dereference")
}
// Panic when trying to acces an array or slice out of bounds.
func lookuppanic() {
func lookupPanic() {
runtimePanic("index out of range")
}
// Panic when trying to slice a slice out of bounds.
func slicepanic() {
func slicePanic() {
runtimePanic("slice out of range")
}