Commit graph

140 commits

Author SHA1 Message Date
06dbb9fad5 DiffFramework: simplify existing bindings
...by relying on the newly implemented automatic standard binding
Looks like a significant improvement for me, now the actual bindings
only details aspects, which are related to the target, and no longer
such technicalitis like how to place a Child-Mutator into a buffer handle
2021-01-23 12:55:10 +01:00
c7d157e295 Library: integrate generic min/max function
...built while investigating type deduction problems on PtrDerefIter
...also allow PtrDerefIter to work with std::unique_ptr
2020-03-08 02:05:39 +01:00
4070cc0d83 DisplayEvaluation: draft evaluation invocation per track
...however, running into some type deduction problems...
2020-03-08 01:11:21 +01:00
a508ad751f Investigation: clarify handling of CSS3 box-shadow for custom drawing
- CSS3 effects like box-shadow are applied with the StyleContext::render_background() function
  * first, an outset box-shadow is rendered _outside_ the box given as parameter to `render_background()`
  * then the box is filled with the background colour
  * and last, an inset box-shadow is rendered _inside_ the area of a would-be border,
    without rendering the border itself.
  * consequently we can not shade the border itself and we can not shade the content
2019-08-08 19:08:04 +02:00
7bf7c51375 Investigation: inconclusive further research (context_save/restore)
Indeed I had missed to connect the new "free standing" StyleContext to
some Gdk::Screen, typically the default screen (connected to the current
top level window). But seemingly this was not really necessary, since,
somehow magically, the style context must have connected itself to some
screen, otherwise it wouldn't be able to access the CSS cascade.

Anyhow, fixing this omission does not resolve our problem.
Nor does any combination of re-connecting, invalidating etc.

I poked around in the GTK (C) code a lot, but could not spot any obvious
missing initialisation step. To much magic around here. Without massive
debugging into GTK internals, I don't see any way to further this
investigation. And, moreover there is a viable workaround
(namely to set and remove the classes explicitly, which works as intended)

I posted a question on Stackoverflow and for now
I'll file this topic as "inconclusive"
https://stackoverflow.com/q/57342478
2019-08-08 19:08:04 +02:00
ec3c49f612 Investigation: can reproduce the problematic behaviour with minimal setup
when we create a new Gtk::StyleContext and just apply a path,
then the style context looses its styling properties on context_save()
2019-08-08 19:08:04 +02:00
06aa5c4c8c Investigation: get the border resizing to work
...as it turns out, a problem with Cascading prevented the additional classes to become effective
2019-08-03 15:45:36 +02:00
1b3cc73d07 Investigation: rebuild the problematic situation in this controlled environment
Within the timeline drawing code, adding a class to the Gtk::StyleContext on the fly seemingly did not work.
Now we're doing basically the same here in this small Gtk test application,
and it does not work either :-)
2019-08-03 13:34:56 +02:00
3921a9d41c Investigation: use a StyleContext for custom drawing
- add a separate dummy Gtk::Frame widget
- apply custom styling to that frame, by virtue of a CSS class '.experiment'
- pick up the Gtk::StyleContext of that testFrame
- use this style context to draw a custom frame onto the canvas
- control extension of that custom frame through the top margin of testFrame
2019-08-01 01:07:22 +02:00
aacc4ca041 Investigation: install a custom stylesheet 2019-08-01 00:48:04 +02:00
0280000854 Investigation: setup a minimal standalone GTK application
...to find out about GTK's implementation of some aspects of CSS
through Gtk::StyleContext and friends

Basically this is a clone of the existing gtk-canvas-experiment application
2019-08-01 00:02:56 +02:00
06163f6016 Timeline: filter to select the pinned prefix part of the profile
...when rendering this part, which shall be always visible.
And the rest of the profile needs to be rendered into a second canvas,
which is placed within a pane with scrollbar.

Implemented as a statefull iterator filter
2019-06-21 23:18:44 +02:00
8f43c2591e Library: investigate malfunction in metaprogramming
the template lib::PolymorphicValue seemingly picked the wrong
implementation strategy for "virtual copy support": In fact it is possible
to use the optimal strategy here, since our interface inherits from CloneSupport,
yet the metaprogramming logic picked the mix-in-adapter (which requires one additional "slot"
of storage plus a dynamic_cast at runtime).

The reason for this malfunction was the fact that we used META_DETECT_FUNCTION
to detect the presence of a clone-support-function. This is not correct, since
it can only detect a function in the *same* class, not an inherited function.

Thus, switching to META_DETECT_FUNCTION_NAME solves this problem
Well, this solution has some downsides, but since I intend to rewrite the
whole virtual copy support (#1197) anyway, I'll deem this acceptable for now


TODO / WIP: still some diagnostics code to clean up, plus a better solution for the EmptyBase
2019-05-10 02:19:01 +02:00
a57799d018 Library: further narrowing down the tuple-forwarding problem
...yet still not successful.

The mechanism used for std::apply(tuple&) works fine when applied directly to the target function,
but fails to select the proper overload when passed to a std::forward-call for
"perfect forwarding". I tried again to re-build the situation of std::forward
with an explicitly coded function, but failed in the end to supply a type parameter
to std::forward suitably for all possible cases
2019-05-09 17:10:35 +02:00
612a442550 Library: unable to reproduce the problem with an "equivalent" demo example
...the simplified demo variant in try.cpp is accepted by the compiler and works as intended,
while the seemingly equivalent construction in verb-visitor.hpp is rejected by the compiler

This discrepancy might lead to a solution....?
2019-04-22 17:45:38 +02:00
5191073558 Library: continue Investigation with workaround, inconclusive yet
A simple yet weird workaround (and basically equivalent to our helper function)
is to wrap the argument tuple itself into std::forward<Args> -- which has the
effect of exposing RValue references to the forwarding function, thus silencing
the compiler.

I am not happy with this result, since it contradicts the notion of perfect forwarding.

As an asside, the ressearch has sorted out some secondary suspicions..
- it is *not* the Varargs argument pack as such
- it is *not* the VerbToken type as such

The problem clearly is related to exposing tuple elements to a forwarding function.
2019-04-20 17:27:47 +02:00
805d83c2db Library: Investigate forwarding of tuple elements
basically this is similar to std::invoke...
However, we can not yet use std::invoke, and in addition to this,
the actual situation is somewhat more contrieved, so even using std::invoke
would require to inject another argument into the passed argument tuple.

In the previous commit, I more or less blindly coded some solution,
while I did not fully understand the complaints of the compiler and why
it finally passed. I still have some doubts that I am in fact moving the
contents out of the tuple, which would lead to insidious errors on
repeated invocation.

Thus this invstigation here, starting from a clean slate textbook implementation
2019-04-19 18:37:30 +02:00
5b8aef9623 Yoshimi: found the bug
plain flat off by one :-D
end pointer must be behind the last array element.
Thus we didn't use all state values, and thus our random numbers diverged
2018-12-31 09:50:53 +01:00
f0e482ad78 Yoshimi: investigation of the random number algorithm from the C standard lib
(ab)using the Lumiera tree here for research work on behalf of the Yoshimi project
For context, we stumbled over sonic changes due to using different random number algorighims,
in spite of all those algorithms producing mathematically sane numbers
2018-12-31 09:05:45 +01:00
02c5809707 Global-Layer-Renaming: adjust namespace qualification 2018-11-15 23:59:23 +01:00
2d5ebcd5fa Global-Layer-Renaming: adjust header includes 2018-11-15 23:42:43 +01:00
fa6ba76f85 investigate insidious ill-guided conversion
As it turns out, using the functional-notation form conversion
with *parentheses* will fall back on a C-style (wild, re-interpret) cast
when the target type is *not* a class. As in the case in question here, where
it is a const& to a class. To the contrary, using *curly braces* will always
attempt to go through a constructor, and thus fail as expected, when there is
no conversion path available.

I wasn't aware of that pitfall. I noticed it since the recently introduced
class TimelineGui lacked a conversion operator to BareEntryID const& and just
happily used the TimelineGui object itself and did a reinterpret_cast into BareEntryID
2018-10-12 23:42:56 +02:00
3f87ef43ec ...tidy.up: preserve the Gtk::Canvas experiment (see #1020)
Turning this investigation experiment from 2016 into a stand-alone Gtk application.
Using the research folder as final disposal site for now...
2018-10-07 17:31:49 +02:00
76dd4fb5dc ...tidy.up: prepare for working on the timeline display
''a new hope''

This was quite a long way until we're back at the point of
re-building the timeline anew.

Stash the canvas research code to make room for new things to come
2018-10-07 03:44:00 +02:00
3b8965c0b6 Heisenbug hunt.... Segfault related to regular expression (#1158)
not yet able to reproduce these seemingly random segfaults
2018-09-14 21:04:25 +02:00
852a3521db Static-Init: switch lib::Depend to embed the factory as Meyer's Singleton (#1142)
this is a (hopefully just temporary) workaround to deal with static initialisation
ordering problems. The original solution was cleaner from a code readability viewpoint,
however, when lib::Depend was used from static initialisation code, it could
be observed that the factory constructor was invoked after first use.

And while this did not interfer with the instance lifecycle management itself,
because the zero-initialisation of the instance (atomic) pointer did happen
beforehand, it would discard any special factory functions installed from such
a context (and this counts as bug for my taste).
2018-05-01 18:49:20 +02:00
22b934673f Investigation: init order of static template member fields
indicates rather questionable behaviour.
The standard demands a templated static field to be defined before first odr-use.
IIRC, it even demands a static field to be initialised prior to use in a ctor.

But here the definition of the templated static member field is dropped off even after
the definition of another static field, which uses the (templated) Front-end-class
in its initialiser.
2018-05-01 16:59:15 +02:00
fe10ab92dc DI: adjust codebase to the new DependInject configuration API 2018-03-31 01:06:10 +02:00
80207ea224 DI: (WIP) switch to totally rewritten new implementation of lib::Depend (#1086)
- state-of-the-art implementation of access with Double Checked Locking + Atomics
- improved design for configuration of dependencies. Now at the provider, not the consumer
- support for exposing services with a lifecycle through the lib::Depend<SRV> front-end
2018-03-31 01:06:06 +02:00
7a250ca9e5 DI: benchmark atomic locking 2018-03-24 11:02:44 +01:00
f05ec78e08 DI: benchmark Double-Checked-Locking with Mutex
This is essentially the solution we used since start of the Lumiera project.
This solution is not entirely correct in theory, because the assignment to the
instance pointer can be visible prior to releasing the Mutex -- so another thread
might see a partially initialised object
2018-03-24 11:02:44 +01:00
ff256d9e57 DI: benchmark naive lock protected access
...which gives us the dramatic numbers we'd expect.
Especially the multithreaded variant contends drastically
2018-03-24 11:02:43 +01:00
d2dababf5c DI: benchmark dependency-factory with unprotected lazy init
NOT threadsafe.
Indeed, crashed several times during the multithreaded benchmark runs
2018-03-24 08:29:39 +01:00
69f21d96af DI: prepare benchmark of reference cases
_not_ using the dependency factory, rather direct access

 - to a shared object in the enclosing stack frame
 - to a heap allocated existing object accessed through uniqe_ptr
2018-03-24 07:48:59 +01:00
31539f00c8 Library: a function for performing multithreaded microbenchmarks 2018-03-24 01:58:34 +01:00
3104016cf2 DI: set up framework for investigation of performance impact
We are about to switch to Double Checked Locking with C++11 atomics,
and we want some rough numbers regarding the Impact
2018-03-23 23:42:10 +01:00
364dcd5291 DI: verify and improve static sanity checks
esp. for subclass instance creation from within a lambda
2018-03-22 21:43:19 +01:00
83476b3ef1 DI: Reworked dependency-factory implementation draft complete -- move into library headers
This is a complete makeover of our lib::Depend and lib::DependencyFactory templates.
While retaining the basic idea, the configuration has been completely rewritten
to favour configuration at the point where a service is provided rather,
than at the point where a dependency is used.

Note: we use differently named headers, so the entire Lumiera
code base still uses the old implementation. Next step will be
to switch the tests (which should be drop-in)
2018-03-19 03:46:49 +01:00
957e7ff54c DI: extract testcode into new unit test 2018-03-19 03:46:43 +01:00
debd7c1797 DI: fix indentation
...want to retain the git history
2018-03-19 01:55:17 +01:00
f66d452c56 DI: refurbish internal access for the configuration handles
explicit friendship seems adequate here
DependInject<SRV> becomes more or less a hidden part of Depend<SRV>,
but I prefer to bundle all those quite technical details in a separate
header, and close to the usage
2018-03-19 01:14:52 +01:00
b776ce568f DI: fix inspiring Segfault
a bloody closure that bangs itself away....
2018-03-19 00:44:26 +01:00
f0c8928301 DI: draft implementation for testmock support 2018-03-19 00:05:02 +01:00
786f051132 DI: problem of misconfiguration for service access
This is a tricky problem an an immediate consequence of the dynamic configuration
favoured by this design. We avoid a centralised configuration and thus there
are no automatic rules to enforce consistency. It would thus be possible
to start using a dependency in singleton style, but to switch to service
style later, after the fact.

An attempt was made to prevent such a mismatch by static initialisiation;
basically the presence of any Depend<SRV>::ServiceInstance<X> would disable
any usage of Depend<SRV> in singleton style. However, such a mechanism
was found to be fragile at best. It seems more apropriate just to fail
when establishing a ServiceInstance on a dependency already actively in
use (and to lock usage after destroying the ServiceInstance).

This issue is considered rather an architectural one, which can not be
solved by any mechanism at implementation level ever
2018-03-18 17:19:30 +01:00
5516700523 DI: draft configuration for using a service implementation created elsewhere 2018-03-18 02:11:46 +01:00
9f93154f62 DI: draft configuration for using a subclass Singleton 2018-03-18 01:30:51 +01:00
e1ca9f447b DI: draft syntax for special dependency injection configuration 2018-03-18 00:57:25 +01:00
eebe31aa7e DI: change to heap allocation for singletons
up to now we used placement into a static buffer.
While this approach is somewhat cool, I can't see much practical benefit anymore,
given that we use an elaborate framework which rules out the use of Meyers Singleton.
And given that with C++11 we're able just to use std::unique_ptr to do all work.

Moreover, the intended configurability will become much simpler by relying
on a _closure_ to produce a heap-allocated instance for all cases likewise.

The only possible problem I can see is that critical infrastructure might
rely on failsafe creation of some singleton. Up to now this scenario
remains theoretical however
2018-03-17 23:41:56 +01:00
e393d44e92 DI: replace Meyers Singleton by an explicitly managed buffer
Meyers Singleton is elegant and fast and considered the default solution
However...

 - we want an "instance" pointer that can be rebound and reset,
   and thus we are forced to use an explicit Mutex and an atomic variable.
   And the situation is such that the optimiser can not detect/verify this usage
   and thus generates a spurious additional lock for Meyers Singleton

 - we want the option to destroy our singletons explicitly
 - we need to create an abstracted closure for the ctor invocation
 - we need a compiletime-branch to exclude code generation for invoking
   the ctor of an abstract baseclass or interface

All those points would be somehow manageable, but would counterfeit the
simplicity of Meyers Singleton
2018-03-17 17:30:28 +01:00
261049e04d DI: minimalistic design for service access
Problems:
 - using Meyers Singleton plus a ClassLock;
   This is wasteful, since the compiler will emit additional synchronisation
   and will likely not be able to detect the presence of our explicit locking guard

 - what happens if the Meyers Singleton can not even be instantiated, e.g. for
   an abstract baseclass? We are required to install an explicit subclass configuration
   in that case, but the compiler is not able to see this will happen, when just
   compiling the lib::Depend
2018-03-17 03:36:58 +01:00