def maybe_insert_node(self, payload, bitmap_array, node_struct): bitmap = ExecutionResult.bitmap_from_bytearray(bitmap_array, node_struct["info"]["exit_reason"], node_struct["info"]["performance"]) bitmap.lut_applied = True # since we received the bitmap from the slave, the lut was already applied backup_data = bitmap.copy_to_array() should_store, new_bytes, new_bits = self.bitmap_storage.should_store_in_queue(bitmap) new_data = bitmap.copy_to_array() if should_store: node = QueueNode(payload, bitmap_array, node_struct, write=False) node.set_new_bytes(new_bytes, write=False) node.set_new_bits(new_bits, write=False) self.queue.insert_input(node, bitmap) elif self.debug_mode: if node_struct["info"]["exit_reason"] != "regular": log_master("Payload found to be boring, not saved (exit=%s)" % node_struct["info"]["exit_reason"]) for i in range(len(bitmap_array)): if backup_data[i] != new_data[i]: assert(False), "Bitmap mangled at {} {} {}".format(i, repr(backup_data[i]), repr(new_data[i]))
def construct_node( self, payload, bitmap, new_bytes, new_bits, node_struct, ): assert "fav_bits" not in node_struct assert "level" not in node_struct assert "new_bytes" not in node_struct assert "new_bits" not in node_struct node_struct["new_bytes"] = new_bytes node_struct["new_bits"] = new_bits node = QueueNode(payload, bitmap, node_struct, write=False) node.clear_fav_bits(write=False) parent = node_struct["info"]["parent"] node.set_level(self.get_node_by_id(parent).get_level() + 1 if parent else 0, write=False) return node