Skip to content

Conversation

@pludov
Copy link

@pludov pludov commented Oct 1, 2020

The generated field writer method is modified.

I added a check to detect an uninitialized lazy field and force marking it dirty.
But that check is only usefull when the new value is the default for the type (null/0/false...). For other values, the existing comparison is enough to mark the dirty. So, the new code is only triggered when received the default value, to avoid doing the check too frequently

@NathanQingyangXu
Copy link
Contributor

Usually PR is targeting master branch rather than some specific version branch, so when it is merged to master, core team member can determine whether to back port to 5.4 or not, in addition to merging to current 5.5 branch.

@NathanQingyangXu
Copy link
Contributor

@Sanne @dreab8 It seems there is some good stuff here. Could you take a look when you have time?

@pludov
Copy link
Author

pludov commented Oct 2, 2020

Usually PR is targeting master branch rather than some specific version branch, so when it is merged to master, core team member can determine whether to back port to 5.4 or not, in addition to merging to current 5.5 branch.

I was primarly interested on 5.4, so... :-)
However, the branch applies verbatim on master and gradle build is ok as well.

@NathanQingyangXu
Copy link
Contributor

Usually PR is targeting master branch rather than some specific version branch, so when it is merged to master, core team member can determine whether to back port to 5.4 or not, in addition to merging to current 5.5 branch.

I was primarly interested on 5.4, so... :-)
However, the branch applies verbatim on master and gradle build is ok as well.

well, targeting master branch is more future-proof, :). Also, it would motive code reviewers much more as a generic patch, as opposed to a branch patch only.

@Sanne
Copy link
Member

Sanne commented Oct 2, 2020

Many thanks @pludov , this seems a rather important fix, but I'm rusty on ASM. I need to set aside some proper review time next week.

methodVisitor.visitJumpInsn( Opcodes.GOTO, uninitializedLazy );

methodVisitor.visitLabel( skipUninitializedCheckWithPersistentAttributeInterceptor );
if ( implementationContext.getClassFileVersion().isAtLeast( ClassFileVersion.JAVA_V6 ) ) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you comment about the class version requirement?

I'm also wondering if we should test this on pre-6 java class versions, but that's going to be complicated with our CI setup as the main codebase requires Java 8.

Copy link
Author

Choose a reason for hiding this comment

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

Stackmap bytecodes have been introduced in JAVA6 : https://stackoverflow.com/questions/25109942/what-is-a-stack-map-frame.
I just followed already existing pattern here (there was already that kind of test near the end).

MethodVisitor methodVisitor,
Context implementationContext,
MethodDescription instrumentedMethod) {

Copy link
Member

Choose a reason for hiding this comment

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

just wondering, but was there a specific reason to have preferred using an ASM visitor over using a ByteBuddy template? Could you add a comment about the decision, for sake of future maintainers?

Copy link
Author

Choose a reason for hiding this comment

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

No particular reason. I've just been following the already existing pattern in that class.

@beikov beikov added the 5.4 label Jul 6, 2021
@dreab8 dreab8 self-assigned this Dec 6, 2024
@dreab8
Copy link
Member

dreab8 commented Dec 6, 2024

Hi @pludov ,

thanks for your PR and sorry for taking so long to review it. It seems this issue has been solved (PR) so I'm going to close this.

@dreab8 dreab8 closed this Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants