Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support creating of a new thread with ENV comments #66

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions scripts/mea/et/internal_witness.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def __init__(self, logger):
self._env_models = {}
self._env_models_json = {}
self._env_funcs_openers = {}
self._env_threads = {}
self._notes = {}
self._asserts = {}
self._actions = []
Expand Down Expand Up @@ -408,6 +409,10 @@ def _parse_model_comments(self):
if file_id not in self._env_models_json:
self._env_models_json[file_id] = {}
self._env_models_json[file_id][line + 1] = data
if "thread" in data and "function" in data:
if file_id not in self._env_threads:
self._env_threads[file_id] = {}
self._env_threads[file_id][self.add_function(data["function"])] = data["thread"]
if 'name' in data:
func_data = {
'type': data['type'],
Expand Down Expand Up @@ -534,13 +539,21 @@ def final_checks(self, entry_point="main"):
# 'improve visualization)')
if not self._threads:
is_main_process = False
for edge in self._edges:
if not is_main_process and 'enter' in edge:
is_main_process = True
if is_main_process:
edge['thread'] = '1'
else:
edge['thread'] = '0'
if self._env_threads:
cur_thread = 0
for edge in self._edges:
if edge['file'] in self._env_threads:
if 'enter' in edge and edge['enter'] in self._env_threads[edge['file']]:
cur_thread = self._env_threads[edge['file']][edge['enter']]
edge['thread'] = cur_thread
else:
for edge in self._edges:
if not is_main_process and 'enter' in edge:
is_main_process = True
if is_main_process:
edge['thread'] = '1'
else:
edge['thread'] = '0'

def get_func_name(self, identifier: int):
return self._funcs[identifier]
Expand Down
Loading