Skip to content

CFG: Support for fall-through switches#127

Open
RomainDeg wants to merge 4 commits into
moosetechnology:v3from
RomainDeg:v3
Open

CFG: Support for fall-through switches#127
RomainDeg wants to merge 4 commits into
moosetechnology:v3from
RomainDeg:v3

Conversation

@RomainDeg

Copy link
Copy Markdown
Contributor

This PR contains:

  • Refactorings to be able to use builder methods with a chosen context class. The original methods now call those new methods and pass the FASTCFGContextEntry class as parameter.
  • Refactorings on the isFull attributes of multiple conditional nodes. Switches are now considered full identically to try blocks, if they have a nil branch pointing to a node (which is either a default node, or the block representing the instructions after the switch).
  • Support for fall-through switches using a specific context class FASTCFGFallThroughSwitchContextEntry and a builder method buildAndUseFallThroughSwitchDuring:

(switches isFull attribute is computable and identical to try nodes, the node is full if it has a nil branch, either a default or the block following the switch)

@jecisc jecisc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would not be simpler instead of creating a new entry,


"I reset the fall-through case if needed, and check if this new case ends with a break or not."
fallThroughCase := nil.
aBlock statements last isBreakStatement ifFalse: [ fallThroughCase := aBlock ]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
aBlock statements last isBreakStatement ifFalse: [ fallThroughCase := aBlock ]
aBlock endsWithBreakStatement ifFalse: [ fallThroughCase := aBlock ]

I'll load it an review it further this week, but here is a simple improvement that can be done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants