Remove root property from encodeCompileContext and opcode

This commit is contained in:
Masaaki Goshima 2021-03-12 00:56:30 +09:00
parent 4cdbd4e962
commit bb3086c375
4 changed files with 0 additions and 10 deletions

View File

@ -38,7 +38,6 @@ func encodeCompileToGetCodeSetSlowPath(typeptr uintptr) (*opcodeSet, error) {
code, err := encodeCompileHead(&encodeCompileContext{ code, err := encodeCompileHead(&encodeCompileContext{
typ: copiedType, typ: copiedType,
root: true,
structTypeToCompiledCode: map[uintptr]*compiledCode{}, structTypeToCompiledCode: map[uintptr]*compiledCode{},
}) })
if err != nil { if err != nil {
@ -619,7 +618,6 @@ func encodeCompileInterface(ctx *encodeCompileContext) (*opcode, error) {
} }
func encodeCompileSlice(ctx *encodeCompileContext) (*opcode, error) { func encodeCompileSlice(ctx *encodeCompileContext) (*opcode, error) {
ctx.root = false
elem := ctx.typ.Elem() elem := ctx.typ.Elem()
size := elem.Size() size := elem.Size()
@ -663,7 +661,6 @@ func encodeCompileSliceElem(ctx *encodeCompileContext) (*opcode, error) {
} }
func encodeCompileArray(ctx *encodeCompileContext) (*opcode, error) { func encodeCompileArray(ctx *encodeCompileContext) (*opcode, error) {
ctx.root = false
typ := ctx.typ typ := ctx.typ
elem := typ.Elem() elem := typ.Elem()
alen := typ.Len() alen := typ.Len()
@ -1215,7 +1212,6 @@ func encodeIsNilableType(typ *rtype) bool {
} }
func encodeCompileStruct(ctx *encodeCompileContext, isPtr bool) (*opcode, error) { func encodeCompileStruct(ctx *encodeCompileContext, isPtr bool) (*opcode, error) {
ctx.root = false
if code := encodeCompiledCode(ctx); code != nil { if code := encodeCompiledCode(ctx); code != nil {
return code, nil return code, nil
} }

View File

@ -18,7 +18,6 @@ func encodeCompileToGetCodeSet(typeptr uintptr) (*opcodeSet, error) {
code, err := encodeCompileHead(&encodeCompileContext{ code, err := encodeCompileHead(&encodeCompileContext{
typ: copiedType, typ: copiedType,
root: true,
structTypeToCompiledCode: map[uintptr]*compiledCode{}, structTypeToCompiledCode: map[uintptr]*compiledCode{},
}) })
if err != nil { if err != nil {

View File

@ -63,7 +63,6 @@ func releaseMapContext(c *encodeMapContext) {
type encodeCompileContext struct { type encodeCompileContext struct {
typ *rtype typ *rtype
root bool
opcodeIndex int opcodeIndex int
ptrIndex int ptrIndex int
indent int indent int
@ -75,7 +74,6 @@ type encodeCompileContext struct {
func (c *encodeCompileContext) context() *encodeCompileContext { func (c *encodeCompileContext) context() *encodeCompileContext {
return &encodeCompileContext{ return &encodeCompileContext{
typ: c.typ, typ: c.typ,
root: c.root,
opcodeIndex: c.opcodeIndex, opcodeIndex: c.opcodeIndex,
ptrIndex: c.ptrIndex, ptrIndex: c.ptrIndex,
indent: c.indent, indent: c.indent,

View File

@ -19,7 +19,6 @@ type opcode struct {
isTaggedKey bool // whether tagged key isTaggedKey bool // whether tagged key
anonymousKey bool // whether anonymous key anonymousKey bool // whether anonymous key
anonymousHead bool // whether anonymous head or not anonymousHead bool // whether anonymous head or not
root bool // whether root
indirect bool // whether indirect or not indirect bool // whether indirect or not
nilcheck bool // whether needs to nilcheck or not nilcheck bool // whether needs to nilcheck or not
addrForMarshaler bool // whether needs to addr for marshaler or not addrForMarshaler bool // whether needs to addr for marshaler or not
@ -95,7 +94,6 @@ func (c *opcode) copy(codeMap map[uintptr]*opcode) *opcode {
isTaggedKey: c.isTaggedKey, isTaggedKey: c.isTaggedKey,
anonymousKey: c.anonymousKey, anonymousKey: c.anonymousKey,
anonymousHead: c.anonymousHead, anonymousHead: c.anonymousHead,
root: c.root,
indirect: c.indirect, indirect: c.indirect,
nilcheck: c.nilcheck, nilcheck: c.nilcheck,
addrForMarshaler: c.addrForMarshaler, addrForMarshaler: c.addrForMarshaler,
@ -497,7 +495,6 @@ func newInterfaceCode(ctx *encodeCompileContext) *opcode {
displayIdx: ctx.opcodeIndex, displayIdx: ctx.opcodeIndex,
idx: opcodeOffset(ctx.ptrIndex), idx: opcodeOffset(ctx.ptrIndex),
indent: ctx.indent, indent: ctx.indent,
root: ctx.root,
next: newEndOp(ctx), next: newEndOp(ctx),
} }
} }