binaryen icon indicating copy to clipboard operation
binaryen copied to clipboard

C API: Add support for clearing up interned objects

Open mobsceneZ opened this issue 1 year ago • 3 comments

Hey developers, sorry about the late response for issue #6239, I've been struggling with the "static initialization order fiasco" problem when trying to move static variables like globalStrings outside the function. The source code in the PR may not be the best solution but that's my best effort.

If there are any problems, please feel free to leave some comments and let me know.

mobsceneZ avatar Feb 11 '24 09:02 mobsceneZ

The CI / build (windows-latest) (pull_request) failed at test stage, and it seems like the built wasm-as.exe could not even print the version info. Thus, I tried to manually reproduce the CI process on my local machine:

Build Environment:
Visual Studio 17 2022 with MSVC 19.38.33135.0
Python 3.6.7 with packages satisfying requirements-dev.txt
choco 2.2.2 with ninja v1.11.1

After the build and install stage completes, I first test binaryen-lit:

PS D:\binaryen> python3 out/bin/binaryen-lit -vv test/lit/parse-error.wast
-- Testing: 1 tests, 1 workers --
PASS: Binaryen lit tests :: parse-error.wast (1 of 1)

Testing Time: 0.48s
  Passed: 1

Looks good. Then I run the test:

PS D:\binaryen> python3 check.py --binaryen-bin=out/bin
...
********************
Failed Tests (1):
  Binaryen lit tests :: binary/dylink.test


Testing Time: 54.94s
  Passed: 461
  Failed:   1
Traceback (most recent call last):
  File "check.py", line 416, in <module>
    sys.exit(main())
  File "check.py", line 399, in main
    TEST_SUITES[test]()
  File "check.py", line 340, in run_lit
    shared.with_pass_debug(run)
  File "D:\binaryen\scripts\test\shared.py", line 509, in with_pass_debug
    check()
  File "check.py", line 338, in run
    raise Exception("lit test failed")
Exception: lit test failed

After checking through the error message, it seems like the cmp command line program does not exist under PowerShell 7. Therefore I use Cygwin64 terminal (with diffutils installed) to run the test again:

$ python3 check.py --binaryen-bin=out/bin
...
Testing Time: 117.43s
  Passed: 462
warning: gtest binary not found - skipping tests

[ success! ]

gtest binary not found - skipping tests

The test succeed on my local machine so I can't figure out the reason why it failed at CI process :( (Besides, I also don't know why CI / build (macos-latest) cancelled its building task)

mobsceneZ avatar Feb 12 '24 08:02 mobsceneZ

Hey Kripken, I made corresponding code changes according to your comment. For the CI issue, I finally found out it's still related to the static initialization problem and fixed it up. If there are any futher problems, please let me know.

mobsceneZ avatar Feb 14 '24 18:02 mobsceneZ

Hey @kripken, sorry to bother but any further suggestions?

mobsceneZ avatar Feb 16 '24 06:02 mobsceneZ