Skip to content

Instantly share code, notes, and snippets.

View mraleph's full-sized avatar
🐌

Slava Egorov mraleph

🐌
View GitHub Profile
diff --git a/SuperPi_flutter/lib/pi_calculator.dart b/SuperPi_flutter/lib/pi_calculator.dart
index 39faf59..b519f6a 100644
--- a/SuperPi_flutter/lib/pi_calculator.dart
+++ b/SuperPi_flutter/lib/pi_calculator.dart
@@ -30,7 +30,7 @@ class PiCalculator {
double yk1 ;
for (int i = 0; i < k; i++) {
yk1 = (1 - math.pow((1 - yk * yk * yk * yk),(0.25)))/(1 + math.pow((1 - yk * yk * yk * yk),(0.25)));
- ak1 = ak * math.pow((1 + yk1), 4) - math.pow(2, 2 * i + 3) * yk1 * (1 + yk1 + yk1 * yk1);
+ ak1 = ak * math.pow((1 + yk1), 4.0) - math.pow(2.0, (2 * i + 3) + 0.0) * yk1 * (1 + yk1 + yk1 * yk1);
#include <stdio.h> // for fprintf()
#include <fcntl.h>
#include <unistd.h> // for close(), read()
#include <sys/epoll.h> // for epoll_create1(), epoll_ctl(), struct epoll_event
#include <string.h> // for strncmp
#include <errno.h>
const int kMaxEvents = 5;
const int kReadSize = 5;
  1. Make a folder somewhere that will contain engine and framework checkouts. The rest of instructions assumes that $flt points to that folder.
  2. Into $flt/flutter get flutter by
    $ cd $flt
    $ git clone https://github.com/flutter/flutter
  3. Add $flt/flutter/bin to your path, run flutter doctor and fix issues if any are reported.
  4. Into $flt/engine get engine checkout following these instructions. Make sure to run dependency installation scripts as described there.
  5. In $flt/engine/src/third_party/dart switch to master and pull upto HEAD
Future<void> f() async {
print("f invoked");
await Future.value(10);
print("f continued");
}
Future<void> g() async {
print("g invoked");
await Future.value(10);
print("g continued");
diff --git a/runtime/tests/vm/dart/regress_33999_test.dart b/runtime/tests/vm/dart/regress_33999_test.dart
index 933d2e0bef..21c3930afd 100644
--- a/runtime/tests/vm/dart/regress_33999_test.dart
+++ b/runtime/tests/vm/dart/regress_33999_test.dart
@@ -8,12 +8,14 @@
// Class with two type parameters.
class A<U, T> {
- T field;
+ T field1;
@mraleph
mraleph / ffi.md
Last active November 11, 2023 14:44

Dart VM FFI Vision

Background

The aim of Dart FFI project (tracked as Issue #34452) is to provide a low boilerplate, low ceremony & low overhead way of interoperating with native C/C++ code.

The motivation behind this project is twofold:

function createSlowObject() {
let obj = {};
for (let i = 0; i < 100; i++) {
obj['f' + i] = i;
}
return obj;
}
diff --git a/third_party/gtest/BUILD.gn b/third_party/gtest/BUILD.gn
index db5f4a56..f47d0437 100644
--- a/third_party/gtest/BUILD.gn
+++ b/third_party/gtest/BUILD.gn
@@ -41,7 +41,7 @@ if (crashpad_is_in_chromium) {
"//third_party/googletest:gmock",
]
}
-} else if (crashpad_is_standalone) {
+} else if (crashpad_is_external || crashpad_is_standalone) {
  1. Make a folder somewhere that will contain engine and framework checkouts. The rest of instructions assumes that $flt points to that folder.
  2. Into $flt/flutter get flutter by
    $ cd $flt
    $ git clone https://github.com/flutter/flutter
  3. Add $flt/flutter/bin to your path, run flutter doctor and fix issues if any are reported.
  4. Into $flt/engine get engine checkout following these instructions. Make sure to run dependency installation scripts as described there.
  5. In $flt/engine/src/third_party/dart switch to master and pull upto HEAD

Background: How we handle mismatched closure invocations

Closures (unlike other methods) can be invoked with mismatched arguments, which then should result in Object.noSuchMethod invocation.

We implement it by tail-calling to the CallClosureNoSuchMethod stub if we discover an arity mismatch or a unmatched named argument. The stub gets original arguments and original argument descriptor and simply redirects to runtime function InvokeClosureNoSuchMethod which does all the heavy lifting related to