Commit Graph

72 Commits

Author SHA1 Message Date
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
Ryan Macnak b0f203db19 [vm-service] Include external sizes in the allocation table.
Bug: https://github.com/dart-lang/sdk/issues/30380
Change-Id: Ieec5adf13548b73bac886816d4a2174de7585880
Reviewed-on: https://dart-review.googlesource.com/7685
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Todd Turnidge <turnidge@google.com>
2017-09-25 18:33:07 +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
Ryan Macnak 9ce48e63b2 Remove background finalization.
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2809863002 .
2017-04-11 09:54:25 -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
Ryan Macnak 781fd36086 Add an option to gen_snapshot for creating a Makefile describing a snapshot's dependencies. This option may be used when generating any snapshot kind, or without generating a snapshot.
- Factor out MallocGrowableArray from vm to platform.
 - Add File::Print.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2715463003 .
2017-02-23 12:40:48 -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 259c7ac2be Resolution for issue #5092: Unit test handle checks consider dangling handles to be valid.
Updated the IS_VALID(handle) macro to also check if the handle is still in
scope or is a read-only handle.

BUG=
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2640573003 .
2017-01-20 15:50:15 -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
Zachary Anderson 103881d01c Make header include guards great again
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER

This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.

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

Review URL: https://codereview.chromium.org/2450713004 .
2016-10-26 00:26:03 -07:00
Ryan Macnak 103e316f6a Reapply "Background finalization."
- Fix double-finalization by marking handles that are in a finalization queue.
 - Remember external size in words instead of bytes.
 - Add SlowFinalizer test.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2084193003 .
2016-06-22 16:26:49 -07:00
Ryan Macnak ae94be3f4d Revert "Background finalization."
This reverts commit d265a3db53.

Review URL: https://codereview.chromium.org/2088923002 .
2016-06-21 13:15:12 -07:00
Ryan Macnak d265a3db53 Reapply "Background finalization."
This reverts commit 7d9e75e0b6.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2080353002 .
2016-06-21 09:27:23 -07:00
Ryan Macnak 7d9e75e0b6 Revert "Background finalization."
This reverts commit 082829a00b.

Review URL: https://codereview.chromium.org/2041373004 .
2016-06-07 17:21:06 -07:00
Ryan Macnak 082829a00b Background finalization.
Flutter gallery app on Nexus 4:
 max weak handle processing (main thread): 17.7ms -> 1.1ms
 max scavenge (main thread): 21.0ms -> 17.1ms

BUG=flutter/flutter#3804
R=asiva@google.com

Review URL: https://codereview.chromium.org/2012973002 .
2016-06-07 14:38:37 -07:00
John McCutchan b2249f30fd Add persistent handles to service protocol and Observatory UI
VM Changes:

- Add private _getPersistentHandles service RPC.
- Add service_test for _getPersistentHandles.

Observatory Changes:

- Add Persistent Handles page.
- Display persistent handles in a curly-block
- Display weak persistent handles in a sortable table.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1719313002 .
2016-03-01 07:31:29 -08: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
Ivan Posva 4f392df85e Fix some more shorten-64-to-32 warnings:
- Remove duplicate check for javascript integer overflow.
- Make sure the BitField class knows the type it is
  encoding into.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1644223006 .
2016-02-02 13:58:06 -08:00
Siva Annamalai 01b69ebabc Move ApiLocalScope out of class ApiState into class Thread so that the API local handles and zone etc. are thread specific instead of being Isolate specific.
R=zra@google.com

Review URL: https://codereview.chromium.org/1473403003 .
2015-11-25 11:07:22 -08:00
Siva Annamalai 4992bc72a0 Remove support for object grouping during Garbage Collection
- remove support for prolog weak persistent handles
- remove support for construction of weak reference sets

R=iposva@google.com

Review URL: https://codereview.chromium.org/1459173004 .
2015-11-20 12:36:16 -08:00
Daniel Andersson 700bd54362 Remove more uses of Isolate::current_zone.
The most substantial change is in Parser and ParsedFunction, which now cache their calling thread. (A similar change was tried unsuccessfully in the past, but can now be safely implemented thanks to the ThreadRegistry state saving.)

Only remaining users are the Object::Handle(Isolate*, [...]) methods. Then, this deprecated interface will be removed.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1242343002 .
2015-07-21 09:37:23 -07:00
Daniel Andersson 649719278a Assert no VM handles are created in the zone that belongs to a ApiNativeScope.
Update snapshot_test, which was violating this principle.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1191443008.
2015-06-22 17:19:01 -07:00
Daniel Andersson 9a5dc19140 Move allocation of static API handles Dart_True, etc.
Instead of an unbalanced local scope, allocate them alongside the corresponding static VM handles.

BUG=
R=iposva@google.com

Review URL: https://codereview.chromium.org//1186353004.
2015-06-17 12:46:32 -07:00
Siva Annamalai 7af681ead9 Fix for issue 23547, return an proper ApiError instead of a string when we report outstanding typed data acquire errors.
BUG=23547
R=koda@google.com

Review URL: https://codereview.chromium.org//1156993012
2015-05-29 11:13:33 -07:00
koda@google.com f3387ccc3f In this first version, we just track the set of objects and verify that calls to release match. The next step is to copy the data to a side buffer, which is then unmapped on release to catch use-after-release bugs.
Explicitly disallow nested acquires, since the visibility of writes would depend on whether data is acquired in-place.

Also explicitly disallow other access to the data (e.g., trough list accessors) for the same reason.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43575 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-06 22:31:46 +00:00
koda@google.com c7e9e048ed Rename Thread -> OSThread.
It's a collection of static utility methods for primitive operations on OS threads.

Make room in the namespace for upcoming class that will represent all the complex state of a VM thread.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42895 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-15 02:30:07 +00:00
iposva@google.com 14ecdbd66a - Separate the thread implementation used in bin/ and vm/
to allow us to make VM specific changes.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39172 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-12 23:19:53 +00:00
koda@google.com 2b2d188df7 Heap::AllocateExternal may trigger GC, so fix String::MakeExternal.
Note that this may happen even for size 0 (since we may be overdue for a GC).

Some unit tests still optimistically expect that GC will not trigger.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37414 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-17 19:41:13 +00:00
koda@google.com 9098859cb0 Refactor creation of FinalizablePersistentHandle into proper factory.
This exposes an issue (19482) with the API and external size tracking.

BUG=dart:19482
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37381 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-16 23:55:34 +00:00
asiva@google.com 54397efcc5 Minor cleanup.
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35512 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-29 00:32:22 +00:00
asiva@google.com 4eb6d5f7d8 Modify the Weak Reference Set creation API to make it easier to create
these sets in the GC Prologue code.

When this new API is not used in dartium:
  Without prolog callbacks in New  gen GC:
    dom-modify createElement runs-per-second 260.94890510948903
    dom-modify createTextNode runs-per-second 172.0

  With prolog callbacks in New  gen GC:
    dom-modify createElement runs-per-second 316.0
    dom-modify createTextNode runs-per-second 197.60479041916167


When this new API is used in dartium:
  Without prolog callbacks in New  gen GC:
    dom-modify createElement runs-per-second 310.0
    dom-modify createTextNode runs-per-second 174.4765702891326

  With prolog callbacks in New  gen GC:
    dom-modify createElement runs-per-second 416.0
    dom-modify createTextNode runs-per-second 241.75824175824175

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35215 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-21 18:31:15 +00:00
koda@google.com 718752bfe9 Simpler, more consistent triggering of old GC; also, use external in policy.
Consistently use PageSpace::NeedsGarbageCollection:
(a) After every scavenge, instead of tracking promotion failures.
(b) When creating weak handles with external allocations.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35174 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-18 18:23:35 +00:00
asiva@google.com a561e2bd17 1. Provide a framework to traverse persistent prolog weak handles.
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35066 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-15 16:32:55 +00:00
asiva@google.com 8c2df33d13 Use a bit in the handle structure to indicate if it is a prologue weak handle instead of the tagging the address.
R=koda@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34258 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-21 17:23:33 +00:00
asiva@google.com d302dc431a Auto delete persistent weak handles during finalization after invoking the callback associated with the weak handle.
R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34208 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-20 21:45:43 +00:00
koda@google.com 94b8e1b30a Fix external size accounting for prologue weak persistent handles.
Include prologue weak persistent handles (PWPH) when checking for promotion.

Since pointers have already been updated for PWPHs, use a bit in the handle to
remember whether the referent used to be in new space.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33552 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-11 20:27:44 +00:00
koda@google.com a69d028eb3 Track external allocated memory for weak persistent handles.
The amount of external allocation is tracked per generation
and informs GC policy.

BUG=dart:11471
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33467 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-07 23:53:32 +00:00
asiva@google.com e380b175f8 Pass in the isolate parameter to the weak persistent callback handler so that
there is no need to access the current isolate in the callback and delete
path (this code is run while a GC is in progress).

See https://codereview.chromium.org/185643003/ for corresponding changes
in dartium

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33282 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-04 18:11:19 +00:00
asiva@google.com 8e0129970c Use a tag bit for indicating prologue weak persistent handles, this avoids
the costly lookup to determine if a handle is a prologue weak persistent
handle or a regular weak persistent handle in Dart_DeleteWeakPersistentHandle

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33254 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-04 00:35:45 +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 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 364a9b28a9 - Adjust parameter types for Dart_NewWeakReferenceSet implementation.
Review URL: https://codereview.chromium.org//16247002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23436 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-30 18:52:06 +00:00
iposva@google.com b60d09b1fb - Add different types for persistent and weak persistent handles
in the Dart C API.
- Adapt code in the runtime.

R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23421 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-30 15:55:59 +00:00
vegorov@google.com ec1f97d4a2 Fix clang unused-private-field error.
../../runtime/vm/dart_api_state.h:736:18: error: private field 'key_' is not used [-Werror,-Wunused-private-field]
  ThreadLocalKey key_;
                   ^
R=scheglov@google.com
TEST=ninja -C out/Debug
Signed-off-by: Thiago Farina <tfarina@chromium.org>

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

Patch from Thiago Farina <tfarina@chromium.org>.

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21778 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-19 22:42:46 +00:00
regis@google.com 05e2ba9540 Support FrameLookup vm test on ARM, requiring among other things:
Maintain a separate top_exit_frame_info for simulated frames and use it to
verify that longjumps are safe.
Make sure unwinding of scopes works in the presence of a simulator.
Support inline allocation of objects.
Support checking of inline cache and instance calls.
Support subtype test cache.
Support (some) equality checks.
Support for (some) conditional branches.
Support for pool pointer setup in stubs.
Review URL: https://codereview.chromium.org//13502002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20890 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-03 20:17:14 +00:00
asiva@google.com 647d060f10 - The callback_error_ handle was never being setup.
- Remove some unnecessary DARTSCOPE calls when true/false/null Dart_Handles are
  created.
Review URL: https://codereview.chromium.org//13171004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20701 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-30 00:07:13 +00:00
asiva@google.com c64871d699 First set of changes towards cleaning up the bytearray access APIs
- Added unimplemented versions of Dart_ByteArrayAcquireData and
  Dart_ByteArrayReleaseData
- Added infrastructure to prevent callbacks into an API function that
  allocates a new object on the Dart heap or invokes dart code.
- Removed the old Dart_ByteArrayGet* access functions as it was felt that
  they have become redundant once we provide direct access to the internal
  data pointers.
- Removed DARTSCOPE_NOCHECKS as it seems to be redundant after the change
  to not create explicit stack zones on each Dart API call.
Review URL: https://codereview.chromium.org//12036098

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17958 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-31 23:56:48 +00:00
asiva@google.com f644dfc14e Fix for issue-7157 - set the stack marker in the top API local scope just before entering dart code. It used to be set in Dart_EnterScope and this was causing problems as the marker could potentially end up being lower than the stack pointer at the time of entering Dart code resulting in an destruction of the top scope during 'state->UnwindScopes(...)'
Review URL: https://codereview.chromium.org//12118002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@17939 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-31 19:16:47 +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
asiva@google.com 4c069867e4 - Make Boolean 'true' and 'false' singleton VM isolate objects.
- Change all uses of it
Review URL: https://codereview.chromium.org//11745022

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16623 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-04 01:52:05 +00:00