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

configure: fix type of arm_version #14595

Closed
wants to merge 1 commit into from

Conversation

hujiajie
Copy link
Contributor

@hujiajie hujiajie commented Aug 2, 2017

arm_version is compared with an integer 7 in V8's GYP files, instead of the string "7", so it seems that this variable should be an integer when it is representing a version number. Its default value in V8's
standalone.gypi seconds this.

It also seems that GYP can quietly convert an integer-like string to an integer in some scenarios, maybe during the merge of some dictionaries, so luckily no actual problem happens at the moment. However, the subtle difference between 7 and "7" will be observed when a new GYP variable is added to V8's toolchain.gypi like this:

{
  'variables': {
    ...
    'conditions': [
      ...
      ['arm_version==7', {
        'myvar%': 'abc',
      }],
    ],
    ...
  },
  ...
}

Interestingly no implicit conversion happens here when arm_version is "7", so GYP will complain about the undefined variable <(myvar) if it's referenced later on.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

build, arm

arm_version is compared with an integer 7 in V8's GYP files, instead of
the string "7", so it seems that this variable should be an integer when
it is representing a version number. Its default value in V8's
standalone.gypi seconds this.

It also seems that GYP can quietly convert an integer-like string to an
integer in some scenarios, maybe during the merge of some dictionaries,
so luckily no actual problem happens at the moment. However, the subtle
difference between 7 and "7" will be observed when a new GYP variable is
added to V8's toolchain.gypi like this:

{
  'variables': {
    ...
    'conditions': [
      ...
      ['arm_version==7', {
        'myvar%': 'abc',
      }],
    ],
    ...
  },
  ...
}

Interestingly no implicit conversion happens here when arm_version is
"7", so GYP will complain about the undefined variable <(myvar) if it's
referenced later on.
@nodejs-github-bot nodejs-github-bot added the build Issues and PRs related to build files or the CI. label Aug 2, 2017
@mscdex
Copy link
Contributor

mscdex commented Aug 2, 2017

Won't this break any/all existing binding.gyp files out in the wild that currently check against the string version?

Also, it seems like you should be guarding against (in one way or another) undefined variables like that, especially when the variable is defined within a conditional.

@hujiajie
Copy link
Contributor Author

hujiajie commented Aug 3, 2017

Won't this break any/all existing binding.gyp files out in the wild that currently check against the string version?

I have the same concern, so looking forward to more feedback.

Also, it seems like you should be guarding against (in one way or another) undefined variables like that, especially when the variable is defined within a conditional.

Do you mean something like this:

{
  'variables': {
    ...
    'conditions': [
      ...
      ['arm_version==7', {
        'myvar%': 'abc',
      }],
    ],
    ...
  },
  'target_defaults': {
    ...
    'conditions': [
      ...
      ['arm_version==7', {
        'cflags': [ '<(myvar)' ],
      }],
      ...
    ],
    ...
  },
}

Absolutely later references to myvar should be guarded, though I didn't mention that before for simplicity. However, the two 'arm_version==7' expressions are evaluated to different results, and in fact the case is the origination of my confusion.

@refack
Copy link
Contributor

refack commented Aug 3, 2017

Won't this break any/all existing binding.gyp files out in the wild that currently check against the string version?

I have the same concern, so looking forward to more feedback.

Interestingly from a quick look at a GitHub search it seems it's more common to compare to a number then to a string (clones of V8's toolchain.gypi are very popular) so it seems like this will do more good then harm.

But if we want to be extra conservative you could define a new var { 'arm_version_numeric': 7 }

/cc @bnoordhuis @nodejs/platform-arm

@BridgeAR
Copy link
Member

@nodejs/build PTAL

@BridgeAR
Copy link
Member

Again @nodejs/build PTAL

@refack
Copy link
Contributor

refack commented Sep 14, 2017

@nodejs/platform-arm PTAL

@BridgeAR
Copy link
Member

Ping @nodejs/tsc

@BridgeAR BridgeAR requested a review from a team September 24, 2017 15:51
@BridgeAR
Copy link
Member

I am marking this defensively as semver-major.

@BridgeAR BridgeAR added the semver-major PRs that contain breaking changes and should be released in the next major version. label Sep 25, 2017
@BridgeAR BridgeAR requested a review from a team September 28, 2017 06:07
@BridgeAR
Copy link
Member

@nodejs/tsc PTAL

@BridgeAR
Copy link
Member

@nodejs/tsc PTAL!

@jasnell
Copy link
Member

jasnell commented Nov 22, 2017

still LGTM

@BridgeAR
Copy link
Member

Well, it still needs another LG

@Trott
Copy link
Member

Trott commented Nov 24, 2017

I'll be surprised if this uncovers any problems, but we should do this for all semver-major changes, so...

CITGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1107/

Copy link
Contributor

@refack refack left a comment

Choose a reason for hiding this comment

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

FWIW

@Trott
Copy link
Member

Trott commented Nov 28, 2017

Needs one more TSC member approval and the most obvious reviewer is @rvagg so...ping!

@mhdawson
Copy link
Member

mhdawson commented Nov 28, 2017

Did somebody review the citgm results to figure out if they are ok or not ?

@MylesBorins
Copy link
Contributor

Can you please rebase this against master and then run CITGM again. CITGM was run against a head that was still pre-release

@Trott
Copy link
Member

Trott commented Dec 1, 2017

Can you please rebase this against master and then run CITGM again.

You can instruct the citgm-smoker job to rebase against origin/master in the form so probably no need to rebase against master in this branch. Or am I missing a subtlety?

@Trott
Copy link
Member

Trott commented Dec 1, 2017

CITGM with rebase against master (I think--I put origin/master in the REBASE_ONTO field): https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1122/

@rvagg
Copy link
Member

rvagg commented Dec 2, 2017

meh, I think I'm -0 on this for now. We're making a pretty safe assumption that (a) we're limited to Cortex-A and (b) ARM will stick with its numbering. But let's take a look at both of those:

  • It's not entirely implausible that we might see a Cortex-R or Cortex-M version of Node at some point in the future (probably not using V8 I reckon). The standard way of naming architectures is like "ARMv7-A", "ARMv7-R", etc. We're just pulling out the number, we'd need an additional way of identifying variants and arm_version seems like a good place to extend to something like '8R'. Of course an alternative would be arm_variant but that might be stripping too much information out of arm_version because M and R are very different to A and it's the kind of thing you'd want front and centre.
  • ARM decided to do a minor rebrand with v8 by referring to it as "ARM64" or "AArch64" even though underneath we still use ARMv8. I'm not confident that they won't throw a spanner in the works as soon as v9 since they've boxed themselves in a corner with the unversioned "ARM64" / "AArch64". Then when v10 comes out you have an alphanumeric sorting problem so maybe just throw it up in the air anyway.

But as I said, pretty safe assumption that it won't change in the near future, hence I'm not a full -1 here. I'd probably be happier with arm_version_numeric or similar.

@bnoordhuis any thoughts from you?

@MylesBorins
Copy link
Contributor

I've run citgm against the latest v9.x release to compare https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker-nobuild/205/

I'm going to start auditing the failures and figure out if we can get closer to green

@BridgeAR
Copy link
Member

@MylesBorins what was the result of the audit? Did it look good or not really?

@BridgeAR
Copy link
Member

Ping @MylesBorins

@BridgeAR BridgeAR added the tsc-agenda Issues and PRs to discuss during the meetings of the TSC. label Jan 19, 2018
@BridgeAR
Copy link
Member

@nodejs/tsc PTAL. This needs another LG and it is somewhat controversial.

@joyeecheung
Copy link
Member

Considering #14595 (comment) I am -0 towards this change, arm_version_numeric sounds like a better idea if we can update the upstream as well.

@Trott
Copy link
Member

Trott commented Jan 24, 2018

I'm completely neutral on this. I feel like it's probably OK but I defer to people like @rvagg and @joyeecheung on this sort of stuff. I'm only leaving this comment because I know there's a need for another TSC approval and I wanted to explain why I've not been the one to come along and give it.

@mcollina
Copy link
Member

I have no ground to make an informed decision here. I do not see how much of the ecosystem could be broken by this PR.
I’m -0, as the potential breakage might be too much.

@fhinkel
Copy link
Member

fhinkel commented Jan 31, 2018

I’m -0, as the potential breakage might be too much.

Same.

@Fishrock123
Copy link
Contributor

I think Rod's comment here make sense, also -0.

@mhdawson
Copy link
Member

This was discussed in the TSC meeting, but people were not comfortable that we have enough data showing that it won't cause breakage for users. Since it does not seem to fix an urgent issue until there is more data/discussion it needs to wait.

@BridgeAR
Copy link
Member

BridgeAR commented Feb 7, 2018

As most people do not seem comfortable with this I am going to close it.

@hujiajie thanks a lot for your work! It is much appreciated even though this did not land!

If anyone feels like closing this is a mistake, please leave a comment / reopen.

@BridgeAR BridgeAR closed this Feb 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. semver-major PRs that contain breaking changes and should be released in the next major version. tsc-agenda Issues and PRs to discuss during the meetings of the TSC.
Projects
None yet
Development

Successfully merging this pull request may close these issues.