Skip to content
Snippets Groups Projects

Subset projection

1000+ files
+ 845
543
Compare changes
  • Side-by-side
  • Inline

Files

from datatypes.GlobalType import *
from datatypes.LocalType import *
from datatypes.GlobTypeKinds import *
from datatypes.GlobalTypeParsed import *
from datatypes.classical_projection.LocalType import *
import os
class AvailabilitySet:
def __init__(self, global_type, process, blocked_procs, handled_vars, rec_var_map, vars_empty):
avail_check = os.getenv('AVAIL_CHECK')
self.isoption = type(global_type) is tuple
self.option = global_type
self.global_type = global_type
@@ -29,9 +27,9 @@ class AvailabilitySet:
m.receiver != self.option[0].receiver,
avail_msgs_option))
return avail_msgs_option_possible
elif self.global_type.kind == GlobTypeKinds.NULLTYPE:
elif self.global_type.kind == GlobalTypeKinds.NULLTYPE:
return set()
elif self.global_type.kind == GlobTypeKinds.CHOICE:
elif self.global_type.kind == GlobalTypeKinds.CHOICE:
# 1) Process is sender
if self.global_type.options[0][0].sender == self.process:
avail_set = set()
@@ -60,7 +58,6 @@ class AvailabilitySet:
snd_avail_msgs = set()
for option in list_not_part_of_msg_exc:
# not part of msg_exc so we omit to project to an empty one here
# TODO: compute avail_msgs here instead of projections
proj_cont = option[1].project_onto(self.process, self.vars_empty, self.rec_var_map)
# check whether the continuation is
is_rec_for_one = False
@@ -71,8 +68,7 @@ class AvailabilitySet:
if not is_rec_for_one:
snd_avail_msgs.update(proj_cont.avail)
return fst_avail_msgs.union(snd_avail_msgs)
elif self.global_type.kind == GlobTypeKinds.RECURSION:
# TODO: compute avail_msgs here instead of projections
elif self.global_type.kind == GlobalTypeKinds.RECURSION:
proj_cont = self.global_type.continuation.project_onto(self.process, {self.global_type.bound_variable}.union(self.vars_empty), self.rec_var_map)
is_bound_variable_itself = proj_cont.kind == LocalTypeKinds.REC_VAR and \
proj_cont.ref_variable == self.global_type.bound_variable
@@ -82,7 +78,7 @@ class AvailabilitySet:
return avail_msgs
else:
return set()
elif self.global_type.kind == GlobTypeKinds.REC_VAR:
elif self.global_type.kind == GlobalTypeKinds.REC_VAR:
avail_msgs = self.rec_var_map[self.global_type.ref_variable].avail_msgs(self.process, {self.process}, {self.global_type.ref_variable}, self.rec_var_map)
return avail_msgs
else:
Loading