Reduced memory usage
This commit is contained in:
parent
c3234361f7
commit
2170798b0f
6 changed files with 22 additions and 31 deletions
|
@ -7,7 +7,7 @@ import (
|
|||
// Variable represents a named register.
|
||||
type Variable struct {
|
||||
Name string
|
||||
Alive int
|
||||
Alive uint8
|
||||
Depth uint8
|
||||
Register cpu.Register
|
||||
}
|
||||
|
@ -19,9 +19,9 @@ func (v *Variable) IsAlive() bool {
|
|||
|
||||
// Use reduces the lifetime counter by one.
|
||||
func (v *Variable) Use() {
|
||||
v.Alive--
|
||||
|
||||
if v.Alive < 0 {
|
||||
if v.Alive == 0 {
|
||||
panic("incorrect number of variable use calls")
|
||||
}
|
||||
|
||||
v.Alive--
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue