Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
cleanup print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
localhuman committed Sep 28, 2017
1 parent 3e3d73b commit cc2d127
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 61 deletions.
12 changes: 1 addition & 11 deletions boa/code/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ def preprocess_iter(self):
#in a better world this would be done in a more efficient way
#for now this is kept to be as understandable as possible

for o in self.oplist:
print("OP %s %s" % (o.py_op, o.args))

loopsetup = self.oplist[0]
loopsetup.args = None
Expand Down Expand Up @@ -169,19 +167,11 @@ def preprocess_iter(self):
new__popjump_op # POP_JUMP_IF_FALSE jumps to the loop exit when counter == length
]

print("BEFORE")
for o in self.oplist:
print("OP %s %s" % (o.py_op, o.args))


if len(dynamic_iterable_items):
self.oplist.insert(4,dynamic_iterable_items[0])
self.oplist.insert(5,dynamic_iterable_items[1])

print("after")
for o in self.oplist:
print("OP %s %s" % (o.py_op, o.args))

Block.forloop_counter += 1

def process_iter_body(self, setup_block):
Expand Down Expand Up @@ -252,7 +242,7 @@ def preprocess_method_calls(self):
param_count = 2 * int(param_count / 256)

params = self.oplist[index-param_count:index]
print("params %s " % params)

call_method_op = self.oplist[index-param_count-1]

call_method_type = call_method_op.py_op
Expand Down
5 changes: 1 addition & 4 deletions boa/code/method.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,7 @@ def process_block_groups(self):
length = len(self.local_stores)
self.local_stores[localvar] = length
iter_setup_block = block

if block.has_dynamic_iterator:
print("incrementing dynamic iterator!!!!!")
self.dynamic_iterator_count +=1
self.dynamic_iterator_count +=1



Expand Down
19 changes: 1 addition & 18 deletions boa/code/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,13 @@ def orderered_methods(self):
continue
om.append(m)

for k in om:
print("MEthed: -> %s " % (k.name))

return om

def add_method(self, method):
for m in self.methods:
# print("comparing method... %s %s " % (m.name, method.name))
if m.name == method.name:
# print("method %s already added " % m.name)
return False

# from boa.boa import Compiler
# if self == Compiler.instance().default:
print("[%s] Adding method %s %s " % (self.module_path,method.name, method))

self.methods.append(method)

def method_by_name(self, method_name):
Expand Down Expand Up @@ -150,9 +141,7 @@ def process_import(self, import_item):
def process_method(self, lineset):

m = Method(lineset.code_object, self)
# print("Adding method %s %s " % (m.name, m))
self.add_method(m)
# self.methods.append(m)

def split_lines(self):

Expand Down Expand Up @@ -204,7 +193,7 @@ def link_methods(self):
for method in self.orderered_methods:

method.method_address = address
print("METHOD, ADDRESS %s %s" % (method.name, address) )

for key, vmtoken in method.vm_tokens.items():

self.all_vm_tokens[address] = vmtoken
Expand All @@ -222,14 +211,8 @@ def link_methods(self):

if vmtoken.src_method is not None:


target_method = self.method_by_name( vmtoken.target_method )
print("TARGET METHOD IS %s %s " % (target_method, vmtoken.src_method))
jump_len = target_method.method_address - vmtoken.addr
print("method address... token address %s %s " % (target_method.method_address, vmtoken.addr))
print("JUMP LEN %s " % jump_len)
jbytes = jump_len.to_bytes(2, 'little',signed=True)
print("jbytes %s " % jbytes)
vmtoken.data = jump_len.to_bytes(2, 'little', signed=True)


Expand Down
13 changes: 1 addition & 12 deletions boa/code/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,6 @@ def to_b(self):
b_array = bytearray()
for key,vm_token in self.vm_tokens.items():

# if vm_token.pytoken:
# print("%s --> %s .... %s" % (vm_token.pytoken.py_op, vm_token.vm_op, vm_token.out_op))
# else:
# print("%s --> %s" % (vm_token.pytoken, vm_token.vm_op))

b_array.append(vm_token.out_op)

if vm_token.data is not None and vm_token.vm_op != VMOp.NOP:
Expand Down Expand Up @@ -415,20 +410,15 @@ def method_begin_items(self):
self.convert_load_parameter(arg, index)

def update_method_begin_items(self):
print("total praam nad body count token %s " % self.total_param_and_body_count_token)
num_current_items = self.total_param_and_body_count_token.updatable_data
print("num current items! %s %s" % (num_current_items, self.total_param_and_body_count_token.vm_op))

if self.method.dynamic_iterator_count > 0:
num_current_items += self.method.dynamic_iterator_count

print("new num current items %s " % num_current_items)
newtoken = self.update_push_integer(self.total_param_and_body_count_token, num_current_items)
print("NEW TOKEN %s " % newtoken.vm_op)


def insert_vm_token_at(self, vm_token, index):
#print("INSERTING VM TOKEN AT %s %s " % (vm_token.vm_op, index))

self.vm_tokens[index] = vm_token


Expand Down Expand Up @@ -783,7 +773,6 @@ def convert_method_call(self, pytoken):
for m in self.method.module.methods:
if fname == m.name:
full_name = m.full_name
# print("all module method %s %s " % (m.name, m.full_name))


#operational call like len(items) or abs(value)
Expand Down
11 changes: 4 additions & 7 deletions boa/tests/src/IterTest2.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
from boa.code.builtins import range

def Main():

items = ['a', 'b', 'c', 1, 5]


items = [10, 3, 43, 4]

count = 0

count = 3
for i in items:

count = count + i

count += 1

return count

Expand Down
14 changes: 5 additions & 9 deletions neo/VM/ExecutionEngine.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,9 +651,8 @@ def ExecuteOp(self, opcode, context):

elif opcode == PACK:

print("DOING PACK")
size = estack.Pop().GetBigInteger()
print("PACK SIZE %s " % size)

if size < 0 or size > estack.Count:
self._VMState |= VMState.FAULT
return
Expand All @@ -662,11 +661,8 @@ def ExecuteOp(self, opcode, context):

for i in range(0, size):
topack = estack.Pop()
print("PACKING ITEM %s " % topack)
items.append( topack)

print("items after pack %s " % items)

estack.PushT(items)

elif opcode == UNPACK:
Expand Down Expand Up @@ -781,10 +777,10 @@ def StepInto(self):
else:
op = self.CurrentContext.OpReader.ReadByte(do_ord=False)

opname = ToName(op)
print("____________________________________________________")
print("%s -> %s" % (op, opname))
print("-----------------------------------")
# opname = ToName(op)
# print("____________________________________________________")
# print("%s -> %s" % (op, opname))
# print("-----------------------------------")

try:
self.ExecuteOp(op, self.CurrentContext)
Expand Down

0 comments on commit cc2d127

Please sign in to comment.