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

Remove duplicate macros between j9nonbuilder.h and j9consts.h #4287

Merged
merged 1 commit into from
Feb 9, 2019

Conversation

AidanHa
Copy link
Contributor

@AidanHa AidanHa commented Jan 14, 2019

-There were various duplicate macros in j9consts.h and j9nonbuilder.h. Since j9nonbuilder.h seemed to be more up to date, I removed several constants from j9consts.h, including the following:

Note: This is the second pull request attempt.

J9_JAVA_PUBLIC
J9_JAVA_PRIVATE
J9_JAVA_PROTECTED 0x4
J9_JAVA_STATIC (CARE IN STACK WALKER.JAVA)
J9_JAVA_FINAL
J9_JAVA_CLASS_RAM_SHAPE_SHIFT
J9_JAVA_CLASS_REFERENCE_SHIFT
J9_JAVA_SYNC
J9_JAVA_NATIVE
J9_JAVA_GETTER_METHOD
J9_JAVA_INTERFACE
J9_JAVA_UNUSED_0X200
J9_JAVA_ABSTRACT
J9_JAVA_FORWARDER_METHOD
J9_JAVA_EMPTY_METHOD
J9_JAVA_CLASS_DEPTH_MASK
J9_JAVA_CLASS_ARRAY
J9_JAVA_CLASS_RAM_ARRAY
J9_JAVA_METHOD_VTABLE
J9_JAVA_METHOD_HAS_EXCEPTIONS
J9_JAVA_CLASS_PRIMITIVE_TYPE
J9_JAVA_CLASS_UNSAFE
J9_JAVA_METHOD_FRAME_ITERATOR_SKIP
J9_JAVA_METHOD_CALLER_SENSITIVE
J9_JAVA_CLASS_BYTECODES_MODIFIED
J9_JAVA_CLASS_OWNABLE_SYNCHRONIZER
J9_JAVA_CLASS_HAS_EMPTY_FINALIZE
J9_JAVA_CLASS_HAS_JDBC_NATIVES
J9_JAVA_METHOD_OBJECT_CONSTRUCTOR
J9_JAVA_CLASS_GC_SPECIAL
J9_JAVA_CLASS_HAS_VERIFY_DATA
J9_JAVA_METHOD_UNUSED_1000000
J9_JSVS_CLASS_CONTENDED
J9_JAVA_CLASS_HAS_FINAL_FIELDS
J9_JAVA_METHOD_HAS_GENERIC_SIGNATURE
J9_JAVA_CLASS_HOT_SWAPPED_OUT
J9_JAVA_CLASS_HAS_CLINIT
J9_JAVA_CLASS_DYING
J9_JAVA_CLASS_REFERENCE_WEAK
J9_JAVA_FIELD_UNUSED_10000000
J9_JAVA_CLASS_REFERENCE_SOFT
J9_JAVA_CLASS_REFERENCE_MASK
J9_JAVA_CLASS_REFERENCE_PHANTOM
J9_JAVA_CLASS_CLONEABLE
J9_JAVA_CLASS_ROMRAMMASK

-I renamed the constants in various files. I did not touch anything in any of the DDR files @tajila
-There were alot of constants to renamed, so hopefully I did not made any typos.
I also added <#include "j9nonbuilder.h"> where necessary.

I also updated the Copyright comments where necessary, and modified the .gitignore file to ignore any .vscode folders

Copy link
Contributor

@fjeremic fjeremic left a comment

Choose a reason for hiding this comment

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

I can't comment on the content of the PR however the commit needs some work, more specifically [1]:

The first line describes the change made. It is written in the imperative mood, and should say what happens when the patch is applied. Keep it short and simple. The first line should be less than 70 characters, where reasonable, and should be written in sentence case preferably not ending in a period. Leave a blank line between the first line and the message body.

There seems to also be a few sign offs on the same commit which is unnecessary. See [1] for examples of commit contents.

[1] https://github.com/eclipse/openj9/blob/master/CONTRIBUTING.md#commit-guidelines

@AidanHa
Copy link
Contributor Author

AidanHa commented Jan 14, 2019

Ah, thank you for the link @fjeremic I will edit the commit messages.

The multiple unnecessary sign offs come from me squashing multiple smaller commits together. Will I only need to sign off one commit in this case (sign off the latest commit)?

@fjeremic
Copy link
Contributor

Will I only need to sign off one commit in this case (sign off the latest commit)?

That's correct.

@AidanHa AidanHa force-pushed the master branch 6 times, most recently from abf0327 to f99eaee Compare January 17, 2019 16:06
.gitignore Outdated
@@ -1,4 +1,4 @@
# Copyright (c) 2000, 2018 IBM Corp. and others
# Copyright (c) 2000, 2019 IBM Corp. and others
#
Copy link
Contributor

Choose a reason for hiding this comment

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

can you please revert the changes in this file

@@ -32,6 +32,7 @@
#include "cache.h"
#include "fastJNI.h"
#include "j9cfg.h"

Copy link
Contributor

Choose a reason for hiding this comment

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

please remove this added whitespace

@@ -35,6 +35,7 @@
#include <stddef.h> // for size_t
#include <stdint.h> // for uint32_t, int32_t, etc
#include <string.h> // for memcmp, strncmp

Copy link
Contributor

Choose a reason for hiding this comment

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

same here

@@ -32,6 +32,7 @@
#include "env/jittypes.h" // for uintptrj_t
#include "j9.h"
#include "j9nonbuilder.h"
#include "j9consts.h"
Copy link
Contributor

@tajila tajila Jan 22, 2019

Choose a reason for hiding this comment

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

was this needed?

@@ -32,7 +32,6 @@
#include "j9.h"
#include "j9cfg.h"


Copy link
Contributor

Choose a reason for hiding this comment

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

undo this change

@@ -33,6 +33,7 @@
#include "j9modron.h"
#include "j9nongenerated.h"
#include "j9nonbuilder.h"
#include "j9consts.h"
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 this needed for?

@@ -25,6 +25,7 @@
#define MARKINGDELEGATE_HPP_

#include "j9nonbuilder.h"
#include "j9consts.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

@@ -24,6 +24,7 @@
#define OBJECTMODELDELEGATE_HPP_

#include "j9nonbuilder.h"
#include "j9consts.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

^^

@@ -33,6 +33,7 @@
#include "j9vmconstantpool.h"
#include "j9consts.h"
#include "jvmti.h"
#include "omrsrp.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

is this still needed here, now that the macros are moved over to j9const.h ?

@@ -24,6 +24,7 @@
#include "j9gs.h"
#include "j9port_generated.h"
#include "j9nonbuilder.h"
#include "j9consts.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

is this needed?

@AidanHa
Copy link
Contributor Author

AidanHa commented Jan 22, 2019

@tajila for the some of the #include "j9consts.h" calls, I just wanted to make sure that all files that included nonbuilder.h also had j9consts (kind of a surefire way to make sure there were no errors). I will now remove all the unessesary #includes.

The added whitespace was me accidentally forgetting to remove them. Sorry.

Any reason why the .gitignore file changes should be reverted?

@AidanHa AidanHa force-pushed the master branch 2 times, most recently from 40c03e8 to 67e8c7c Compare January 24, 2019 18:16
@@ -388,4 +388,4 @@ public void comment(String string) {
out.print("\t/* " + string + " */");
}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

neeed to keep the newline

@tajila
Copy link
Contributor

tajila commented Jan 25, 2019

One minor comment rest LGTM

@dmitripivkine Please review the GC changes

@fjeremic Please review the JIT changes

@fjeremic fjeremic changed the title Removed Duplicate macros. Remove duplicate macros between j9nonbuilder.h and j9consts.h Jan 28, 2019
Copy link
Contributor

@fjeremic fjeremic left a comment

Choose a reason for hiding this comment

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

JIT changes look ok. However I'll point you to [1] for thet styling of git commits. The body should be wrapped at 72 chracters so as to make reading git log consistent and easy. I would highly reccomend reading [2] on why this matters. You can also use GitHub keywords such as "Fixes" [3] to automatically close the corresponding issues once this PR is merged. I've made all the modifications to the commit message on your behalf:

Remove duplicate macros between j9nonbuilder.h and j9consts.h

Replace and remove macros in j9consts.h and replaced those macros
accordingly, each with their respective duplicate in j9nonbuilder.h.

Steps:

- Remove duplicate macros from j9consts.h
- Replace the removed macros with their respective duplicate for 
wherever they appeared in the repository (This includes the macros in
the DDR code).
- Move the Macros from j9nonbuilder.h into j9consts.h. This is because
j9consts.h has a lot less structs that are dependant on other header
files.
- Add `#include j9consts.h` where necessary
- Change the copyrights of the modified files

Fixes: #4198

Signed-off-by: Aidan Ha <qbha@edu.uwaterloo.ca>

[1] https://github.com/eclipse/openj9/blob/master/CONTRIBUTING.md#commit-guidelines
[2] https://chris.beams.io/posts/git-commit/
[3] https://help.github.com/articles/closing-issues-using-keywords/

Copy link
Contributor

@dmitripivkine dmitripivkine left a comment

Choose a reason for hiding this comment

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

There are a few files with copyright year change only (no real changes):

runtime/gc_glue_java/ConcurrentMarkingDelegate.hpp
runtime/gc_glue_java/MarkingDelegate.hpp
runtime/gc_glue_java/ObjectModelDelegate.hpp
runtime/vm/guardedstorage.c

These files should be excluded from change set.
When fixed this PR LGTM

@keithc-ca
Copy link
Contributor

Will I only need to sign off one commit in this case (sign off the latest commit)?

That's correct.

No, each commit needs a Signed-off-by: line.

Copy link
Contributor

@keithc-ca keithc-ca left a comment

Choose a reason for hiding this comment

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

The changes look good to me. I'd like to see this rebased relative to a more recent commit (say no more than a day in the past).

@AidanHa
Copy link
Contributor Author

AidanHa commented Feb 8, 2019

Sure, let me add the fixes and do a rebase to see if anything will change

Replace and remove macros in j9consts.h and replaced those macros
accordingly, each with their respective duplicate in j9nonbuilder.h.

Steps:

- Remove duplicate macros from j9consts.h
- Replace the removed macros with their respective duplicate for
wherever they appeared in the repository (This includes the macros in
the DDR code).
- Move the Macros from j9nonbuilder.h into j9consts.h. This is because
j9consts.h has a lot less structs that are dependant on other header
files.
- Add `#include j9consts.h` where necessary
- Change the copyrights of the modified files

Fixes: eclipse-openj9#4198

Signed-off-by: Aidan Ha <qbha@edu.uwaterloo.ca>
@AidanHa
Copy link
Contributor Author

AidanHa commented Feb 8, 2019

I've rebased this branch to Eclipse:master just over an hour ago, and ran a build on my local machine (which ended up being successful) @keithc-ca. I've made changes to address the comments above.

@keithc-ca
Copy link
Contributor

Jenkins test sanity zlinux,win jdk8,jdk11

@keithc-ca keithc-ca self-assigned this Feb 8, 2019
@keithc-ca keithc-ca merged commit c436b1f into eclipse-openj9:master Feb 9, 2019
@gacholio
Copy link
Contributor

Reverted this due to DDR compile failures in the internal builds.

@keithc-ca
Copy link
Contributor

@AidanHa This might work in reverse: removing uses of J9JavaAccessFlags in favour of using constants in J9Consts.

@AidanHa
Copy link
Contributor Author

AidanHa commented Feb 11, 2019

I'm not too familiar with the DDR code but from my point of view, I noticed there are no macros in j9consts.h that map to the ddr namespace (in other words, no there’s no code like
/* @DDR_namespace: map_to_type=J9JavaAccessFlags */ in j9consts.h).

Perhaps when the DDR is being compiled, then it doesn't even look at j9consts.h? If that is the case, where can I go to fix this?

@keithc-ca
Copy link
Contributor

If there were no internal IBM builds, your change would have been fine. If we're going to consider eliminating duplicate constants, we must use only those that also were available in the past so that old core files produced by IBM builds can be analyzed.

@gacholio
Copy link
Contributor

While I agree that's good practice, there will be circumstances where the back compatibility pain will be too high. You can always use the DDR that shipped with the drop that produced the core to analyze it.

AidanHa referenced this pull request in AidanHa/openj9 Feb 26, 2019
Remove macros in j9consts.h and j9nonbuilder.h, and replace those macros
accordingly, each with their respective j9nonbuilder  duplicate in j9javaaccessflags.h.

Steps:

- Remove duplicate macros from j9consts.h and j9nonbuilder.h
-Replace those macros accordingly, each with their respective j9nonbuilder  duplicate in j9javaaccessflags.h wherever they appeared in the repository (This includes the macros in
the DDR code).
-Modify runtime/ddr/vmddrstructs.properties to allow support for Java8 and older
- Change the copyrights of the modified files

Fixes: eclipse-openj9#4198
Fixes: eclipseGH-4287
Signed-off-by: Aidan Ha <qbha@edu.uwaterloo.ca>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants