Avoid or generalize global counters used in `TmpLabel` and `Block`

Open
#259 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
scala
Domain
compilers

Research direction

Start by reading the global counter usage for TmpLabel and Block, then inspect CfgGenerator#methodToCfg and the toCfg calls. Review pull request 408 and the linked data-race issue for existing context. Done means selecting and implementing a consistent thread-safe or method-local counter approach for both Silicon and Carbon, with the relevant tests passing.

Written by the indexing model from the issue text.

Description

enhancement major

Created by @fpoli on 2019-01-15 15:09
Last updated on 2019-01-15 15:15

The data races reported in https://github.com/viperproject/silver/issues/256 have been quickly fixed in pull request https://github.com/viperproject/silver/pull/408 by using AtomicIntegers.

The fix works, but several improvements are possible:

  • Malte suggested to develop some kind of generic thread-safe counter or symbol generator, usable by both Silicon and Carbon.
  • Fábio suggested to use, if it exists, the Scala equivalent of Java's AtomicInteger.
  • In my opinion, for the conversion of methods to CFG the global counters can be avoided entirely, by using method-local counters for TmpLabel and Block (allocating a symbol generator in CfgGenerator#methodToCfg, and passing it as an additional parameter in toCfg method calls). This should avoid the overhead of thread-safe counters.
Dominant language
Scala
Stars
100
Forks
53
Avg merge
8h 10m
Merged PRs (30d)
2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from viperproject/silver

All issues in viperproject/silver

Similar issues

More Scala issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.