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

Fixing TTD regressions from JsObject* function refactor #4591

Merged
merged 1 commit into from
Jan 23, 2018

Conversation

kfarnung
Copy link
Contributor

@kfarnung kfarnung commented Jan 23, 2018

When the JsObject* functions were added to JSRT there was an attempt
to refactor the TTD instrumentation into a common method. The
refactor caused a regression in cross-context scenarios where the
record was capturing both the result of the function as well as any
marshalling necessary to get the result.

This change reverts the behavior of the existing methods (e.g.
JsSetProperty and friends) to capture the record before any marshalling
can occur (VALIDATE_INCOMING_OBJECT will marshal the object if
necessary). For the new JsObject* functions I've added an assert to
ensure that once they are used they will cause TTD record to fail with
an actionable message.

@mike-kaufman
Copy link
Contributor

what do you mean by "more nuance to supporting these methods"? Did these never work?

Copy link
Contributor

@mike-kaufman mike-kaufman left a comment

Choose a reason for hiding this comment

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

some questions.

{
PERFORM_JSRT_TTD_RECORD_ACTION(scriptContext, RecordJsRTHasOwnProperty, propertyRecord, object);
Copy link
Contributor

Choose a reason for hiding this comment

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

what was broken w/ having this here?

Copy link
Contributor

Choose a reason for hiding this comment

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

concern here is that every caller of JsHasOwnPropertyCommon will now have to "do the right thing" for TTD, namely either assert of record. Is there some way to have the right logic consolidated in JsHasOwnPropertyCommaon , (record if we can, assert if not), independent of caller?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any instances of VALIDATE_INCOMING_OBJECT can also marshal the object to the current context. The record actions need to be the value prior any of these calls to capture the original pointer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks Kyle, a few questions:

  1. What problem does this fix today? Is something broken?
  2. With this change, what are the implications on someone trying to use TTD?
  3. Is it possible to capture the value before VALIDATE_INCOMING_OBJECT, and include that as a param into the *Common* methods? This way, the right value will get recorded, and the API signature provides some assurance that any future callers will "do the right thing".

LMK if I'm mis-understanding something here. Happy to talk in on phone or in office.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Attempted to update the commit description again:

Any instances of VALIDATE_INCOMING_OBJECT can also marshal the object
to the current context. The record actions need to be the value prior
any of these calls to capture the original pointer.

These methods were recently added and in the process regressed the
existing methods. Partially backing out the change so we can properly
address the TTD implementation for these methods.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, is there a bug opened to track getting this fixed? Do any existing tests fail with these asserts now?

Copy link
Contributor Author

@kfarnung kfarnung Jan 23, 2018

Choose a reason for hiding this comment

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

Answers to your questions:

  1. These were causing vm module scenarios to fail in TTD, it regressed from v1.7.1 which was the last supported build with TTD.
  2. It causes the record to fail if those JsObject* functions are called from a native module. They are basically just fast-path implementations and introduced later in the v1.7.* cycle, so they aren't currently used in node-chakracore.
  3. The real fix is not that simple, the record will need to be different for the JsObject* calls because they need to capture the JsValueRef during record and generate a JsPropertyIdRef during replay. This also requires that we introduce some new logic during replay so it's not a trivial fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

clarified this offline with @kfarnung. This change fixes a regression in TTD that was causing some internal tests to fail. The new "assert" code paths aren't hit in these tests.

@kfarnung
Copy link
Contributor Author

I've updated the commit message to better explain. These methods were refactored recently and regressed the cross-context TTD scenarios around them.

When the JsObject* functions were added to JSRT there was an attempt
to refactor the TTD instrumentation into a common method. The
refactor caused a regression in cross-context scenarios where the
record was capturing both the result of the function as well as any
marshalling necessary to get the result.

This change reverts the behavior of the existing methods (e.g.
JsSetProperty and friends) to capture the record before any marshalling
can occur (VALIDATE_INCOMING_OBJECT will marshal the object if
necessary). For the new JsObject* functions I've added an assert to
ensure that once they are used they will cause TTD record to fail with
an actionable message.
@kfarnung kfarnung changed the title Pulling TTD out of JsObject* methods Fixing TTD regressions from JsObject* function refactor Jan 23, 2018
@kfarnung
Copy link
Contributor Author

@obastemur Can you take a look?

@obastemur
Copy link
Collaborator

LGTM

1 similar comment
@mrkmarron
Copy link
Contributor

LGTM

@chakrabot chakrabot merged commit e54e87a into chakra-core:release/1.9 Jan 23, 2018
chakrabot pushed a commit that referenced this pull request Jan 23, 2018
…n refactor

Merge pull request #4591 from kfarnung:ttdobjects

When the JsObject* functions were added to JSRT there was an attempt
to refactor the TTD instrumentation into a common method. The
refactor caused a regression in cross-context scenarios where the
record was capturing both the result of the function as well as any
marshalling necessary to get the result.

This change reverts the behavior of the existing methods (e.g.
JsSetProperty and friends) to capture the record before any marshalling
can occur (VALIDATE_INCOMING_OBJECT will marshal the object if
necessary). For the new JsObject* functions I've added an assert to
ensure that once they are used they will cause TTD record to fail with
an actionable message.
chakrabot pushed a commit that referenced this pull request Jan 23, 2018
…ject* function refactor

Merge pull request #4591 from kfarnung:ttdobjects

When the JsObject* functions were added to JSRT there was an attempt
to refactor the TTD instrumentation into a common method. The
refactor caused a regression in cross-context scenarios where the
record was capturing both the result of the function as well as any
marshalling necessary to get the result.

This change reverts the behavior of the existing methods (e.g.
JsSetProperty and friends) to capture the record before any marshalling
can occur (VALIDATE_INCOMING_OBJECT will marshal the object if
necessary). For the new JsObject* functions I've added an assert to
ensure that once they are used they will cause TTD record to fail with
an actionable message.
@kfarnung kfarnung deleted the ttdobjects branch January 23, 2018 22:13
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.

5 participants