Update Lua to 5.4.4 (#7460)

* Update lua to 5.4.4 (fixes #7267)

Signed-off-by: lawsonamzn <70027408+lawsonamzn@users.noreply.github.com>
monroegm-disable-blank-issue-2
Nicholas Lawson 4 years ago committed by GitHub
parent 46a435b877
commit 3337bdd05d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -25,6 +25,11 @@ extern "C" {
# include <Lua/lualib.h>
# include <Lua/lauxlib.h>
# include <Lua/lobject.h>
// versions of LUA before 5.3.x used to define a union that contained a double, a pointer, and a long
// as L_Umaxalign. Newer versions define those inner types in the macro LUAI_MAXALIGN instead but
// no longer actually declare a union around it. For backward compatibility we define the same one here
union L_Umaxalign { LUAI_MAXALIGN; };
}
#include <limits>
@ -1687,6 +1692,11 @@ LUA_API const Node* lua_getDummyNode()
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
const char* ScriptDataContext::GetInterpreterVersion()
{
return LUA_VERSION;
}
//////////////////////////////////////////////////////////////////////////
ScriptContext*
ScriptDataContext::GetScriptContext() const
@ -4367,7 +4377,7 @@ LUA_API const Node* lua_getDummyNode()
lua_pushlightuserdata(m_lua, m_owner);
int tableRef = luaL_ref(m_lua, LUA_REGISTRYINDEX);
(void)tableRef;
AZ_Assert(tableRef == AZ_LUA_SCRIPT_CONTEXT_REF, "Table referece should match %d !", AZ_LUA_SCRIPT_CONTEXT_REF);
AZ_Assert(tableRef == AZ_LUA_SCRIPT_CONTEXT_REF, "Table reference should match %d but is instead %d!", AZ_LUA_SCRIPT_CONTEXT_REF, tableRef);
// create a AZGlobals table, we can use internal unodered_map if it's faster (TODO: test which is faster, or if there is a benefit keeping in la)
lua_createtable(m_lua, 0, 1024); // pre allocate some values in the hash

@ -212,6 +212,10 @@ namespace AZ
~ScriptDataContext() { Reset(); }
//! Retrieve a string representing the current version of the interpreter.
//! Example of use: To signal incompatibility with previously emitted bytecode, to invalidate
static const char* GetInterpreterVersion();
ScriptContext* GetScriptContext() const;
lua_State* GetNativeContext() const { return m_nativeContext; }

@ -14,38 +14,13 @@ extern "C" {
# include <Lua/lauxlib.h>
}
// Currently we support Lua 5.1 and later (we have tested with 5.2)
#if LUA_VERSION_NUM <= 502
inline void lua_pushunsigned(lua_State* l, unsigned int v)
{
lua_pushnumber(l, static_cast<lua_Number>(v));
}
inline unsigned int lua_tounsigned(lua_State* l, int idx)
{
return static_cast<unsigned int>(lua_tonumber(l, idx));
}
#define lua_pushglobaltable(L) lua_pushvalue(L, LUA_GLOBALSINDEX)
inline LUA_API int lua_load(lua_State* L, lua_Reader reader, void* data, const char* chunkname, const char* mode)
{
(void)mode;
return lua_load(L, reader, data, chunkname);
}
#define LUA_RIDX_LAST 0
#define LUA_NUMTAGS 9
#endif
#define AZ_LUA_SCRIPT_CONTEXT_REF LUA_RIDX_LAST + 1
#define AZ_LUA_GLOBALS_TABLE_REF LUA_RIDX_LAST + 2
#define AZ_LUA_CLASS_TABLE_REF LUA_RIDX_LAST + 3
#define AZ_LUA_WEAK_CACHE_TABLE_REF LUA_RIDX_LAST + 4
#define AZ_LUA_ERROR_HANDLER_FUN_REF LUA_RIDX_LAST + 5
// Currently we support Lua 5.4.4 and later
// note that Lua 5.x defines LUA_RID_LAST + 1 to be an index of a free-list.
#define AZ_LUA_SCRIPT_CONTEXT_REF LUA_RIDX_LAST + 2
#define AZ_LUA_GLOBALS_TABLE_REF LUA_RIDX_LAST + 3
#define AZ_LUA_CLASS_TABLE_REF LUA_RIDX_LAST + 4
#define AZ_LUA_WEAK_CACHE_TABLE_REF LUA_RIDX_LAST + 5
#define AZ_LUA_ERROR_HANDLER_FUN_REF LUA_RIDX_LAST + 6
#define AZ_LUA_CLASS_METATABLE_NAME_INDEX 1 // can we always read the name from the behavior class???
#define AZ_LUA_CLASS_METATABLE_BEHAVIOR_CLASS 2

@ -26,7 +26,7 @@ void LuaBuilder::BuilderPluginComponent::Activate()
AssetBuilderSDK::AssetBuilderDesc builderDescriptor;
builderDescriptor.m_name = "Lua Worker Builder";
builderDescriptor.m_version = 7;
builderDescriptor.m_analysisFingerprint = AZStd::string::format("%d", static_cast<AZ::u8>(AZ::ScriptAsset::AssetVersion));
builderDescriptor.m_analysisFingerprint = AZStd::string::format("%s-%d", LuaBuilderWorker::GetAnalysisFingerprint().c_str(), static_cast<AZ::u8>(AZ::ScriptAsset::AssetVersion));
builderDescriptor.m_patterns.push_back(AssetBuilderSDK::AssetBuilderPattern("*.lua", AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard));
builderDescriptor.m_busId = azrtti_typeid<LuaBuilderWorker>();
builderDescriptor.m_createJobFunction = AZStd::bind(&LuaBuilderWorker::CreateJobs, &m_luaBuilder, AZStd::placeholders::_1, AZStd::placeholders::_2);

@ -14,13 +14,13 @@
#include <AzCore/Math/MathReflection.h>
#include <AzCore/Script/ScriptAsset.h>
#include <AzCore/Script/ScriptContext.h>
#include <AzCore/Script/lua/lua.h>
#include <AzFramework/StringFunc/StringFunc.h>
#include <AzFramework/IO/LocalFileIO.h>
#include <AzCore/std/string/conversions.h>
#include <AzFramework/FileFunc/FileFunc.h>
#include <AzCore/Script/lua/lua.h> // for lua_tostring
namespace LuaBuilder
{
@ -36,8 +36,15 @@ namespace LuaBuilder
static const AZ::u32 s_BuildTypeKey = AZ_CRC("BuildType", 0xd01cbdd7);
static const char* s_BuildTypeCompiled = "Compiled";
static const char* s_BuildTypeText = "Text"; }
static const char* s_BuildTypeText = "Text";
}
AZStd::string LuaBuilderWorker::GetAnalysisFingerprint()
{
// mutating the Analysis Fingerprint will cause the CreateJobs function to run even
// on files which have not changed.
return AZ::ScriptDataContext::GetInterpreterVersion();
}
//////////////////////////////////////////////////////////////////////////
// CreateJobs
void LuaBuilderWorker::CreateJobs(const AssetBuilderSDK::CreateJobsRequest& request, AssetBuilderSDK::CreateJobsResponse& response)
@ -57,6 +64,11 @@ namespace LuaBuilder
descriptor.m_jobKey = "Lua Compile";
descriptor.SetPlatformIdentifier(info.m_identifier.c_str());
descriptor.m_critical = true;
// mutating the AdditionalFingerprintInfo will cause the job to run even if
// nothing else has changed (ie, files are the same, version of this builder didnt change)
// by doing this, changing the version of the interpreter is enough to cause the files to rebuild
// automatically.
descriptor.m_additionalFingerprintInfo = GetAnalysisFingerprint();
descriptor.m_jobParameters[s_BuildTypeKey] = info.HasTag("android") ? s_BuildTypeText : s_BuildTypeCompiled;
response.m_createJobOutputs.push_back(descriptor);
}

@ -34,6 +34,8 @@ namespace LuaBuilder
void ShutDown() override;
//////////////////////////////////////////////////////////////////////////
static AZStd::string GetAnalysisFingerprint();
void ParseDependencies(const AZStd::string& file, AssetBuilderSDK::ProductPathDependencySet& outDependencies);
private:

@ -19,7 +19,7 @@ ly_associate_package(PACKAGE_NAME glad-2.0.0-beta-rev2-multiplatform TARGETS gla
ly_associate_package(PACKAGE_NAME tiff-4.2.0.15-rev4-android TARGETS TIFF PACKAGE_HASH 2c62cdf34a8ee6c7eb091d05d98f60b4da7634c74054d4dbb8736886182f4589)
ly_associate_package(PACKAGE_NAME freetype-2.10.4.16-android TARGETS freetype PACKAGE_HASH df9e4d559ea0f03b0666b48c79813b1cd4d9624429148a249865de9f5c2c11cd)
ly_associate_package(PACKAGE_NAME AWSNativeSDK-1.9.50-rev1-android TARGETS AWSNativeSDK PACKAGE_HASH 33771499f9080cbaab613459927e52911e68f94fa356397885e85005efbd1490)
ly_associate_package(PACKAGE_NAME Lua-5.3.5-rev5-android TARGETS Lua PACKAGE_HASH 1f638e94a17a87fe9e588ea456d5893876094b4db191234380e4c4eb9e06c300)
ly_associate_package(PACKAGE_NAME Lua-5.4.4-rev1-android TARGETS Lua PACKAGE_HASH 2adda1831577336454090f249baf09519f41bb73160cd1d5b5b33564729af4a2)
ly_associate_package(PACKAGE_NAME PhysX-4.1.2.29882248-rev5-android TARGETS PhysX PACKAGE_HASH b346e8f9bc55f367a97d781d94c8a5c3bff8059478b8a7007e5fd17708dc1d07)
ly_associate_package(PACKAGE_NAME mikkelsen-1.0.0.4-android TARGETS mikkelsen PACKAGE_HASH 075e8e4940884971063b5a9963014e2e517246fa269c07c7dc55b8cf2cd99705)
ly_associate_package(PACKAGE_NAME googletest-1.8.1-rev4-android TARGETS googletest PACKAGE_HASH 95671be75287a61c9533452835c3647e9c1b30f81b34b43bcb0ec1997cc23894)

@ -24,7 +24,7 @@ ly_associate_package(PACKAGE_NAME AWSGameLiftServerSDK-3.4.1-rev1-linux
ly_associate_package(PACKAGE_NAME tiff-4.2.0.15-rev3-linux TARGETS TIFF PACKAGE_HASH 2377f48b2ebc2d1628d9f65186c881544c92891312abe478a20d10b85877409a)
ly_associate_package(PACKAGE_NAME freetype-2.10.4.16-linux TARGETS freetype PACKAGE_HASH 3f10c703d9001ecd2bb51a3bd003d3237c02d8f947ad0161c0252fdc54cbcf97)
ly_associate_package(PACKAGE_NAME AWSNativeSDK-1.9.50-rev1-linux TARGETS AWSNativeSDK PACKAGE_HASH f30b6969c6732a7c1a23a59d205a150633a7f219dcb60d837b543888d2c63ea1)
ly_associate_package(PACKAGE_NAME Lua-5.3.5-rev7-linux TARGETS Lua PACKAGE_HASH 81a6ce4965c63e264f923d3ca04ddc40c27074b3e607073c6ad90eca32b9c260)
ly_associate_package(PACKAGE_NAME Lua-5.4.4-rev1-linux TARGETS Lua PACKAGE_HASH d582362c3ef90e1ef175a874abda2265839ffc2e40778fa293f10b443b4697ac)
ly_associate_package(PACKAGE_NAME PhysX-4.1.2.29882248-rev5-linux TARGETS PhysX PACKAGE_HASH fa72365df409376aef02d1763194dc91d255bdfcb4e8febcfbb64d23a3e50b96)
ly_associate_package(PACKAGE_NAME mcpp-2.7.2_az.2-rev1-linux TARGETS mcpp PACKAGE_HASH df7a998d0bc3fedf44b5bdebaf69ddad6033355b71a590e8642445ec77bc6c41)
ly_associate_package(PACKAGE_NAME mikkelsen-1.0.0.4-linux TARGETS mikkelsen PACKAGE_HASH 5973b1e71a64633588eecdb5b5c06ca0081f7be97230f6ef64365cbda315b9c8)

@ -25,7 +25,7 @@ ly_associate_package(PACKAGE_NAME SPIRVCross-2021.04.29-rev1-mac
ly_associate_package(PACKAGE_NAME tiff-4.2.0.15-rev3-mac TARGETS TIFF PACKAGE_HASH c2615ccdadcc0e1d6c5ed61e5965c4d3a82193d206591b79b805c3b3ff35a4bf)
ly_associate_package(PACKAGE_NAME freetype-2.10.4.16-mac TARGETS freetype PACKAGE_HASH f159b346ac3251fb29cb8dd5f805c99b0015ed7fdb3887f656945ca701a61d0d)
ly_associate_package(PACKAGE_NAME AWSNativeSDK-1.9.50-rev1-mac TARGETS AWSNativeSDK PACKAGE_HASH 6c27a49376870c606144e4639e15867f9db7e4a1ee5f1a726f152d3bd8459966)
ly_associate_package(PACKAGE_NAME Lua-5.3.5-rev6-mac TARGETS Lua PACKAGE_HASH b9079fd35634774c9269028447562c6b712dbc83b9c64975c095fd423ff04c08)
ly_associate_package(PACKAGE_NAME Lua-5.4.4-rev1-mac TARGETS Lua PACKAGE_HASH b44daae6bfdf092c7935e4aebafded6772853250c6f0a209866a1ac599857d58)
ly_associate_package(PACKAGE_NAME PhysX-4.1.2.29882248-rev5-mac TARGETS PhysX PACKAGE_HASH 83940b3876115db82cd8ffcb9e902278e75846d6ad94a41e135b155cee1ee186)
ly_associate_package(PACKAGE_NAME mcpp-2.7.2_az.2-rev1-mac TARGETS mcpp PACKAGE_HASH be9558905c9c49179ef3d7d84f0a5472415acdf7fe2d76eb060d9431723ddf2e)
ly_associate_package(PACKAGE_NAME mikkelsen-1.0.0.4-mac TARGETS mikkelsen PACKAGE_HASH 83af99ca8bee123684ad254263add556f0cf49486c0b3e32e6d303535714e505)

@ -26,7 +26,7 @@ ly_associate_package(PACKAGE_NAME SPIRVCross-2021.04.29-rev1-windows
ly_associate_package(PACKAGE_NAME tiff-4.2.0.15-rev3-windows TARGETS TIFF PACKAGE_HASH c6000a906e6d2a0816b652e93dfbeab41c9ed73cdd5a613acd53e553d0510b60)
ly_associate_package(PACKAGE_NAME freetype-2.10.4.16-windows TARGETS freetype PACKAGE_HASH 9809255f1c59b07875097aa8d8c6c21c97c47a31fb35e30f2bb93188e99a85ff)
ly_associate_package(PACKAGE_NAME AWSNativeSDK-1.9.50-rev2-windows TARGETS AWSNativeSDK PACKAGE_HASH 047de23fa57d33196666c22f45afc9c628bae354a6c39d774cbeee8054b2eb53)
ly_associate_package(PACKAGE_NAME Lua-5.3.5-rev5-windows TARGETS Lua PACKAGE_HASH 136faccf1f73891e3fa3b95f908523187792e56f5b92c63c6a6d7e72d1158d40)
ly_associate_package(PACKAGE_NAME Lua-5.4.4-rev1-windows TARGETS Lua PACKAGE_HASH 8ac853288712267ec9763be152a9274ce87b54728b8add97e2ba73c0fd5a0345)
ly_associate_package(PACKAGE_NAME PhysX-4.1.2.29882248-rev5-windows TARGETS PhysX PACKAGE_HASH 4e31a3e1f5bf3952d8af8e28d1a29f04167995a6362fc3a7c20c25f74bf01e23)
ly_associate_package(PACKAGE_NAME mcpp-2.7.2_az.2-rev1-windows TARGETS mcpp PACKAGE_HASH 794789aba639bfe2f4e8fcb4424d679933dd6290e523084aa0a4e287ac44acb2)
ly_associate_package(PACKAGE_NAME mikkelsen-1.0.0.4-windows TARGETS mikkelsen PACKAGE_HASH 872c4d245a1c86139aa929f2b465b63ea4ea55b04ced50309135dd4597457a4e)

@ -19,7 +19,7 @@ ly_associate_package(PACKAGE_NAME glad-2.0.0-beta-rev2-multiplatform TARGETS gla
ly_associate_package(PACKAGE_NAME tiff-4.2.0.15-rev3-ios TARGETS TIFF PACKAGE_HASH e9067e88649fb6e93a926d9ed38621a9fae360a2e6f6eb24ebca63c1bc7761ea)
ly_associate_package(PACKAGE_NAME freetype-2.10.4.16-ios TARGETS freetype PACKAGE_HASH 3ac3c35e056ae4baec2e40caa023d76a7a3320895ef172b6655e9261b0dc2e29)
ly_associate_package(PACKAGE_NAME AWSNativeSDK-1.9.50-rev1-ios TARGETS AWSNativeSDK PACKAGE_HASH c3c9478c259ecb569fb2ce6fcfa733647adc3b6bd2854e8eff9de64bcd18c745)
ly_associate_package(PACKAGE_NAME Lua-5.3.5-rev5-ios TARGETS Lua PACKAGE_HASH c2d3c4e67046c293049292317a7d60fdb8f23effeea7136aefaef667163e5ffe)
ly_associate_package(PACKAGE_NAME Lua-5.4.4-rev1-ios TARGETS Lua PACKAGE_HASH 82f27bf6c745c98395dcea7ec72f82cb5254fd19fca9f5ac7a6246527a30bacb)
ly_associate_package(PACKAGE_NAME PhysX-4.1.2.29882248-rev5-ios TARGETS PhysX PACKAGE_HASH 4a5e38b385837248590018eb133444b4e440190414e6756191200a10c8fa5615)
ly_associate_package(PACKAGE_NAME mikkelsen-1.0.0.4-ios TARGETS mikkelsen PACKAGE_HASH 976aaa3ccd8582346132a10af253822ccc5d5bcc9ea5ba44d27848f65ee88a8a)
ly_associate_package(PACKAGE_NAME googletest-1.8.1-rev4-ios TARGETS googletest PACKAGE_HASH 2f121ad9784c0ab73dfaa58e1fee05440a82a07cc556bec162eeb407688111a7)

Loading…
Cancel
Save