[vm/ffi] Call natives through stubs if write-protection is enabled without dual-mapping.

Addresses the Dart -> Native half of dartbug.com/37629

Change-Id: I242b7f3a14dd105334a8b6e5c089b173c398491e
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111280
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
Samir Jindel
2019-08-07 11:37:20 +00:00
committed by commit-bot@chromium.org
parent e323684f09
commit e59a4a2b42
28 changed files with 549 additions and 193 deletions
+11
View File
@@ -4,6 +4,8 @@
//
// VMOptions=--deterministic --optimization-counter-threshold=500 --enable-testing-pragmas
// VMOptions=--deterministic --optimization-counter-threshold=-1 --enable-testing-pragmas
// VMOptions=--deterministic --optimization-counter-threshold=500 --enable-testing-pragmas --no-dual-map-code --write-protect-code
// VMOptions=--deterministic --optimization-counter-threshold=-1 --enable-testing-pragmas --no-dual-map-code --write-protect-code
//
// Dart test program for stress-testing boxing and GC in return paths from FFI
// trampolines.
@@ -25,6 +27,7 @@ main() async {
testBoxPointer();
testAllocateInNative();
testRegress37069();
testWriteProtection();
}
typedef NativeNullaryOp64 = ffi.Int64 Function();
@@ -106,3 +109,11 @@ final regress37069 = ffiTestFunctions
void testRegress37069() {
regress37069(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
}
final unprotectCode = ffiTestFunctions
.lookupFunction<NativeNullaryOp32, NullaryOp>("UnprotectCode");
void testWriteProtection() {
int result = unprotectCode();
Expect.equals(result, 0);
}
+2
View File
@@ -7,6 +7,8 @@
// VMOptions=
// VMOptions=--deterministic --optimization-counter-threshold=10
// VMOptions=--use-slow-path
// VMOptions=--write-protect-code --no-dual-map-code
// VMOptions=--write-protect-code --no-dual-map-code --use-slow-path
// SharedObjects=ffi_test_functions
library FfiTest;