Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _state.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ func (ls *LState) rkValue(idx int) LValue {

func (ls *LState) rkString(idx int) string {
if (idx & opBitRk) != 0 {
return ls.currentFrame.Fn.Proto.stringConstants[idx & ^opBitRk]
return ls.currentFrame.Fn.Proto.StringConstants[idx & ^opBitRk]
}
return string(ls.reg.array[ls.currentFrame.LocalBase+idx].(LString))
}
Expand Down
4 changes: 2 additions & 2 deletions _vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func init() {
RA := lbase + A
Bx := int(inst & 0x3ffff) //GETBX
//reg.Set(RA, L.getField(cf.Fn.Env, cf.Fn.Proto.Constants[Bx]))
reg.Set(RA, L.getFieldString(cf.Fn.Env, cf.Fn.Proto.stringConstants[Bx]))
reg.Set(RA, L.getFieldString(cf.Fn.Env, cf.Fn.Proto.StringConstants[Bx]))
return 0
},
func(L *LState, inst uint32, baseframe *callFrame) int { //OP_GETTABLE
Expand Down Expand Up @@ -281,7 +281,7 @@ func init() {
RA := lbase + A
Bx := int(inst & 0x3ffff) //GETBX
//L.setField(cf.Fn.Env, cf.Fn.Proto.Constants[Bx], reg.Get(RA))
L.setFieldString(cf.Fn.Env, cf.Fn.Proto.stringConstants[Bx], reg.Get(RA))
L.setFieldString(cf.Fn.Env, cf.Fn.Proto.StringConstants[Bx], reg.Get(RA))
return 0
},
func(L *LState, inst uint32, baseframe *callFrame) int { //OP_SETUPVAL
Expand Down
4 changes: 2 additions & 2 deletions compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ type funcContext struct {

func newFuncContext(sourcename string, parent *funcContext) *funcContext {
fc := &funcContext{
Proto: newFunctionProto(sourcename),
Proto: NewFunctionProto(sourcename),
Code: &codeStore{make([]uint32, 0, 1024), make([]int, 0, 1024), 0},
Parent: parent,
Upvalues: newVarNamePool(0),
Expand Down Expand Up @@ -1158,7 +1158,7 @@ func compileFunctionExpr(context *funcContext, funcexpr *ast.FunctionExpr, ec *e
if slv, ok := clv.(LString); ok {
sv = string(slv)
}
context.Proto.stringConstants = append(context.Proto.stringConstants, sv)
context.Proto.StringConstants = append(context.Proto.StringConstants, sv)
}
patchCode(context)
} // }}}
Expand Down
6 changes: 3 additions & 3 deletions function.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type FunctionProto struct {
DbgCalls []DbgCall
DbgUpvalues []string

stringConstants []string
StringConstants []string
}

/* Upvalue {{{ */
Expand Down Expand Up @@ -87,7 +87,7 @@ func UpvalueIndex(i int) int {

/* FunctionProto {{{ */

func newFunctionProto(name string) *FunctionProto {
func NewFunctionProto(name string) *FunctionProto {
return &FunctionProto{
SourceName: name,
LineDefined: 0,
Expand All @@ -105,7 +105,7 @@ func newFunctionProto(name string) *FunctionProto {
DbgCalls: make([]DbgCall, 0, 128),
DbgUpvalues: make([]string, 0, 16),

stringConstants: make([]string, 0, 32),
StringConstants: make([]string, 0, 32),
}
}

Expand Down
2 changes: 1 addition & 1 deletion state.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ func (ls *LState) rkValue(idx int) LValue {

func (ls *LState) rkString(idx int) string {
if (idx & opBitRk) != 0 {
return ls.currentFrame.Fn.Proto.stringConstants[idx & ^opBitRk]
return ls.currentFrame.Fn.Proto.StringConstants[idx & ^opBitRk]
}
return string(ls.reg.array[ls.currentFrame.LocalBase+idx].(LString))
}
Expand Down
4 changes: 2 additions & 2 deletions vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func init() {
RA := lbase + A
Bx := int(inst & 0x3ffff) //GETBX
//reg.Set(RA, L.getField(cf.Fn.Env, cf.Fn.Proto.Constants[Bx]))
reg.Set(RA, L.getFieldString(cf.Fn.Env, cf.Fn.Proto.stringConstants[Bx]))
reg.Set(RA, L.getFieldString(cf.Fn.Env, cf.Fn.Proto.StringConstants[Bx]))
return 0
},
func(L *LState, inst uint32, baseframe *callFrame) int { //OP_GETTABLE
Expand Down Expand Up @@ -333,7 +333,7 @@ func init() {
RA := lbase + A
Bx := int(inst & 0x3ffff) //GETBX
//L.setField(cf.Fn.Env, cf.Fn.Proto.Constants[Bx], reg.Get(RA))
L.setFieldString(cf.Fn.Env, cf.Fn.Proto.stringConstants[Bx], reg.Get(RA))
L.setFieldString(cf.Fn.Env, cf.Fn.Proto.StringConstants[Bx], reg.Get(RA))
return 0
},
func(L *LState, inst uint32, baseframe *callFrame) int { //OP_SETUPVAL
Expand Down