Skip to content
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

dart:ffi function_stress_test on Windows 64 #36138

Closed
dcharkes opened this issue Mar 7, 2019 · 12 comments
Closed

dart:ffi function_stress_test on Windows 64 #36138

dcharkes opened this issue Mar 7, 2019 · 12 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi

Comments

@dcharkes
Copy link
Contributor

dcharkes commented Mar 7, 2019

The way of capturing stderr on Linux/MacOS does not work on Windows.

DART_EXPORT intptr_t RedirectStderr() {
  char filename[256];
  snprintf(filename, sizeof(filename), "/tmp/captured_stderr_%d",
           platform_getpid());
  freopen(filename, "w", stderr);
  printf("Got file %s\n", filename);
  return platform_getpid();
}

Test failure:

python tools/test.py -n dartk-win-debug-x64 standalone_2/ffi/function_stress_test

[00:03 |  24% | +   10 | -    1]
FAILED: dartk-vm debug_x64 standalone_2/ffi/function_stress_test
Expected: Pass
Actual: RuntimeError

--- Command "vm" (took 03.000575s):
set DART_CONFIGURATION=DebugX64 & set DART_SUPPRESS_WER=1 & out\DebugX64\dart.exe --no-background-compilation --deterministic --optimization-counter-threshold=500 --verbose-gc --ignore-unrecognized-flags --packages=C:\src\dart-sdk\sdk\.packages C:\src\dart-sdk\sdk\tests\standalone_2\ffi\function_stress_test.dart

exit code:
255

stdout:
Starting...
Got file /tmp/captured_stderr_24060

stderr:
[              |                      |     |       |      | new gen     | new gen     | new gen | old gen       | old gen       | old gen     | sweep | safe- | roots/| stbuf/| tospc/| weaks/|               ]
[ GC isolate   | space (reason)       | GC# | start | time | used (kB)   | capacity kB | external| used (kB)     | capacity (kB) | external kB | thread| point |marking| reset | sweep |swplrge| data          ]
[              |                      |     |  (s)  | (ms) |before| after|before| after| b4 |aftr| before| after | before| after |before| after| (ms)  | (ms)  | (ms)  | (ms)  | (ms)  | (ms)  |               ]
[ kernel-servic,   Scavenge(new space),    1,   1.70,  47.8,  2048,  1772,  2048,  2048, 5503, 5499,  25360,  25360,  26012,  26012,     0,     0,   0.00,   0.00,   0.10,   0.08,   3.81,   0.02, 158, 0, 0, 183, ]
[ kernel-servic,   Scavenge(new space),    2,   1.76,  56.1,  2048,   245,  2048,  8192, 5499,   0,  25360,  27132,  26012,  27548,     0,  5499,   0.00,   0.00,   0.15,   0.09,  10.98,   0.01, 155, 0, 0, 0, ]
[              |                      |     |       |      | new gen     | new gen     | new gen | old gen       | old gen       | old gen     | sweep | safe- | roots/| stbuf/| tospc/| weaks/|               ]
[ GC isolate   | space (reason)       | GC# | start | time | used (kB)   | capacity kB | external| used (kB)     | capacity (kB) | external kB | thread| point |marking| reset | sweep |swplrge| data          ]
[              |                      |     |  (s)  | (ms) |before| after|before| after| b4 |aftr| before| after | before| after |before| after| (ms)  | (ms)  | (ms)  | (ms)  | (ms)  | (ms)  |               ]
[ vm-service   ,   Scavenge(     full),    1,   1.95,   4.3,   512,    40,  2048,  2048,   0,   0,   4835,   4835,   5264,   5264,     0,     0,   0.00,   0.00,   0.04,   0.11,   0.05,   0.01, 213, 0, 0, 34, ]
[ kernel-servic,   Scavenge(new space),    3,   1.90, 121.1,  8192,     0,  8192, 32768,   0,   0,  27132,  34773,  27548,  35016,  5499,  5499,   0.00,   0.00,   0.07,   2.37,  17.90,   0.01, 2246, 0, 0, 0, ]
[ vm-service   ,  MarkSweep(     full),    2,   1.96,  13.0,    40,    40,  2048,  2048,   0,   0,   4835,   3928,   5264,   4996,     0,     0,   0.00,   0.00,  10.13,   0.01,   0.22,   2.60, 36, 0, 15, 15, ]

--- Re-run this test:
python tools/test.py -n dartk-win-debug-x64 standalone_2/ffi/function_stress_test

@sjindel-google

@dcharkes dcharkes added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. labels Mar 7, 2019
@sjindel-google
Copy link
Contributor

First, there is no /tmp on Windows; second, freopen is a POSIX API. Maybe there is an equivalent on Windows?

@sjindel-google
Copy link
Contributor

Alternatively, we can add some instrumentation to the VM to extract the GC stats without the convoluted stderr-redirection and parsing.

@dcharkes
Copy link
Contributor Author

dcharkes commented Mar 11, 2019

After implementing stderr capture on Windows the following two failures appeared.

set DART_CONFIGURATION=DebugX64 & set DART_SUPPRESS_WER=1 & out\DebugX64\dart.exe --no-background-compilation --deterministic --optimization-counter-threshold=500 --verbose-gc --ignore-unrecognized-flags --packages=C:\src\dart-sdk\sdk\.packages C:\src\dart-sdk\sdk\tests\standalone_2\ffi\function_stress_test.dart

exit code:
3

stderr:
[              |                      |     |       |      | new gen     | new gen     | new gen | old gen       | old gen       | old gen     | sweep | safe- | roots/| stbuf/| tospc/| weaks/|               ]
[ GC isolate   | space (reason)       | GC# | start | time | used (kB)   | capacity kB | external| used (kB)     | capacity (kB) | external kB | thread| point |marking| reset | sweep |swplrge| data          ]
[              |                      |     |  (s)  | (ms) |before| after|before| after| b4 |aftr| before| after | before| after |before| after| (ms)  | (ms)  | (ms)  | (ms)  | (ms)  | (ms)  |               ]
[ kernel-servic,   Scavenge(new space),    1,   0.69,  17.8,  2048,  1772,  2048,  2048, 5503, 5499,  25427,  25427,  26020,  26020,     0,     0,   0.00,   0.00,   0.05,   0.05,   1.93,   0.01, 158, 0, 0, 183, ]
[ kernel-servic,   Scavenge(new space),    2,   0.72,  33.9,  2048,   245,  2048,  8192, 5499,   0,  25427,  27199,  26020,  27636,     0,  5499,   0.00,   0.00,   0.14,   0.06,   4.16,   0.01, 155, 0, 0, 0, ]
[              |                      |     |       |      | new gen     | new gen     | new gen | old gen       | old gen       | old gen     | sweep | safe- | roots/| stbuf/| tospc/| weaks/|               ]
[ GC isolate   | space (reason)       | GC# | start | time | used (kB)   | capacity kB | external| used (kB)     | capacity (kB) | external kB | thread| point |marking| reset | sweep |swplrge| data          ]
[              |                      |     |  (s)  | (ms) |before| after|before| after| b4 |aftr| before| after | before| after |before| after| (ms)  | (ms)  | (ms)  | (ms)  | (ms)  | (ms)  |               ]
[ vm-service   ,   Scavenge(     full),    1,   0.77,   3.1,   512,    40,  2048,  2048,   0,   0,   4835,   4835,   5264,   5264,     0,     0,   0.00,   0.00,   0.03,   0.09,   0.03,   0.01, 213, 0, 0, 34, ]
[ vm-service   ,  MarkSweep(     full),    2,   0.78,  11.9,    40,    40,  2048,  2048,   0,   0,   4835,   3928,   5264,   4996,     0,     0,   0.00,   0.00,   3.57,   0.00,   0.37,   7.95, 36, 0, 15, 15, ]
[ kernel-servic,   Scavenge(new space),    3,   0.79,  52.6,  8192,     0,  8192, 32768,   0,   0,  27199,  34840,  27636,  35052,  5499,  5499,   0.00,   0.00,   0.05,   1.65,  11.10,   0.01, 2246, 0, 0, 0, ]
c:\src\dart-sdk\sdk\runtime\vm\raw_object.h: 235: error: expected: IsWellFormed()
version=2.2.1-edge.407eb5a784c284a2e3656861d6bda0fcbcac1417 (Fri Mar 8 17:52:03 2019 +0100) on "windows_x64"
thread=16152, isolate=function_stress_test.dart:main()(0000000004E54210)
  [0x00000001405d9b2c] dart::Profiler::DumpStackTrace
  [0x00000001405d9b2c] dart::Profiler::DumpStackTrace
  [0x000000000e46e9e8] Unknown symbol
-- End of DumpStackTrace

--- Re-run this test:
python tools/test.py -n dartk-win-debug-x64 standalone_2/ffi/function_stress_test

This issue is already tracked in #36098. (update: see discussion below)

set DART_CONFIGURATION=DebugX64 & set DART_SUPPRESS_WER=1 & out\DebugX64\dart.exe --no-background-compilation --deterministic --optimization-counter-threshold=-1 --verbose-gc --ignore-unrecognized-flags --packages=C:\src\dart-sdk\sdk\.packages C:\src\dart-sdk\sdk\tests\standalone_2\ffi\function_stress_test.dart

exit code:
255

stdout:
Expect 2 > 1.
Expect 6 > 5.

stderr:
[              |                      |     |       |      | new gen     | new gen     | new gen | old gen       | old gen       | old gen     | sweep | safe- | roots/| stbuf/| tospc/| weaks/|               ]
[ GC isolate   | space (reason)       | GC# | start | time | used (kB)   | capacity kB | external| used (kB)     | capacity (kB) | external kB | thread| point |marking| reset | sweep |swplrge| data          ]
[              |                      |     |  (s)  | (ms) |before| after|before| after| b4 |aftr| before| after | before| after |before| after| (ms)  | (ms)  | (ms)  | (ms)  | (ms)  | (ms)  |               ]
[ kernel-servic,   Scavenge(new space),    1,   0.73,  18.6,  2048,  1778,  2048,  2048, 5503, 5499,  25394,  25394,  25764,  25764,     0,     0,   0.00,   0.00,   0.05,   0.05,   1.95,   0.01, 158, 0, 0, 183, ]
[ kernel-servic,   Scavenge(new space),    2,   0.75,  24.9,  2048,   240,  2048,  8192, 5499,   0,  25394,  27171,  25764,  27556,     0,  5499,   0.00,   0.00,   0.14,   0.07,   4.12,   0.01, 155, 0, 0, 0, ]
[              |                      |     |       |      | new gen     | new gen     | new gen | old gen       | old gen       | old gen     | sweep | safe- | roots/| stbuf/| tospc/| weaks/|               ]
[ GC isolate   | space (reason)       | GC# | start | time | used (kB)   | capacity kB | external| used (kB)     | capacity (kB) | external kB | thread| point |marking| reset | sweep |swplrge| data          ]
[              |                      |     |  (s)  | (ms) |before| after|before| after| b4 |aftr| before| after | before| after |before| after| (ms)  | (ms)  | (ms)  | (ms)  | (ms)  | (ms)  |               ]
[ vm-service   ,   Scavenge(     full),    1,   0.82,   3.2,   512,    41,  2048,  2048,   0,   0,   4844,   4844,   5264,   5264,     0,     0,   0.00,   0.00,   0.04,   0.08,   0.03,   0.01, 214, 0, 0, 35, ]
[ vm-service   ,  MarkSweep(     full),    2,   0.82,   6.5,    41,    41,  2048,  2048,   0,   0,   4844,   3939,   5264,   4996,     0,     0,   0.00,   0.00,   3.98,   0.00,   0.21,   2.27, 36, 0, 15, 15, ]
[ kernel-servic,   Scavenge(new space),    3,   0.82,  52.6,  8192,     0,  8192, 32768,   0,   0,  27171,  34807,  27556,  35184,  5499,  5499,   0.00,   0.00,   0.05,   1.61,  11.71,   0.01, 2246, 0, 0, 0, ]
[              |                      |     |       |      | new gen     | new gen     | new gen | old gen       | old gen       | old gen     | sweep | safe- | roots/| stbuf/| tospc/| weaks/|               ]
[ GC isolate   | space (reason)       | GC# | start | time | used (kB)   | capacity kB | external| used (kB)     | capacity (kB) | external kB | thread| point |marking| reset | sweep |swplrge| data          ]
[              |                      |     |  (s)  | (ms) |before| after|before| after| b4 |aftr| before| after | before| after |before| after| (ms)  | (ms)  | (ms)  | (ms)  | (ms)  | (ms)  |               ]
[ function_stre,   Scavenge(new space),    1,   1.08,   5.6,  2048,    37,  2048,  2048,   0,   0,   4586,   4586,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.07,   0.03,   0.01, 221, 0, 0, 32, ]
[ function_stre,   Scavenge(new space),    2,   1.14,   3.0,  2048,     0,  2048,  2048,   0,   0,   4586,   4623,   5008,   5008,     0,     0,   0.00,   0.00,   0.04,   0.07,   0.03,   0.01, 219, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),    3,   1.20,   2.8,  2048,     0,  2048,  2048,   0,   0,   4623,   4623,   5008,   5008,     0,     0,   0.00,   0.00,   0.03,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),    4,   1.27,   2.8,  2048,     0,  2048,  2048,   0,   0,   4623,   4623,   5008,   5008,     0,     0,   0.00,   0.00,   0.03,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),    5,   1.33,   2.8,  2048,     0,  2048,  2048,   0,   0,   4623,   4623,   5008,   5008,     0,     0,   0.00,   0.00,   0.03,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),    6,   1.39,   2.9,  2048,     0,  2048,  2048,   0,   0,   4623,   4623,   5008,   5008,     0,     0,   0.00,   0.00,   0.03,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),    7,   1.45,   2.8,  2048,     0,  2048,  2048,   0,   0,   4623,   4623,   5008,   5008,     0,     0,   0.00,   0.00,   0.03,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),    8,   1.59,   2.8,  2048,     2,  2048,  2048,   0,   0,   4690,   4690,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.00, 9, 0, 0, 2, ]
[ function_stre,   Scavenge(new space),    9,   1.60,   2.8,  2048,     0,  2048,  2048,   0,   0,   4691,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.03,   0.01,   0.04,   0.01, 7, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   10,   1.60,   2.7,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.00, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   11,   1.61,   2.7,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.00, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   12,   1.63,   5.7,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.03,   0.02,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   13,   1.64,   2.8,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.01,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   14,   1.65,   2.7,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.00, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   15,   1.66,   2.8,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   16,   1.67,   2.7,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   17,   1.68,   2.8,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   18,   1.68,   2.7,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   19,   1.69,   2.8,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   20,   1.70,   2.8,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   21,   1.71,   2.7,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   22,   1.72,   2.7,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   23,   1.73,   2.7,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   24,   1.74,   2.7,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   25,   1.75,   2.7,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   26,   1.76,   2.7,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.00, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   27,   1.76,   2.7,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   28,   1.77,   2.7,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   29,   1.78,   2.7,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
[ function_stre,   Scavenge(new space),   30,   1.79,   2.8,  2048,     0,  2048,  2048,   0,   0,   4693,   4693,   5008,   5008,     0,     0,   0.00,   0.00,   0.02,   0.01,   0.00,   0.01, 0, 0, 0, 0, ]
Unhandled exception:
Expect.equals(expected: <-2147483648>, actual: <2147483648>) fails.
#0      Expect._fail (package:expect/expect.dart:655:5)
#1      Expect.equals (package:expect/expect.dart:126:5)
#2      testBoxPointer (file:///C:/src/dart-sdk/sdk/tests/standalone_2/ffi/function_stress_test.dart:85:10)
#3      test (file:///C:/src/dart-sdk/sdk/tests/standalone_2/ffi/function_stress_test.dart:22:11)
<asynchronous suspension>
#4      main (file:///C:/src/dart-sdk/sdk/tests/standalone_2/ffi/function_stress_test.dart:43:11)
<asynchronous suspension>
#5      _startIsolate.<anonymous closure> (dart:isolate/runtime/lib/isolate_patch.dart:300:19)
#6      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/lib/isolate_patch.dart:171:12)

--- Re-run this test:
python tools/test.py -n dartk-win-debug-x64 standalone_2/ffi/function_stress_test

Which shows that the integer is not correctly sign extended. Already tracked in #36122. (Note that this only shows up with GCWatcher.dummy() otherwise stderr is captured and not displayed.)

@sjindel-google
Copy link
Contributor

How is the first crash related to #36098? The failing assertion is "IsWellFormed()', not "UNREACHABLE()".

@dcharkes
Copy link
Contributor Author

You are right, I missed that.

I've seen the IsWellFormed() before locally on linux or macos, but I've not been able to reliably reproduce it.

@sjindel-google have you ever seen it in the code in which you ported the stubs to IL?

@sjindel-google
Copy link
Contributor

I have not seen it in my CL, but it could be caused by #36155 or #36125.

@dcharkes
Copy link
Contributor Author

dcharkes commented Mar 12, 2019

 	[Inline Frame] dart.exe!dart::RawObject::IsSmiOrOldObject() Line 236	C++
 	[Inline Frame] dart.exe!dart::ScavengerVisitor::ScavengePointer(dart::RawObject * *) Line 122	C++
 	dart.exe!dart::ScavengerVisitor::VisitPointers(dart::RawObject * * first, dart::RawObject * * last) Line 86	C++
>	dart.exe!dart::StackFrame::VisitObjectPointers(dart::ObjectPointerVisitor * visitor) Line 401	C++
 	dart.exe!dart::Thread::VisitObjectPointers(dart::ObjectPointerVisitor * visitor, dart::ValidationPolicy validation_policy) Line 705	C++
 	dart.exe!dart::ThreadRegistry::VisitObjectPointers(dart::ObjectPointerVisitor * visitor, dart::ValidationPolicy validate_frames) Line 73	C++
 	[Inline Frame] dart.exe!dart::Scavenger::IterateRoots(dart::Isolate *) Line 600	C++
 	dart.exe!dart::Scavenger::Scavenge() Line 1005	C++
 	dart.exe!dart::Heap::CollectNewSpaceGarbage(dart::Thread * thread, dart::Heap::GCReason reason) Line 464	C++
 	[Inline Frame] dart.exe!dart::Heap::CollectGarbage(dart::Heap::Space) Line 524	C++
 	dart.exe!dart::Heap::AllocateNew(__int64 size) Line 117	C++
 	dart.exe!dart::Object::Allocate(__int64 cls_id, __int64 size, dart::Heap::Space space) Line 2098	C++
 	dart.exe!dart::Instance::New(const dart::Class & cls, dart::Heap::Space space) Line 16358	C++
 	dart.exe!dart::DRT_HelperAllocateObject(dart::Isolate * isolate, dart::Thread * thread, dart::Zone * zone, dart::NativeArguments arguments) Line 296	C++
 	dart.exe!dart::DRT_AllocateObject(dart::NativeArguments arguments) Line 294	C++
 	[External Code]	

The stack frame that has a dangling pointer is the FFI trampoline stack frame.

this->ToCString()
0x000000000ac1d4d8 "[dart     : sp(0xac1ea20) fp(0xac1ea50) pc(0xb40449e) dart:ffi_::_FfiTrampoline ]"

The FFI stack frame is regarded as a normal frame if an allocation stub is called in it, and thus it is scanned. This should be fixed with the IL CL (update: yes it is fixed in the IL CL).

dart-bot pushed a commit that referenced this issue Mar 12, 2019
Enables dart:ffi on Windows 64 bit.

Note that function_stress_test.dart fails in two different ways, these are known bugs. #36138

Closes: #35771
Change-Id: I73012123f2bd90b737fdc1c87c9a9630c20d5660
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95647
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
dart-bot pushed a commit that referenced this issue Mar 12, 2019
This reverts commit 7f812de.

Reason for revert: Flutter build is broken on Golem.

Original change's description:
> [vm/ffi] Support Windows 64 bit
> 
> Enables dart:ffi on Windows 64 bit.
> 
> Note that function_stress_test.dart fails in two different ways, these are known bugs. #36138
> 
> Closes: #35771
> Change-Id: I73012123f2bd90b737fdc1c87c9a9630c20d5660
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95647
> Commit-Queue: Daco Harkes <dacoharkes@google.com>
> Reviewed-by: Samir Jindel <sjindel@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,sjindel@google.com,dacoharkes@google.com

Change-Id: I5be4538e3c99632a852e4dfb856248eb437fb3ea
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96683
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
dart-bot pushed a commit that referenced this issue Mar 13, 2019
Enables dart:ffi on Windows 64 bit.

Note that function_stress_test.dart fails in two different ways, these are known bugs. #36138

Relanding: Fixed compilation on Android.

Closes: #35771
Change-Id: I7d0c8b64ca8c1726b7d264d4fd9213299a9f7df6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96781
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
@sjindel-google
Copy link
Contributor

With stubs in IL, I'm getting:

Unhandled exception:
Expect.equals(expected: <-2147483648>, actual: <2147483648>) fails.
#0      Expect._fail (package:expect/expect.dart:655:5)
#1      Expect.equals (package:expect/expect.dart:126:5)
#2      testBoxSmallPointer (file:///C:/b/s/w/ir/cache/builder/sdk/tests/standalone_2/ffi/function_stress_test.dart:94:10)
#3      test (file:///C:/b/s/w/ir/cache/builder/sdk/tests/standalone_2/ffi/function_stress_test.dart:23:11)
<asynchronous suspension>
#4      main (file:///C:/b/s/w/ir/cache/builder/sdk/tests/standalone_2/ffi/function_stress_test.dart:44:11)
<asynchronous suspension>
#5      _startIsolate.<anonymous closure> (dart:isolate/runtime/lib/isolate_patch.dart:300:19)
#6      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/lib/isolate_patch.dart:171:12)

@dcharkes
Copy link
Contributor Author

Same issue as I mentioned last week. Looks like 0x80000000 is not sign extended into 0xFFFFFFFF80000000. You already filed an issue for that: #36122.

@sjindel-google
Copy link
Contributor

sjindel-google commented Mar 15, 2019

The FFI trampoline is not supposed to sign-extend it here. The return value is 64-bits already.

@dcharkes
Copy link
Contributor Author

I see, but it does work correctly on Linux?

@sjindel-google
Copy link
Contributor

sjindel-google commented Mar 15, 2019

Yes, it does; the status file enables it on Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi
Projects
None yet
Development

No branches or pull requests

3 participants