Local Variable lifespan

5 views
Skip to first unread message

James Caska

unread,
Sep 4, 2014, 7:04:13 PM9/4/14
to boo...@googlegroups.com
Local variables have the ability to be recycled. This is actually quite important for the highly resource constrained devices I am working with. 

Can you comment on how hard it would be to track intermediate objects slots and reuse the slots rather than reserve all variable slots for the lifetime of the method call

for example

                print "no way!" if null or false
print "nah!" if null or false or false
print "yes!" if null or false or true
b = null or false or false
print b isa bool
print b
b = null or 3 or false
print b isa int
print b
b = null or false or 5
print b isa int
print b

generates a bunch of intermediate local variables but only actually uses object b

LocalVariable(start_pc = 0, length = 353, index = 0:Boojay.Boogie.TestBoo self)
LocalVariable(start_pc = 0, length = 353, index = 1:Object b)
LocalVariable(start_pc = 0, length = 353, index = 2:Object $1)
LocalVariable(start_pc = 0, length = 353, index = 3:Object $2)
LocalVariable(start_pc = 0, length = 353, index = 4:Object $3)
LocalVariable(start_pc = 0, length = 353, index = 5:Object $4)
LocalVariable(start_pc = 0, length = 353, index = 6:Object $5)
LocalVariable(start_pc = 0, length = 353, index = 7:Object $6)
LocalVariable(start_pc = 0, length = 353, index = 8:Object $7)
LocalVariable(start_pc = 0, length = 353, index = 9:Object $8)
LocalVariable(start_pc = 0, length = 353, index = 10:Object $9)
LocalVariable(start_pc = 0, length = 353, index = 11:Object $10)
LocalVariable(start_pc = 0, length = 353, index = 12:Object $11)

James Caska

unread,
Sep 14, 2014, 8:13:10 AM9/14/14
to boo...@googlegroups.com
I solved this using a bytecode pre-process analysis
Reply all
Reply to author
Forward
0 new messages