Skip to content

Commit

Permalink
Move bytecode version constant to its own header
Browse files Browse the repository at this point in the history
Summary:
Add a header file that only contains the bytecode version number.

This makes it easier to programmatically determine whether
the version has been updated, enabling greater signal-to-noise
ratio in tooling that prevents forgotten version bumps.

Reviewed By: neildhar

Differential Revision: D29522296

fbshipit-source-id: 13cdd668b53bafec3049cc19181b334ace9d2ca3
  • Loading branch information
kodafb authored and facebook-github-bot committed Jul 4, 2021
1 parent cec7541 commit 7324df9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
5 changes: 1 addition & 4 deletions include/hermes/BCGen/HBC/BytecodeFileFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#ifndef HERMES_BCGEN_HBC_BYTECODEFILEFORMAT_H
#define HERMES_BCGEN_HBC_BYTECODEFILEFORMAT_H

#include "hermes/BCGen/HBC/BytecodeVersion.h"
#include "hermes/BCGen/HBC/StringKind.h"
#include "hermes/Support/Compiler.h"
#include "hermes/Support/RegExpSerialization.h"
Expand All @@ -28,10 +29,6 @@ const static uint64_t MAGIC = 0x1F1903C103BC1FC6;
// bytecode file is in a form suitable for delta diffing, not execution.
const static uint64_t DELTA_MAGIC = ~MAGIC;

// Bytecode version generated by this version of the compiler.
// Updated: Mar 11, 2021
const static uint32_t BYTECODE_VERSION = 83;

/// Property cache index which indicates no caching.
static constexpr uint8_t PROPERTY_CACHING_DISABLED = 0;

Expand Down
28 changes: 28 additions & 0 deletions include/hermes/BCGen/HBC/BytecodeVersion.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

#ifndef HERMES_BCGEN_HBC_BYTECODEVERSION_H
#define HERMES_BCGEN_HBC_BYTECODEVERSION_H

#include <cstdint>

/*
* This file should *only* contain the version number constant definition,
* to enable tooling to determine whether the version has been updated.
*/

namespace hermes {
namespace hbc {

// Bytecode version generated by this version of the compiler.
// Updated: Mar 11, 2021
const static uint32_t BYTECODE_VERSION = 83;

} // namespace hbc
} // namespace hermes

#endif // HERMES_BCGEN_HBC_BYTECODEVERSION_H

0 comments on commit 7324df9

Please sign in to comment.