aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/memory
Commit message (Collapse)AuthorAgeFilesLines
* Don't include qv4enginebase_p.h in qmldevtoolsUlf Hermann2019-05-102-1/+2
| | | | | | | | We don't need it and we don't need to check for V4_BOOTSTRAP in there. Shuffle some includes around to provide everything we do need. Change-Id: I3e75f1c6f9dc518006aabc9dcee21e5153899ac5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-03-292-54/+45
|\ | | | | | | Change-Id: I9ba374f0c652628b7c84c36893c32b22529e384f
| * Trigger the garbage collector when allocating InternalClass objectsUlf Hermann2019-03-262-54/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As we check the icAllocator's slots on shouldRunGC() we should also check shouldRunGC() when adding slots. Otherwise we might never run the GC when only allocating InternalClasses. In addition, account for the "unmanaged" size of the PropertyAttributes that are part of the InternalClass objects. Those can be large. In cases where an excessive number of large InternalClass objects is created the garbage collector is now invoked frequently, which costs a significant number of CPU cycles, but prevents the memory usage from growing indefinitely. Task-number: QTBUG-58559 Change-Id: Icf102cb6100f6dba212b8bffe1c178897880eda0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Fix logging output for GCUlf Hermann2019-03-271-9/+14
|/ | | | | | | | It failed to consider the IC allocator when calculating various sizes. Task-number: QTBUG-74190 Change-Id: Id34c31d639896eed8422790b4adc56c989402807 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* V4: Fix failing assert on all 32bit platformsErik Verbruggen2019-02-141-1/+1
| | | | | | | | | | The failing assert is in qv4mm.cpp:170, which is correct. The failure stemms from the fact that on 32bit platforms, quint64 does not have the same size as quintptr. Who would have thought? Fixes: QTBUG-73821 Change-Id: I9abe6bc9e2bfcdb6700ab7997c078076a9883cf2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* MemoryManager: Only clear weak values onceUlf Hermann2019-01-231-2/+0
| | | | | | | | | | | | We want to keep the weak values alive while the destruction callbacks are running, so that they can still access them. We set them to undefined later anyway because we expect the destruction callbacks to mess with the values. Therefore there is no point in also setting them in between. Fixes: QTBUG-72137 Change-Id: I83f70230f5b4ad2761c74770f975b14a5ca71f18 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix a crash when allocating huge memory segmentsLars Knoll2018-11-021-3/+2
| | | | | | | | | | When allocating a huge item that requires it's own memory segment, we were actually not committing enough memory from the OS. Fixes: QTBUG-71501 Change-Id: Ic86a648bba4d7f1eeeded78d8de0f0fc1d3a251d Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Cleanups in Value/PrimitiveLars Knoll2018-09-171-2/+2
| | | | | | | | | | | | Get rid of Primitive and move the corresponding methods directly into Value. Mark many methods in Value as constexpr and turn Value into a POD type again. Keep Primitive as a pure alias to Value for source compatibility of other modules that might be using it. Change-Id: Icb47458947dd3482c8852e95782123ea4346f5ec Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Don't let GC runs be dominated by internal classesLars Knoll2018-09-141-2/+2
| | | | | Change-Id: Icdd0f303f06605e8fdf2f1b324274ad95bfdebf3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for WeakSetLars Knoll2018-08-282-0/+20
| | | | | Change-Id: I5cee2bf0c6a45ad2c14b52e1a4fc5ef015e01042 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement support for WeakMapLars Knoll2018-08-282-0/+22
| | | | | Change-Id: Id23e80fe5918ba7dc897568123bf3db4d35e9092 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Simplify chunk sweeping codeSimon Hausmann2018-08-051-17/+11
| | | | | | | | | Instead of collecting the empty chunks after sweeping in a separate vector, partition the chunks into non-empty and empty ones and erase the second half after freeing them. Change-Id: I7896c167b8b09a01b124dcdcb1eba8ddc0eef7f4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix crashes when GC'ing internal classesLars Knoll2018-08-041-3/+11
| | | | | | | | | | | | | The destroy() method of internal classes tries to reference it's parent class to unregister itself there. This could go wrong if the parent class had been destroyed already and it's associated memory been freed by the GC. Fix this by only freeing actual memory at the end after the sweeping has been done. Change-Id: I85beb4792038d5a1a5708f5897af2c1950f8b8d1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move the Vtable for Managed objects into it's own fileLars Knoll2018-07-031-20/+1
| | | | | | | | Move both the code from qv4object and qv4managed into a new qv4vtable_p.h file. Change-Id: Ib1d58120b6c3b9b779b2692526c7e40a5265c4db Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Memory manager: Track icAllocator as part of used and allocated memoryUlf Hermann2018-05-301-3/+4
| | | | | | | This makes it consistent with the memory profiler. Change-Id: I628d03a4c0d079af0940f0e424b779d992b2919d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Don't use bitfields for VTable flagsLars Knoll2018-05-031-11/+11
| | | | | | | | | Accessing those is significantly slower than using a byte for each flag. As they are performance critical, let's rather use some more bytes in the vtable. Change-Id: I7104d3b791f469fe5d6705f20db0c965878126e2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Make the statistics variables members of the memory managerLars Knoll2018-05-022-22/+8
| | | | | | | | Otherwise this will show wrong stuff when running multiple engines in different threads (and create noise in thread sanitizers) Change-Id: Ia90054f5a54ee2c43870c8d839f25b195b09698c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Garbage collect identifiersLars Knoll2018-05-021-0/+3
| | | | | | | | | | | | | | | | | | | | | Implemented by storing a backpointer to the Heap object in the identifier. Since identifiers now point back to their originating String or Symbol, we can now easily mark all identifiers that are still in use and collect those that aren't. Since Identifiers are 64bit also add support for holding an array index in there. With that an identifier can describe any kind of property that can be accessed in an object. This helps speed up and simplify some code paths. To make this possible, we need to register all IdentifierHash instances with the identifier table, so that we can properly mark those identifiers. Change-Id: Icadbaf5712ab9d252d4e71aa4a520e86b14cd2a0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add a StringOrSymbol intermediate class between Managed and StringLars Knoll2018-05-021-1/+2
| | | | | | | | | This introduces a common base class for Strings and Symbols giving us a unified approach to handling object properties for both. Change-Id: Ic9e5a18b084c8b730e134db990f101d47af224e3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove some scopes in the memory managerLars Knoll2018-04-121-8/+6
| | | | | | | | | | These allocation functions only perform a single allocation. Since all live objects have to be reachable by the GC before calling into it, these scopes are not required. Change-Id: Ia7e89791d6ff2bfe87b7c5462191d28e04688df1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* garbage collect InternalClassLars Knoll2018-04-123-22/+52
| | | | | | | | | | | | | | | | Internal classes are now allocated and collected through the GC. As they are important to the deletion of other objects (because of the vtable pointer living inside the internal class), they need to get destroyed after regular objects have been sweeped. Achieve this by using a separate block allocator for internal class objects. Our lookups do often contain pointers to internal classes, so those need to be marked as well, so we don't accidentally collect them. Change-Id: I4762b054361c70c31f79f920f669ea0e8551601f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Better encapsulation for EngineBase::internalClassLars Knoll2018-04-121-1/+1
| | | | | | | | Turn it into a method instead of accessing the array directly to simplify refactoring. Change-Id: I197b56c8f58cfdfd294f429e6b15268c755f9837 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove dependency from qv4heap_p.h onto qv4internalclass_p.hLars Knoll2018-04-122-17/+5
| | | | | | | | This is required to be able to turn the internal class into something that lives on the GC heap. Change-Id: Ie4318588d420743b1e1ab1cd596a1c9d153eb793 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Disambiguate different allocation functions in the memory managerLars Knoll2018-04-121-1/+1
| | | | | | | | | | | Some compilers (in this case MingW 5.3) don't manage to properly disambiguate the template overloads, and try to instantiate the wrong template function. Solve this by renaming the one of the template functions. Change-Id: I3574e617fe96c4bd52920a0127a1dfe39cc3d302 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Cleanup MM::allocObject()Lars Knoll2018-04-121-3/+1
| | | | | | | | The prototype argument has been unused for quite some time, finally remove it. Change-Id: Ifcebe413a1951ed972b370afc48640bd22969943 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Optimize MM::allocManaged()Lars Knoll2018-04-121-4/+1
| | | | | | | | We can manage without calls to changeVTable() here, as the set of classes allocated with this is rather limited. Change-Id: I804e4850b91c61ebbca8a04edbe51deac911928d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Simplify allocation functions in the memory managerLars Knoll2018-04-121-150/+16
| | | | | | | Reduce code duplication by using variadic templates. Change-Id: Ia12b67184f66190b433c99fb2157fca4e46cb2b6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-03-151-14/+14
|\ | | | | | | Change-Id: I98ef98ca603a1d82f944973a06375e65192fdab2
| * Fix ABI/API symbol taggingSimon Hausmann2018-03-121-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The findclasslist.pl perl script that produces the linker version script got confused by the "struct name" that was part of a macro and thought that the class "name" in the *_p.h was supposed to be annotated with the private API tag, resulting in a "*4name*" mask in the linker script, which in turn made lots of public symbols "private" that had name in it, such as QQmlProperty::name(). Fixing the indentation works around it and conforms to coding style. Change-Id: I0c66a6bb1d49941d6ec6dd89d9433d9b6ae0c639 Done-with: Thiago Macieira <thiago.macieira@intel.com> Task-number: QTBUG-67004 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-03-122-3/+24
|\| | | | | | | Change-Id: I6b2568337c09ff98850b4ecccccc9a8fc25064cd
| * Fix issue with allocating huge objects in the memory managerLars Knoll2018-03-082-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We shouldn't allocate objects that are larger than the size of a standard memory segment through the chunk allocator, as this can lead to problems when freeing the segment and then re-using it again. Instead allocate a private MemorySegment for these objects, and free it when the object gets garbage collected. Task-number: QTBUG-66732 Change-Id: Ic24ff65d204977f313ab0adaf7a8132883e525f0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-02-273-15/+15
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4internalclass.cpp src/qml/parser/qqmljslexer.cpp src/qml/qml/v8/qv8engine.cpp src/qml/util/qqmladaptormodel_p.h src/quick/items/qquickanimatedsprite.cpp tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp Change-Id: I16702b7a0da29c2a332afee47728d6a6ebf4fb3f
| * use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-263-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-02-151-0/+15
|\| | | | | | | Change-Id: I2d4c012c8ca578f90d7eb56dbc6b306ac7cbb841
| * Merge remote-tracking branch 'origin/5.10' into 5.11Liang Qi2018-02-121-0/+15
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/shapes/qquickshape.cpp src/imports/shapes/qquickshape_p_p.h src/qml/compiler/qqmlpropertycachecreator_p.h src/qml/jsruntime/qv4value_p.h src/quick/items/qquickloader_p.h tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp tools/qmlprofiler/qmlprofilerapplication.cpp Change-Id: Iafc66ae84bf78630ed72a986acb678e9d19e3a69
| | * Merge remote-tracking branch 'origin/5.9' into 5.105.10Liang Qi2018-02-071-0/+15
| | |\ | | | | | | | | | | | | Change-Id: I3b250545e334f50dcef1a75acdef51820d34079a
| | | * Add back the optional heaptrack trace pointsAndras Mantia2018-02-061-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This approach tracks object allocations only, when slots from already allocated memory segment are used. Change-Id: I514b974d7580c1236264bec96dc1abe594585e86 Reviewed-by: Milian Wolff <milian.wolff@kdab.com> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | | CleanupsLars Knoll2018-02-091-35/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the Pointer<> declaration before the declaration of Heap::Base, as Heap::Base will start using Pointer<> in an upcoming commit. Remove redundant namespace prefixes and move the definition of the vtable() method out of the class. Change-Id: I388d4836448869faca88af9e3bfdbea3619508b9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | | Remove InternalClass forward declarationsLars Knoll2018-02-091-2/+0
|/ / / | | | | | | | | | | | | | | | | | | qv4global_p.h has it already. Change-Id: I7c2526873d1176d62a03708d8159546c65344cd2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-02-022-103/+73
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp src/qml/compiler/qqmlirbuilder.cpp src/qml/compiler/qqmlirbuilder_p.h src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4codegen_p.h src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4compiler.cpp src/qml/compiler/qv4compilercontext_p.h src/qml/compiler/qv4isel_moth.cpp src/qml/compiler/qv4jsir.cpp src/qml/compiler/qv4jsir_p.h src/qml/jit/qv4isel_masm.cpp src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4functionobject.cpp src/qml/jsruntime/qv4runtimecodegen.cpp src/qml/jsruntime/qv4script.cpp src/qml/jsruntime/qv4script_p.h src/qml/qml/qqmltypeloader.cpp src/quick/items/qquickanimatedimage.cpp src/quick/items/qquickanimatedimage_p_p.h src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp tests/auto/qml/qmlplugindump/qmlplugindump.pro tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp tools/qmlcachegen/qmlcachegen.cpp tools/qmljs/qmljs.cpp Done-with: Shawn Rutledge <shawn.rutledge@qt.io> Done-with: Lars Knoll <lars.knoll@qt.io> Done-with: Ulf Hermann <ulf.hermann@qt.io> Change-Id: I010e6525440a85f3b9a10bb9083f8e4352751b1d
| * | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2018-01-242-103/+73
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4compileddata_p.h src/qml/debugger/qqmlprofiler_p.h src/qml/jsruntime/qv4engine.cpp src/qml/memory/qv4mm.cpp src/qml/qml/qqmlcomponent.cpp src/qml/qml/qqmlobjectcreator.cpp src/qml/qml/qqmlobjectcreator_p.h src/qml/types/qqmldelegatemodel.cpp src/quick/items/qquickitem_p.h src/quick/items/qquickwindow.cpp tests/auto/quick/touchmouse/BLACKLIST tests/benchmarks/qml/holistic/tst_holistic.cpp Change-Id: I520f349ab4b048dd337d9647113564fc257865c2
| | * Add logging categories for GC statisticsLars Knoll2017-12-112-99/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And use them to dump some useful information. This replaces the old QV4_MM_STATS environment variable and introduces the qt.qml.gc.statistics (for some stats at app exit) and qt.qml.gc.allocatorStats (for stats on each GC run) logging categories. Change-Id: I0a16b25b8663aa7dbfe2adae299d3d990e8e5554 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Remove duplicated declarationLars Knoll2018-01-261-1/+0
| | | | | | | | | | | | | | | Change-Id: I42332ea59fcb5479d49c24c2189d066af569d4fc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Disentangle include dependencies around the write barrierLars Knoll2018-01-192-129/+36
| | | | | | | | | | | | | | | | | | | | | The write barrier header should have minimal dependencies. Change-Id: I071718c2fafe5020d1093ca3b363844f7a9b7b35 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-093-17/+36
|\| | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/qml/memory/qv4mm.cpp src/qml/qml/qqmlbinding.cpp Change-Id: I98e51ef5af12691196da5772a07d3d53d213efcc
| * | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2018-01-043-17/+36
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/memory/qv4mm.cpp src/qml/memory/qv4mmdefs_p.h src/quick/items/qquickwindow.cpp src/quick/items/qquickwindow_p.h tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp Change-Id: I7021fa1edf076627a67048f41f7b201220262b09
| | * Re-enable QML memory profilingUlf Hermann2017-11-233-13/+28
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-64674 Change-Id: I48ed1a51f66ef8d55cc026f140d270baaca04fbf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Raise minimum supported MSVC version to 2015Friedemann Kleint2018-01-063-11/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove code for older versions and streamline #ifdefs. Remove the helpers macros Q_STATIC_ASSERT_FOR_SANE_COMPILERS and V4_ASSERT_IS_TRIVIAL. Task-number: QTBUG-40658 Task-number: QTBUG-51673 Change-Id: Ifa4fab653b10ce7858739adef08364cddc6507cf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | JIT: Inline load(Scoped)Local and store(Scoped)Local instructionsLars Knoll2017-11-301-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | Generate inline code for loading and storing (scoped) locals in the JIT. Change-Id: I6eb72126a0a2c6012bf6e73df245c9301bd4c48d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Bring back markObjects(), this time generatedLars Knoll2017-11-144-100/+78
| | | | | | | | | | | | | | | | | | | | | | | | Doing the marking of objects in a function instead of using the table seems to be somewhat faster. Change-Id: I9ec00cc0264f9a15c69b285db493bee31d99bf96 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>