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

Refactor Handling of Stepping #153

Merged
merged 11 commits into from
May 16, 2017
Merged

Conversation

smarr
Copy link
Owner

@smarr smarr commented May 11, 2017

The goal of this change is to simplify the implementation of stepping and unify it with breakpoints where possible.
Thus, in most cases, a potential breakpoint is also a stepping target.

This means, a BreakpointNode should be able to do the test whether a relevant stepping strategy is activated.

This change also removes the boilerplate code from SteppingStrategy. There doesn't seem to be a need for this complexity. A simple check for the SteppingType seems sufficient.

This PR also adds the missing step-to-promise-resolver stepping.

@smarr smarr added the enhancement Improves the implementation with something noteworthy label May 11, 2017
@smarr smarr added this to the v0.4.0 milestone May 11, 2017
@smarr smarr self-assigned this May 11, 2017
@smarr smarr force-pushed the refactor-stepping-strategy branch from fd916a2 to 6d9d74b Compare May 12, 2017 10:16
Copy link
Contributor

@ctrlpz ctrlpz left a comment

Choose a reason for hiding this comment

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

I agree with the simplification you made, I think the stepping is better implemented with this approach. When I do the testing I will see if there are more cases that we need to consider.


@SerializedName("stepToPromiseResolver")
STEP_TO_PROMISE_RESOLVER("stepToPromiseResolver", "Step to Promise Resolver",
Group.ACTOR_STEPPING, "msg-white",
Copy link
Contributor

Choose a reason for hiding this comment

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

I should probably find more intuitive icons for each stepping type, they have to be different for each command.

}
},

@SerializedName("stepToMessageRcvr")
STEP_TO_RECEIVER_MESSAGE("stepToMessageRcvr", "Step to Msg Receiver", Group.ACTOR_STEPPING, "msg-open", new Class[] {EventualMessageSend.class}) {
@Override public void process(final Suspension susp) {
STEP_TO_MESSAGE_RECEIVER("stepToMessageRcvr", "Step to Msg Receiver",
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for renaming this command, I realize I had a typo there

activity.setStepToJoin(true);
} else if (activityThread.isStepping(SteppingType.STEP_TO_NEXT_TURN)) {
activity.setStepToNextTurn(true);
} else if (activityThread.isStepping(SteppingType.RETURN_FROM_TURN_TO_PROMISE_RESOLUTION)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I understand what you mean here, is similar to the step-to-next-turn command in the sense that should be able to trigger from anywhere in the code. And I only have it implemented for the SendNode and the primitives of PromisePrims

@@ -100,11 +109,8 @@ public synchronized void addOrUpdateBeforeExpression(final SectionBreakpoint bId

public synchronized void addOrUpdateAfterExpression(final SectionBreakpoint bId) {
// TODO: does this work???
Copy link
Contributor

Choose a reason for hiding this comment

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

what happens here? I saw that is used for transactions and fork/join but don't we have tests for them?

Copy link
Owner Author

Choose a reason for hiding this comment

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

That's an old comment, I think it mostly works.
But no, it isn't tested.

this.breakpoint = breakpoint;
}

@Specialization(assumptions = "bpUnchanged", guards = "breakpoint.isDisabled()")
public final boolean breakpointDisabled(
@Cached("breakpoint.getAssumption()") final Assumption bpUnchanged) {
return false;
return ActivityThread.isSteppingType(breakpoint.getSteppingType());
Copy link
Contributor

Choose a reason for hiding this comment

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

then the disabled state of the breakpoint will depend on the stepping. I think is a good approach. It fits better in this location than what I implemented, I think.

@smarr
Copy link
Owner Author

smarr commented May 12, 2017

The whole refactoring hinges on the realization that there is a mapping between breakpoints and stepping operations.

It is important to realize however that there is connection between breakpoints and stepping targets.
I think, all breakpoints should be possible targets for stepping operations.
And if only for something as generic as 'next concurrency operation'.
We don't have that yet. Especially most of the 'before' breakpoints are excluded.

Sometimes stepping operations also don't use the breakpoints for what should really be the same source location.
So, there aught to be more cleanup done here.
And for instance, for the thread-based stuff, I haven't implemented any stepping yet, because it's just more of the same.

smarr added 8 commits May 16, 2017 21:34
Signed-off-by: Stefan Marr <git@stefan-marr.de>
- encode relevant SteppingType in BreakpointEnabling
- this approach ensures that there is no overhead when we don’t have any breakpoints in the system

Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
This is identical to how step-to-next-turn is handled.

Signed-off-by: Stefan Marr <git@stefan-marr.de>
These methods don’t serve any obvious purpose, they are already implemented by the breakpoint implementation.

Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
@smarr smarr force-pushed the refactor-stepping-strategy branch from 6d9d74b to f623e3d Compare May 16, 2017 19:34
smarr added 3 commits May 17, 2017 00:07
This manages all non-truffle breakpoints in a single hashmap.
This removes a lot of trivially duplicated code.

- standard breakpoint type now creates breakpoint implicitly
- remove generic parameter from BreakpointNode, not needed

Signed-off-by: Stefan Marr <git@stefan-marr.de>
- rename execute method to `executeShouldHalt()`
- remove unnecessary `isDisabled()`
- adapt class comments

Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
@smarr smarr force-pushed the refactor-stepping-strategy branch from efee94e to b317ca5 Compare May 16, 2017 22:08
@smarr smarr merged commit a2b12d1 into smarr:master May 16, 2017
@smarr smarr deleted the refactor-stepping-strategy branch May 16, 2017 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves the implementation with something noteworthy
Projects
No open projects
MetaConc
Awaiting triage
Development

Successfully merging this pull request may close these issues.

None yet

2 participants