Commit graph

47 commits

Author SHA1 Message Date
Liam Appelbe 6e1f628f19 Outline the StackZone's Zone
Bug: https://github.com/dart-lang/sdk/issues/36100
Change-Id: I17cdf438c19fcc66ceb09c23348654eb752dd3cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103560
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-05-23 19:10:46 +00:00
Ryan Macnak 58c6d78712 [vm] Check Zones are only [un]chained on the correct side of a safepoint transition.
Fix order in Dart_CreateIsolate and some tests.

Change-Id: Iceb748be3f7aa6b68ce7abb7f65a3c54ad63c1d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100795
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-05-01 00:36:14 +00:00
Ryan Macnak 347b72c260 [vm] Bypass malloc for large Zone allocations to avoid jemalloc leaks.
Revert 9a07ad88f4.

Bug: https://github.com/flutter/flutter/issues/29007
Change-Id: I6a5f51f0c3a54d354ec5f8495677d46f94d8a1d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100568
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2019-04-30 16:17:18 +00:00
Vyacheslav Egorov a9ce969e53 [vm] Decouple growable_array.h and zone.h from thread.h
- Introduce a slimmed down version of thread.h, which just depends on the
Zone and StackResource.
- Introduce a layering check that would prevent the coupling in the future.

This is the first step towards decoupling compiler from runtime.

There are multiple reasons to introduce the decoupling but the main
reason currently is to introduce a controlled surface through which
compiler reaches into runtime to catch any places where runtime word size
might influence the compiler and then enable building compiler that
targets 32-bit runtime but is embedded into a 64-bit runtime.

Issue https://github.com/dart-lang/sdk/issues/31709

Change-Id: Id63ebbaddca55dd097298e51c90d957a73fa476e
Reviewed-on: https://dart-review.googlesource.com/c/87182
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-01-11 20:47:10 +00:00
Ryan Macnak 8da46d35f5 [vm] Move heap-related code to its own subdirectory (cf. compiler).
Remove some dead includes.

Change-Id: I31f3e739e5ee46dcbba5d6a2f091491b46402943
Reviewed-on: https://dart-review.googlesource.com/60146
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-06-20 00:39:49 +00:00
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Ben Konyi c0511ad2ef Reimplemented zone memory tracking to avoid race conditions that were causing crashes in the previous implementation and made some minor name changes.
BUG=
R=asiva@google.com, johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2762323002 .
2017-03-23 09:03:08 -07:00
Ben Konyi f31c653b54 Added comments explaining why some code is not used / returns empty results as a result of issue #28885
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2733613002 .
2017-03-03 12:23:40 -08:00
Ben Konyi 171a27b79c Fixed issue where initial 1KB zone buffer was not being accounted for when tracking thread zone memory usage.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2651273004 .
2017-01-31 14:32:26 -08:00
Ben Konyi 1e0bf05aaf Added tracking of memory usage within ApiNativeScopes. Usage to be displayed within Observatory.
BUG=
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2650583014 .
2017-01-26 15:24:03 -08:00
Ben Konyi 4024151adb Added isolate + thread high watermark tracking to Observatory
This is a fixed version of c84f30741c90d040254767ff769a40d2cba3fb1a that
resolves issues with comparing uint and intptr_t.

Original Commit Message:
Added tracking of memory usage inside of threads. In addition, the max memory usage is kept track of using a high watermark for both the threads and the isolates. Isolate high watermark information is updated when a thread exits the isolate. The isolate high watermark consists of the sum of all thread high watermarks (including the high watermark of the exiting thread). High watermark information for both threads and isolates is now visible in the isolate view in the Observatory.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2610253002 .
2017-01-05 14:24:53 -08:00
Ben Konyi ffda801791 Revert "Added isolate + thread high watermark tracking to Observatory"
This reverts commit c84f30741c90d040254767ff769a40d2cba3fb1a.

TBR=johnmccutchan@google.com

BUG=

Review-Url: https://codereview.chromium.org/2617513004 .
2017-01-04 15:21:35 -08:00
Ben Konyi b3c55f972f Added isolate + thread high watermark tracking to Observatory
Added tracking of memory usage inside of threads. In addition, the max memory usage is kept track of using a high watermark for both the threads and the isolates. Isolate high watermark information is updated when a thread exits the isolate. The isolate high watermark consists of the sum of all thread high watermarks (including the high watermark of the exiting thread). High watermark information for both threads and isolates is now visible in the isolate view in the Observatory.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2609253002 .
2017-01-04 15:08:02 -08:00
Ben Konyi e28b3e3c60 Revert "Added isolate + thread high watermark tracking to Observatory"
This reverts commit 0a1a534fd9.

BUG=
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2605933003 .
2016-12-28 16:49:47 -08:00
Ben Konyi 0a1a534fd9 Added isolate + thread high watermark tracking to Observatory
Added tracking of memory usage inside of threads. In addition, the max memory usage is kept track of using a high watermark for both the threads and the isolates. Isolate high watermark information is updated when a thread exits the isolate. The isolate high watermark consists of the sum of all thread high watermarks (including the high watermark of the exiting thread). High watermark information for both threads and isolates is now visible in the isolate view in the Observatory.

BUG=
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2608463002 .
2016-12-28 14:59:22 -08:00
Ben Konyi a3ec04eb99 Fixed bad calculations for determining total allocated size of a zone.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2570763002 .
2016-12-12 17:48:59 -08:00
Ben Konyi 35a49bc1ff Created methods to surface zone memory information for each isolate and thread in JSON.
BUG=
R=asiva@google.com, johnmccutchan@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2554983002 .
2016-12-12 09:56:49 -08:00
Zachary Anderson a1bcf051d8 clang-format runtime/vm
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
Ryan Macnak 61bf8abd75 Make fatal out of memory messages uniform.
Add checks in a few more places with large allocations.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2418323002 .
2016-10-19 16:37:59 -07:00
Ryan Macnak 326af5e9d7 Move Zone's destructor out of a header file.
This unburdens users of StackZone from needing to include handles_impl.h. A new use of StackZone was recently added to heap.cc without a include of handles_impl.h, and this caused link-time errors on some versions of gcc.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2362573002 .
2016-09-22 13:16:36 -07:00
Ryan Macnak ba3b85f626 Improve error message when zone allocation fails.
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2245063004 .
2016-08-16 18:00:04 -07:00
Todd Turnidge a7d46eb5a6 Canonicalize uris in C++ instead of Dart for the standalone embedder.
Adds Dart_DefaultCanonicalizeUrl() to the dart embedding api.

Motivation:

As we try to get source reloading working for the standalone embedder, things get simpler if an isolate doesn't run Dart code while it is loading Dart code.  We intend to solve this by moving the embedder tag handler calls to the service isolate.  But making a blocking rpc into the service isolate whenever a url needs to be canonicalized during parsing seems like it would slow things down and make things complicated.  By moving canonicalization into C++, we avoid this.

R=ahe@google.com, fschneider@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2011543002 .
2016-06-02 12:29:57 -07:00
Ivan Posva 9c0c6cb5c2 Add product mode:
- Add PRODUCT define and build mode to gyp configurations.
- Add product mode to test harness.
- Start to unify list of flags.
- Allow flags to be constant for particular build configurations.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/1663863002 .
2016-02-03 21:10:30 -08:00
Srdjan Mitrovic caedcce440 Cleanups
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org/1411403002 .
2015-10-19 14:13:27 -07:00
John McCutchan 03b41129a2 Add Timeline to dart:developer
- This CL only adds support for synchronous blocks of time. A follow up CL will add asynchronous blocks of time.
- Reports true thread id to tracing system. This is an improvement over Mojo's tracing helper.
- Dart events are included in individual isolate traces and global traces obtained via the embedders API.
- Dart events are included in the write to disk path (--timeline_dir).

R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1377663002 .
2015-10-01 09:30:47 -07:00
Zachary Anderson 16393ee9c6 Uses SNPRINT macro where possible. Otherwise uses #define for format.
I was able to convert 49 SNPrint(NULL, 0, ...) patterns to use the
macro. I had to use a #define for the format string 5 times due to
uses that didn't fit the macro.

2 occurences of SNPrint(NULL, 0, ...) had >=2 possibilities for the
format string based on runtime values, and I didn't try to convert
them.

Fixed ~10 format strings.

BUG=
R=iposva@google.com

Review URL: https://codereview.chromium.org//1331623002 .
2015-09-11 00:18:14 -07:00
John McCutchan 4511599443 Start TimelineAnalysis utility
- Add TimelineEventBlockIterator - iterate over TimelineEventBlocks.
- Add TimelineAnalysisThread - All events for a specific thread.
- Add TimelineAnalysis - Utility for analyzing timeline events.
- Add unit test for TimelineAnalysis thread discovery and block sorting.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1284263002 .
2015-08-12 13:31:31 -07:00
Daniel Andersson 7f890eeecf Support per-thread zones and stack resources.
This is needed to enable parallel marking/sweeping (and in the future, compilation) tasks to have their own zone allocations and to safely call code that relies on various scoped constructs (stack resources).

The next step is to migrate the scopes like NoSafepointScope, NoHandleScope, etc. from isolate- to thread-based interfaces.

NOTE: This is a copy of issue 1204303003.

BUG=

Review URL: https://codereview.chromium.org//1226403003 .
2015-07-09 11:22:26 -07:00
koda@google.com 5d9e207c44 Double-align Zone allocations to fix MIPS issue.
Also ensure initial buffer is aligned.

~2% increase in total allocated zone memory on compile-heavy benchmarks.
No significant impact on speed for either ia32 or arm.

R=iposva@google.com

Review URL: https://codereview.chromium.org//832713006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42797 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-13 01:56:30 +00:00
asiva@google.com 928894a58c - Added Dart_GetNativeIsolateData so that the bindings code can access the IsolateCurrentData
where possible without having to invoke Isolate::Current()
- Modified lookupWrapper to accept DartDOMData as a parameter so that the return to Dart functions
  won't invoke Isolate::Current()

Some Dromaeo numbers before this change:
CONSOLE MESSAGE: RESULT: Dromaeo-drt dartium-dart dom-attr getAttribute runs-per-second 1162.2
CONSOLE MESSAGE: RESULT: Dromaeo-drt dartium-dart dom-attr element_property_access runs-per-second 1255.6

after this change:
CONSOLE MESSAGE: RESULT: Dromaeo-drt dartium-dart dom-attr getAttribute runs-per-second 1237.6
CONSOLE MESSAGE: RESULT: Dromaeo-drt dartium-dart dom-attr element_property_access runs-per-second 1385.4

R=rmacnak@google.com, vsm@google.com

Review URL: https://codereview.chromium.org//24376005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27789 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-23 23:53:39 +00:00
jacobr@google.com 605b33c1bc fix cpp11 compile errors
R=asiva@google.com

Review URL: https://codereview.chromium.org//23072026

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26387 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-20 20:24:11 +00:00
asiva@google.com ed73754c3f Rearrange some methods so that they get inlined.
R=srdjan@google.com

Review URL: https://codereview.chromium.org//22307003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25843 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-06 22:58:53 +00:00
asiva@google.com 9e7f76623a Reuse the top ApiLocalScope so that we do not allocate and free an ApiLocalScope
for each Dart_EnterScope/Dart_ExitScope sequence.

The runtime of UseDartApi benchmark on linux ia32 improves from
187316 to 121083.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//19974002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25292 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-22 18:46:14 +00:00
iposva@google.com 6c4ac09cb9 - Remove heap tracing.
Review URL: https://codereview.chromium.org//14179015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21844 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-22 21:43:57 +00:00
asiva@google.com a02f310d91 Added code to trace zone and handles creation/deletion under flags
--trace-zone and trace-handles
Review URL: https://codereview.chromium.org//11879005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17001 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-12 00:33:16 +00:00
cshapiro@google.com 49f6f9f36d Merge the Merlin heap tracing to top-of-trunk.
Review URL: https://codereview.chromium.org//11428067

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16199 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-15 19:58:45 +00:00
tball@google.com 2cd8436c5a Changed StackZone and ApiZone to be containers for Zone.
BUG=

Review URL: https://codereview.chromium.org//11028145

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13707 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-16 22:05:40 +00:00
tball@google.com 76d7c9b105 Renamed Zone->StackZone, BaseZone->Zone, in preparation for changing isolate->get_zone() to return what was called the BaseZone instead of its wrapper. The GetBaseZone() methods were not renamed, to help the next CL.
BUG=

Review URL: https://codereview.chromium.org//11040062

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13314 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-05 19:52:55 +00:00
cshapiro@google.com da14bf70a7 Add attributions so printf like functions can have their arguments checked.
This change also corrects some misuses of format strings and format
arguments that discovered by the compiler checks.

Review URL: https://chromiumcodereview.appspot.com//10869063

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11912 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-06 00:58:25 +00:00
turnidge@google.com 2803d78dfd Change the zone allocation api.
Instead of passing a size in bytes to the allocation function, we now
have a templatized Alloc function:

  zone->Alloc<Type>(len)

This is better for security, as we can check for integer overflow in
the size computation before performing the allocation.  Before, we
often failed to check this.
Review URL: https://chromiumcodereview.appspot.com//10836061

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10254 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-03 21:51:44 +00:00
turnidge@google.com 5f30febb45 Inline the StackResource constructor/destructor.
This yields a 29% improvement on the Benchmark_UseDartApi microbenchmark.

To do this, I had to split a few fields from Isolate into a
BaseIsolate class.  Sort of yucky.
Review URL: https://chromiumcodereview.appspot.com//10008030

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6288 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-06 18:00:51 +00:00
turnidge@google.com e61a02c10d Implement spawnFunction from the new isolate api.
Still need to implement spawnUri, which will be the more difficult one.
Review URL: https://chromiumcodereview.appspot.com//9691005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5441 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 22:05:08 +00:00
sgjesse@google.com 65896148c9 Move utils.h and utils.cc from runtime/vm to runtime/platform
Moved additional parts of globals.h from vm/ to platform/ to support
types and constants used by utils.*.

R=ager@google.com, iposva@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//9209001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3337 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-16 13:23:40 +00:00
sgjesse@google.com bf67f24098 Move assert.h/assert.cc from runtime/vm to runtime/platform
The purpose of this change is twofold:

1. Source in the bin directory can now use the same assertions as
   source in the vm directory. The ASSERT macro used by the code
   in runtime/bin was just defined to use assert from the standard
   C library.
2. Moving other implementation parts from runtime/vm to
   runtime/platform (e.g. classes Monitor and Mutex) for sharing
   between runtime/bin and runtime/vm will be easier as these
   implementations rely on these assertion macros.

Created two gypi files for the platform directory. One for the
headers and one for the source. The source one is only included
when building the VM library and will be present in libdart.a
when the dart executable is linked.

All the code for asserts is still in the dart namespace.

Also re-arranged the order of includes to be alphabetically in
the files touched.

R=ager@google.com, iposva@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//9189003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3335 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-16 12:28:10 +00:00
asiva@google.com 5cf3ad018a Changes to pass the current isolate to all runtime and native calls.
Review URL: http://codereview.chromium.org//8528010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1499 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-12 05:55:22 +00:00
asiva@google.com 2d388b751f Cache isolate in the StackTrace object to that we don't call
Isolate::Current in the destructor, HandleScope and Zone.
TBR=iposva (already reviewed change on other client).
Review URL: http://codereview.chromium.org//8523013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1427 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-10 21:08:18 +00:00
dgrove@google.com 4c0f559d23 Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:20:07 +00:00