Page MenuHomeWildfire Games

[WIP] Upgrade to ESR SM102
Needs ReviewPublic

Authored by wraitii on May 22 2023, 2:53 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This contains the required code changes to upgrade to SM 102, the next ESR. See the migration guide: https://github.com/mozilla-spidermonkey/spidermonkey-embedding-examples/blob/esr102/docs/Migration%20Guide.md
The main thing affecting us is the removal of the private slot. We should probably standardize more on the reserved slot we want to use.

TODO: I ran into a weird crash because of deepFreeze being called on g_Settings. I debugged this in debug mode, and it doesn't happen if we don't deepfreeze/if we 'deep-freeze' manually in JS by recursing.
I have asked in the mozilla chatroom, maybe I'll get an answer there. Needs investigation.

There is also a crash in debug mode because it seems we need to set a header define that isn't set by default.

TODO: provide tarball and test on other platforms. I had weird pkg-config issues on my system.

As things currently stand, I am able to get ingame in debug mode so I think this should be basically all we need with the above caveats.

Test Plan

compile SM102, compile 0 A.D., play.

Event Timeline

wraitii created this revision.May 22 2023, 2:53 PM
Owners added a subscriber: Restricted Owners Package.May 22 2023, 2:53 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/6988/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Debug:
     6>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\mozilla\assertions.h(428): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\rlinterface.vcxproj]
     7>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\mozilla\assertions.h(428): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\network.vcxproj]
     6>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\rlinterface.vcxproj]
     7>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\network.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\mozilla\assertions.h(428): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition (compiling source file ..\..\..\source\scriptinterface\ScriptContext.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\scriptinterface.vcxproj]
    12>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\mozilla\assertions.h(428): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\simulation2.vcxproj]
    12>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\simulation2.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. (compiling source file ..\..\..\source\scriptinterface\ScriptContext.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\scriptinterface.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(25): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition (compiling source file ..\..\..\source\scriptinterface\JSON.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\scriptinterface.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. (compiling source file ..\..\..\source\scriptinterface\JSON.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\scriptinterface.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(25): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition (compiling source file ..\..\..\source\scriptinterface\ScriptConversions.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\scriptinterface.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. (compiling source file ..\..\..\source\scriptinterface\ScriptConversions.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\scriptinterface.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(25): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition (compiling source file ..\..\..\source\scriptinterface\ScriptInterface.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\scriptinterface.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(25): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition (compiling source file ..\..\..\source\scriptinterface\ScriptExceptions.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\scriptinterface.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. (compiling source file ..\..\..\source\scriptinterface\ScriptInterface.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\scriptinterface.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. (compiling source file ..\..\..\source\scriptinterface\ScriptExceptions.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\scriptinterface.vcxproj]
     9>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\mozilla\assertions.h(428): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition (compiling source file ..\..\..\source\lobby\Globals.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\lobby.vcxproj]
     9>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\mozilla\assertions.h(428): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition (compiling source file ..\..\..\source\i18n\L10n.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\lobby.vcxproj]
     9>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. (compiling source file ..\..\..\source\lobby\Globals.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\lobby.vcxproj]
     9>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\mozilla\assertions.h(428): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition (compiling source file ..\..\..\source\lobby\XmppClient.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\lobby.vcxproj]
     9>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. (compiling source file ..\..\..\source\i18n\L10n.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\lobby.vcxproj]
     9>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\mozilla\assertions.h(428): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition (compiling source file ..\..\..\source\lobby\scripting\GlooxScriptConversions.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\lobby.vcxproj]
     9>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. (compiling source file ..\..\..\source\lobby\XmppClient.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\lobby.vcxproj]
     9>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. (compiling source file ..\..\..\source\lobby\scripting\GlooxScriptConversions.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\lobby.vcxproj]
    13>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\mozilla\assertions.h(428): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\engine.vcxproj]
     9>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\mozilla\assertions.h(428): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition (compiling source file ..\..\..\source\lobby\scripting\JSInterface_Lobby.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\lobby.vcxproj]
    13>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\engine.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(25): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition (compiling source file ..\..\..\source\scriptinterface\StructuredClone.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\scriptinterface.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(25): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition (compiling source file ..\..\..\source\scriptinterface\ScriptStats.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\scriptinterface.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. (compiling source file ..\..\..\source\scriptinterface\StructuredClone.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\scriptinterface.vcxproj]
    11>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. (compiling source file ..\..\..\source\scriptinterface\ScriptStats.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\scriptinterface.vcxproj]
     9>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. (compiling source file ..\..\..\source\lobby\scripting\JSInterface_Lobby.cpp) [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\lobby.vcxproj]
    14>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\mozilla\assertions.h(428): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\graphics.vcxproj]
    14>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\graphics.vcxproj]
    15>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(25): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\gui.vcxproj]
    16>e:\jenkins\workspace\vs2015-differential\libraries\source\spidermonkey\include-win32-debug\mozilla\assertions.h(428): warning C4005: 'MOZ_DIAGNOSTIC_ASSERT_ENABLED': macro redefinition [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\atlas.vcxproj]
    16>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\atlas.vcxproj]
    15>e:\jenkins\workspace\vs2015-differential\source\scriptinterface\scripttypes.h(85): fatal error C1189: #error:  Your compiler is trying to use an incorrect major version of the SpiderMonkey library. The only version that works is the one in the libraries/spidermonkey/ directory, and it will not work with a typical system-installed version. Make sure you have got all the right files and include paths. [E:\Jenkins\workspace\vs2015-differential\build\workspaces\vs2017\gui.vcxproj]

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/8079/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/8662/display/redirect

wraitii requested review of this revision.May 22 2023, 2:56 PM
wraitii added inline comments.May 22 2023, 3:00 PM
source/ps/XMB/XMBStorage.cpp
296–300

Removed it seems

source/ps/scripting/JSInterface_VFS.cpp
85

This was actually crashing in debug mode, and it seems invalid since it attempted to copy content. Set 0 instead, see also Object.h

source/scriptinterface/Object.h
160

See summary, this crashes

source/scriptinterface/ScriptInterface.h
230

Shouldn't be 0 but some constant likely

source/simulation2/scripting/EngineScriptConversions.cpp
65

likewise shouldn't be 0

source/simulation2/system/ParamNode.cpp
399

Can't say I'm too sure why we bothered with the NewString stuff

sera added a subscriber: sera.May 22 2023, 3:22 PM
sera added inline comments.
libraries/source/spidermonkey/patch.sh
32

the comment says fixed in 102

37

shouldn't be needed either

source/simulation2/system/InterfaceScripted.h
27

slot count might not be 1, unless you set always 0 with your "should be a constant"

I'd go with an enum like the moz internal code does.

wraitii added inline comments.May 22 2023, 3:24 PM
source/simulation2/system/InterfaceScripted.h
27

Think we should always just use 0, but yeah it's sorta the same issue.

Stan added a subscriber: Stan.May 22 2023, 3:27 PM

You're missing one change in premake5.lua See: https://code.wildfiregames.com/rP27440

source/simulation2/system/ParamNode.cpp
399

Is it possible it's a platform difference?

sera added a comment.Dec 29 2023, 11:07 PM

wrt deepfreeze

I have asked in the mozilla chatroom, maybe I'll get an answer there. Needs investigation.

Did anything come out of it?

Also 102.15.1 is the last of the esr 102 releases, so guess we could go ahead with this and if we do the sooner the better.

phosit added a subscriber: phosit.Dec 30 2023, 12:46 PM
phosit added inline comments.
source/ps/XMB/XMBStorage.cpp
296–300

I guess you only wanted to remove JSTYPE_NULL. You also changed JSTYPE_UNDEFINED.

source/scriptinterface/ScriptInterface.h
252

Is there a reason why for JS::GetReservedSlot we have to use static_cast but here we don't.

s0600204 added inline comments.
source/simulation2/system/ParamNode.cpp
399

It appears to have been as part of a work-around to convert UTF-8 encoded characters - with this revision applied, the names of units and structures containing non-ascii characters appear as mojibake.

See also #6905 for a build failure of sm91 on macOS 14 w. XCode 15 that will also prevent building sm102 on such systems as well.