Skip to content

Remove the JERRY_SNAPSHOT_FOUR_BYTE_CPOINTER snapshot flag. #2550

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

Merged
merged 1 commit into from
Oct 5, 2018

Conversation

rtakacs
Copy link
Contributor

@rtakacs rtakacs commented Oct 4, 2018

Removed the JERRY_SNAPSHOT_FOUR_BYTE_CPOINTER flag because that is not necessary. Also updated the snapshot version.

Copy link
Member

@zherczeg zherczeg left a comment

Choose a reason for hiding this comment

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

LGTM

@galpeter
Copy link
Contributor

galpeter commented Oct 4, 2018

Shouldn't there be a CMakeLists modification also? Or I'm missing something?

@@ -41,7 +41,7 @@ typedef struct
/**
* Jerry snapshot format version.
*/
#define JERRY_SNAPSHOT_VERSION (18u)
#define JERRY_SNAPSHOT_VERSION (19u)
Copy link
Member

Choose a reason for hiding this comment

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

Since the snapshot version number has increased, this expected output should be modified as well.

Copy link
Member

Choose a reason for hiding this comment

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

Is this really a change in the snapshot version at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rerobika @akiss You are right, the expected output of the snapshot test also should be modified. Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

The format of snapshots are not changed in this patch. I agree with @akosthekiss, no need to change the snapshot version.

Copy link
Member

Choose a reason for hiding this comment

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

@rtakacs two notes:

  • the intent of my original comment was to suggest that the version should not be changed (as @LaszloLango also pointed out)
  • on these forums, @akiss is not me: it's a project/tool ran by INRIA (France). here, I'm @akosthekiss ;)

@@ -51,8 +51,6 @@ typedef enum
/* 8 bits are reserved for dynamic features */
JERRY_SNAPSHOT_HAS_REGEX_LITERAL = (1u << 0), /**< byte code has regex literal */
JERRY_SNAPSHOT_HAS_CLASS_LITERAL = (1u << 1), /**< byte code has class literal */
/* 24 bits are reserved for compile time features */
JERRY_SNAPSHOT_FOUR_BYTE_CPOINTER = (1u << 8) /**< compressed pointers are four byte long */
Copy link
Member

Choose a reason for hiding this comment

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

Is it OK to simply drop this enumerator? In other public API headers (e.g., jerryscript-core.h), there are examples to keep deprecated enumerators with original values, with a comment stating that it's "deprecated, an unused placeholder now" (see jerry_init_flag_t).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the clarification. I've modified the patch and added a deprecated marker to this entry.

@@ -41,7 +41,7 @@ typedef struct
/**
* Jerry snapshot format version.
*/
#define JERRY_SNAPSHOT_VERSION (18u)
#define JERRY_SNAPSHOT_VERSION (19u)
Copy link
Member

Choose a reason for hiding this comment

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

Is this really a change in the snapshot version at all?

@rtakacs rtakacs force-pushed the update_snapthot branch 2 times, most recently from daa6065 to 78d8882 Compare October 4, 2018 10:07
@rtakacs
Copy link
Contributor Author

rtakacs commented Oct 4, 2018

@galpeter There is nothing in the CMake files for the JERRY_SNAPSHOT_FOUR_BYTE_CPOINTER. So the CMake files should not be modified.

@akosthekiss
Copy link
Member

Note to ourselves in the future: JERRY_SNAPSHOT_VERSION, the 4th byte of the snapshot format, is increasing somewhat fast. Which is not a bad thing per se. But it is "already" around 0x12 ~ 0x13. At least 237 (236?) increments later, i.e., when we reach 0xFF, we'll have to change the snapshot format and stick that 4th byte to 0xFF so that it doesn't flip back to 0 at the next increment and cause potential problems; and then we'll have to introduce some other byte(s) in the format to store the file format version from that point on. I'd suggest we don't wait for that so long but do the format change when we reach 0x53 (at the latest) and make that byte and the following 3 bytes also part of the magic string of the format, fixating them to 0x4E 0x41 0x50, thus making the first 8 bytes read 'JRRYSNAP'. (And add a non-1-byte version field after the magic. 4 bytes could then last "forever".)

@zherczeg
Copy link
Member

zherczeg commented Oct 4, 2018

I don't really understand this. We only need to worry if version 4 billion is reached, since we have 4 bytes for version number.

@akosthekiss
Copy link
Member

Oh, do we? I must have misinterpreted something. My bad. Scratch the above then.

@zherczeg
Copy link
Member

zherczeg commented Oct 4, 2018

Maybe the little endian format is the root of confusion. So the first byte is the last byte of the version number. The little/big endian can be detected from the magic, which is JRRY of little and YRRJ for big endian systems. The version number bytes are ordered accordingly.

@akosthekiss akosthekiss added api Related to the public API snapshot Related to the snapshot feature labels Oct 4, 2018
@akosthekiss
Copy link
Member

Not to be missed because of the noise generated by me: @rtakacs I still think that this patch should not increase the snapshot version number.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs [email protected]
@rtakacs
Copy link
Contributor Author

rtakacs commented Oct 5, 2018

@akosthekiss I've changed back the snapshot version to 18.

Copy link
Member

@akosthekiss akosthekiss left a comment

Choose a reason for hiding this comment

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

LGTM

@akosthekiss akosthekiss merged commit 1302887 into jerryscript-project:master Oct 5, 2018
@rtakacs rtakacs deleted the update_snapthot branch January 18, 2019 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to the public API snapshot Related to the snapshot feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants