1. 02 Mar, 2019 3 commits
  2. 01 Mar, 2019 1 commit
  3. 26 Feb, 2019 2 commits
  4. 25 Feb, 2019 4 commits
  5. 24 Feb, 2019 4 commits
    • Philip Chimento's avatar
      CI: Always build HEAD in Flatpak manifest · 554e3d7a
      Philip Chimento authored
      The commit being built for CI will already be checked out, so if we
      specify HEAD in the manifest flatpak-builder will check out that commit
      too.
      
      The previous way of specifying this only worked for branches, not tags.
      554e3d7a
    • Philip Chimento's avatar
      boxed: Mark pointer as unowned when discarding boxed object · 7b330751
      Philip Chimento authored
      Sometimes, in the constructor of a boxed object, we will delegate to
      another constructor, such as GLib.Error() or GLib.Variant.new_internal()
      and replace the object under construction by the object returned by
      the delegated constructor.
      
      When that happens, the internal GBoxed pointer of the BoxedInstance
      remains null. That causes problems when eventually the discarded boxed
      object is garbage collected, and we try to free the pointer. In those
      cases, mark it as unowned so it is not freed.
      7b330751
    • Philip Chimento's avatar
      boxed: Clarify lifecycle log messages · cf71e3ba
      Philip Chimento authored
      To aid in debugging, we want to log a lifecycle message whenever the
      internal boxed pointer is created or allocated. This was only logged in
      some cases, and the message confusingly said "JSObject created".
      cf71e3ba
    • Philip Chimento's avatar
      context: Trace atoms · 6d25dbeb
      Philip Chimento authored
      Apparently I forgot to trace these. It didn't affect most of the members
      of GjsAtoms because string atoms are pinned in memory anyway. But the
      symbol atoms only had their symbol descriptions pinned in memory, not
      the symbols themselves. So garbage collections would collect these
      symbols.
      
      This wasn't obvious because the symbols seem only to be used early in
      the GJS process anyway. It became apparent when running with JS_GC_ZEAL
      (extra garbage collection after every 100 allocations.)
      6d25dbeb
  6. 18 Feb, 2019 2 commits
  7. 15 Feb, 2019 4 commits
  8. 11 Feb, 2019 11 commits
    • Philip Chimento's avatar
      object: Support fields defined in ancestor classes · 9f182bd6
      Philip Chimento authored
      We define a JS property with getter and setter for a GObject field in
      resolve_impl() (where lazy properties are defined) when JS code tries to
      access a field. The getter and setter retrieve the field's GIFieldInfo
      information from a cache, using a key that is built into the getter and
      setter.
      
      Because this is done during the resolve operation, and the resolve
      operation can occur multiple times going up the prototype chain, the JS
      property may end up on a prototype that is an ancestor of the object's
      direct prototype. So the GIFieldInfo may end up on any prototype in the
      prototype chain, and so we have to search through the prototype chain
      for it.
      
      Closes: #223.
      9f182bd6
    • Philip Chimento's avatar
      wrapperutils: Avoid template policy warning · 643bd164
      Philip Chimento authored
      In cases where the template function pointer parameter type_struct is
      not null in a particular instantiation, GCC will warn about the code
      here that the pointer can never be null. We want to avoid that warning
      because the whole point is that the pointer is always or never null in a
      particular instantiation.
      643bd164
    • Philip Chimento's avatar
      atoms: Make destructor explicit to prevent inlining · 56bbcca0
      Philip Chimento authored
      The GjsAtoms destructor is giant because it calls a JS::Heap destructor
      for every atom. If it is generated implicitly, then GCC complains about
      it being too big to inline. Providing an explicit destructor seems to
      prevent this warning.
      56bbcca0
    • Philip Chimento's avatar
      jsapi-util-root: Add debug_addr() method for pointer types · ba7fb121
      Philip Chimento authored
      For GjsMaybeOwned<T> where T is a pointer type, we add a debug_addr()
      method which returns the pointer address without triggering a read
      barrier. This is needed for debug methods because we want to be able to
      debug-log things even after they are marked for sweeping. (The read
      barrier will assert in debug mode if the object is already marked for
      sweeping.)
      ba7fb121
    • Philip Chimento's avatar
      build: Look for suitable locale to run tests in · 132e55c9
      Philip Chimento authored
      Apparently only newer libcs define a C.UTF-8 locale (see
      https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=636086). Notably, in
      the Freedesktop SDK there is no C.UTF-8 locale.
      
      This tests using "locale -a" if the C.UTF-8 locale is available, before
      selecting it. If it is not available, we try to find a reasonable
      fallback, preferring English locales in order to make it easier to share
      debug output in bug reports.
      132e55c9
    • Philip Chimento's avatar
      debugger: Fix bug in help command · 0336a67b
      Philip Chimento authored
      Logic error while skipping the comment and eval commands.
      0336a67b
    • Philip Chimento's avatar
      fundamental: Fix broken hash table · 105a20a9
      Philip Chimento authored
      There was a hash table (attached to the GjsContext using qdata) which
      stored a mapping of void* fundamental instance pointers to JSObject
      instances. This would have broken quite badly as soon as any of those
      JSObjects were moved by the garbage collector.
      
      Instead we use a JS::GCHashMap, and since it was previously attached to
      the GjsContext anyway we go ahead and make it a member of
      GjsContextPrivate. We put it inside a JS::WeakCache so that it will be
      automatically swept when the objects are garbage collected.
      
      The WeakCache must be destroyed before calling JS_DestroyContext() or we
      will fail an assertion in debug mode.
      105a20a9
    • Philip Chimento's avatar
      boxed: Remove zero_args_constructor_name member · 0decc66c
      Philip Chimento authored
      This was not actually used anywhere, as the zero-args constructor is
      invoked directly with g_function_info_invoke().
      0decc66c
    • Philip Chimento's avatar
      object: Use is_custom_js_class() for readability · f3a94631
      Philip Chimento authored
      This expresses the intention more clearly than checking if info() is
      null.
      f3a94631
    • Philip Chimento's avatar
      repo: Factor out new function · fc791300
      Philip Chimento authored
      The combination of gjs_lookup_generic_prototype() plus
      JS_NewObjectWithGivenProto() occurs often enough to be a separate
      function.
      fc791300
    • Philip Chimento's avatar
      object: Cache field info during resolve already · dce837ce
      Philip Chimento authored
      In object resolve (lazy property definition), we define a JS property
      for a GObject field, and give the property getter and setter a key with
      which it can look up its GIFieldInfo in a cache.
      
      Previously, the getter and setter would look in the cache, and if the
      GIFieldInfo was not present, compute it from the object's GIObjectInfo
      and add it to the cache.
      
      Since resolution of a GObject field will always be followed immediately
      by either a getter or setter invocation, and we already have the
      GIFieldInfo available at the resolve step, go ahead and add it to the
      cache already, instead of discarding it and computing it again shortly
      after.
      
      See also: gjs#223
      dce837ce
  9. 05 Feb, 2019 5 commits
  10. 31 Jan, 2019 1 commit
  11. 28 Jan, 2019 3 commits
    • Philip Chimento's avatar
      overrides: Allow DBus methods with file descriptor lists · a13bb7a0
      Philip Chimento authored
      For DBus proxies, we now allow calling methods with an extra
      Gio.UnixFDList argument. This does not break existing code because we
      already allowed a bunch of arguments in any order. Gio.DBusProxy.call()
      is the same under the hood as Gio.DBusProxy.call_with_unix_fd_list(),
      only with a null FD list parameter, so we can replace the former with
      the latter.
      
      Previously, synchronously called DBus proxy methods would return an
      unpacked GVariant. Now, if called with a Gio.UnixFDList they will return
      [unpacked GVariant, FDList]. This also does not break existing code
      because it was not possible to call a method with an FDList before, and
      the return value is unchanged if not calling with an FDList. This does
      mean, unfortunately, that if you have a method with an 'h' in its return
      signature but not in its argument signatures, you will have to call it
      with an empty FDList in order to receive an FDList with the return
      value, if calling synchronously.
      
      On the DBus service side, when receiving a method call, we now pass the
      FDList received from DBus to the called method. Previously, sync methods
      were passed the parameters, and async methods were passed the parameters
      plus the Gio.DBusInvocation object. Appending the Gio.UnixFDList to
      those parameters also should not break existing code, although it could
      if the method examines the number of arguments. (That is unlikely, since
      DBus doesn't have methods with variable arguments.)
      
      TODO: Check whether this works on non-Unix platforms.
      
      Closes #204.
      a13bb7a0
    • Philip Chimento's avatar
      Merge branch 'gjs-private-sources-should-be-c-files' into 'master' · 7b9d03de
      Philip Chimento authored
      GjsPrivate: Sources should be C files
      
      See merge request GNOME/gjs!262
      7b9d03de
    • Philip Chimento's avatar
      GjsPrivate: Sources should be C files · e1c96788
      Philip Chimento authored
      The GjsPrivate library doesn't use any SpiderMonkey code, only C APIs.
      So the files should be compiled with a C compiler, otherwise we get
      C++'s stricter typechecks, making it hard to use void* APIs such as
      g_steal_pointer().
      
      [skip cpplint] - This shows a diff in the linter output because the
      files were renamed.
      e1c96788