<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/gjs.git/gi/function.cpp, branch ewlsh/fix-function-pointers</title>
<subtitle>gitlab.gnome.org: GNOME/gjs.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gjs.git/'/>
<entry>
<title>Some really rough work on fixing function pointer support</title>
<updated>2021-08-07T05:27:14+00:00</updated>
<author>
<name>Evan Welsh</name>
<email>contact@evanwelsh.com</email>
</author>
<published>2021-08-07T05:27:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gjs.git/commit/?id=8c585c9706b19c213682af9319789642cdcb15c6'/>
<id>8c585c9706b19c213682af9319789642cdcb15c6</id>
<content type='text'>
Not sure if we should go this route or wrap in a callback, I'd prefer
if we can go this route to avoid adding JS wrapping
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Not sure if we should go this route or wrap in a callback, I'd prefer
if we can go this route to avoid adding JS wrapping
</pre>
</div>
</content>
</entry>
<entry>
<title>context: Cleanup completed trampoline in context, as this is what they belong to</title>
<updated>2021-08-01T22:54:59+00:00</updated>
<author>
<name>Marco Trevisan (Treviño)</name>
<email>mail@3v1n0.net</email>
</author>
<published>2021-05-17T16:17:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gjs.git/commit/?id=713ed60f719e2e11a20fd1508210b2195247d547'/>
<id>713ed60f719e2e11a20fd1508210b2195247d547</id>
<content type='text'>
We're currently keeping a list of trampolines in a static vector, this
is acceptable (at least for a single-context scenario), but trampolines are
bound to a specific context so better to move the handling in the context.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We're currently keeping a list of trampolines in a static vector, this
is acceptable (at least for a single-context scenario), but trampolines are
bound to a specific context so better to move the handling in the context.
</pre>
</div>
</content>
</entry>
<entry>
<title>GjsMaybeOwned: Remove notifier support and move it into GjsPrivateContext</title>
<updated>2021-08-01T22:54:59+00:00</updated>
<author>
<name>Marco Trevisan (Treviño)</name>
<email>mail@3v1n0.net</email>
</author>
<published>2021-05-16T16:02:10+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gjs.git/commit/?id=2fc0d36062c805aaa28a8e63763fafbe4d25cf75'/>
<id>2fc0d36062c805aaa28a8e63763fafbe4d25cf75</id>
<content type='text'>
GjsMaybeOwned had a notification support that was used only by Closures
(other than tests), this was causing adding an extra pointer to all
the types using it (including Object) that was mostly unused.

So, move this into private context, re-implementing it using our own
notifier (instead of relying on GObject's that needs a specific order) and
use it in closures.

Also add an hook to handle gc events on private context that will be in
later changes to cleanup more things, but for now is used to shrink the
closures vector once we've done.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GjsMaybeOwned had a notification support that was used only by Closures
(other than tests), this was causing adding an extra pointer to all
the types using it (including Object) that was mostly unused.

So, move this into private context, re-implementing it using our own
notifier (instead of relying on GObject's that needs a specific order) and
use it in closures.

Also add an hook to handle gc events on private context that will be in
later changes to cleanup more things, but for now is used to shrink the
closures vector once we've done.
</pre>
</div>
</content>
</entry>
<entry>
<title>function: Use minimal allocation for trampoline data</title>
<updated>2021-08-01T22:54:59+00:00</updated>
<author>
<name>Marco Trevisan (Treviño)</name>
<email>mail@3v1n0.net</email>
</author>
<published>2021-05-15T12:45:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gjs.git/commit/?id=41a6fa9c8d2c7bc077ae9e43bbb369ea675b2983'/>
<id>41a6fa9c8d2c7bc077ae9e43bbb369ea675b2983</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>GjsCallBackTrampoline: Inherit from Gjs::Closure (and so GClosure)</title>
<updated>2021-08-01T22:54:59+00:00</updated>
<author>
<name>Marco Trevisan (Treviño)</name>
<email>mail@3v1n0.net</email>
</author>
<published>2021-05-14T23:55:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gjs.git/commit/?id=53a6cca32243225e180a544db258b89853d624cf'/>
<id>53a6cca32243225e180a544db258b89853d624cf</id>
<content type='text'>
The callback trampoline is in fact a GClosure, but we were just composing
one. We can instead just inherit from it now, given that the
Gjs::Closure will allocate the needed memory via the closure allocator
and handle the references via native closure reference system (avoid to
duplicate that).

As per this, some less memory used as we save a pointer and the
reference counting.

The only bit we need to handle is the destruction as we need to be sure
to call the proper type destructor on closure finalization.
So, adding an utility function that ensures this happens for each type
and that we won't call the base destructor twice.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The callback trampoline is in fact a GClosure, but we were just composing
one. We can instead just inherit from it now, given that the
Gjs::Closure will allocate the needed memory via the closure allocator
and handle the references via native closure reference system (avoid to
duplicate that).

As per this, some less memory used as we save a pointer and the
reference counting.

The only bit we need to handle is the destruction as we need to be sure
to call the proper type destructor on closure finalization.
So, adding an utility function that ensures this happens for each type
and that we won't call the base destructor twice.
</pre>
</div>
</content>
</entry>
<entry>
<title>closure: Reimplement to be a C++ class with custom heap allocator</title>
<updated>2021-08-01T22:54:59+00:00</updated>
<author>
<name>Marco Trevisan (Treviño)</name>
<email>mail@3v1n0.net</email>
</author>
<published>2021-05-14T01:18:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gjs.git/commit/?id=189cd4b7a0f223e2259934e77bb2c1959530989a'/>
<id>189cd4b7a0f223e2259934e77bb2c1959530989a</id>
<content type='text'>
To create closures we used to create an internal closure structure that
for which we were handling construction and destruction manually.

C++ allows us to use some nicer features though, and we can take
advantage of them once we leave the role of allocating and deallocating
the memory to GClosure functions.

This can be nicely done overriding the new and delete operators that
will give us the size to allocate exactly as the closure creator
function expects to receive.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
To create closures we used to create an internal closure structure that
for which we were handling construction and destruction manually.

C++ allows us to use some nicer features though, and we can take
advantage of them once we leave the role of allocating and deallocating
the memory to GClosure functions.

This can be nicely done overriding the new and delete operators that
will give us the size to allocate exactly as the closure creator
function expects to receive.
</pre>
</div>
</content>
</entry>
<entry>
<title>function: Move Function into the Gjs namespace to be unique</title>
<updated>2021-05-13T11:17:15+00:00</updated>
<author>
<name>Marco Trevisan (Treviño)</name>
<email>mail@3v1n0.net</email>
</author>
<published>2021-05-06T20:01:29+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gjs.git/commit/?id=d87e961861cc6ec934c300bca7f9528bd21aba61'/>
<id>d87e961861cc6ec934c300bca7f9528bd21aba61</id>
<content type='text'>
There's a such definition in readline and this breaks building both with
pch and with unity builds
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There's a such definition in readline and this breaks building both with
pch and with unity builds
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch '386-arg-cache-not-supported' into 'master'</title>
<updated>2021-05-04T04:57:43+00:00</updated>
<author>
<name>Philip Chimento</name>
<email>philip.chimento@gmail.com</email>
</author>
<published>2021-05-04T04:57:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gjs.git/commit/?id=cbd2c56fa71d68561a368a936abd7e793e6890b3'/>
<id>cbd2c56fa71d68561a368a936abd7e793e6890b3</id>
<content type='text'>
arg-cache: Never throw when building the argument cache

Closes #386

See merge request GNOME/gjs!590</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
arg-cache: Never throw when building the argument cache

Closes #386

See merge request GNOME/gjs!590</pre>
</div>
</content>
</entry>
<entry>
<title>object: Discard disposed GObject's and do not create wrappers for them</title>
<updated>2021-04-22T20:55:19+00:00</updated>
<author>
<name>Marco Trevisan (Treviño)</name>
<email>mail@3v1n0.net</email>
</author>
<published>2021-03-24T04:57:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gjs.git/commit/?id=1532cabd8a026d186d67119581a45402d7dd35d5'/>
<id>1532cabd8a026d186d67119581a45402d7dd35d5</id>
<content type='text'>
As per commit d37d6604 and commit c0003eb we may destroy an object
wrapper earlier than we used to do, this has some memory benefits but
we also need to make sure that we cleanup the object qdata so that it
never points to the just free'd object wrapper.

By doing this, however, we may end up re-associating a GObject that is
disposed but not yet finalized to another valid wrapper. This was allowed
before but wasn't really correct either because in such case it will be
just useless and won't be able to monitor its disposal again.

So, now during disposal notify save a qdata (that won't be removed
until finalization) on gobject marking it as disposed, then use this
data to prevent an object to be re-associated again to a valid wrapper.

In fact we just create a new wrapper that is marked as "disposed", and
so preventing most of actions to be performed.
We don't warn though, because this may just happen at the moment the
invalid object is incorrectly used.
As per this, we need to unset the object qdata only if the object is not
finalized, as we may still need to do it when it's finalized, or we'll
still crash when a disposed GObject will point to a wrapper that has been
already destroyed.

Added tests simulating this.

Fixes: #395
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As per commit d37d6604 and commit c0003eb we may destroy an object
wrapper earlier than we used to do, this has some memory benefits but
we also need to make sure that we cleanup the object qdata so that it
never points to the just free'd object wrapper.

By doing this, however, we may end up re-associating a GObject that is
disposed but not yet finalized to another valid wrapper. This was allowed
before but wasn't really correct either because in such case it will be
just useless and won't be able to monitor its disposal again.

So, now during disposal notify save a qdata (that won't be removed
until finalization) on gobject marking it as disposed, then use this
data to prevent an object to be re-associated again to a valid wrapper.

In fact we just create a new wrapper that is marked as "disposed", and
so preventing most of actions to be performed.
We don't warn though, because this may just happen at the moment the
invalid object is incorrectly used.
As per this, we need to unset the object qdata only if the object is not
finalized, as we may still need to do it when it's finalized, or we'll
still crash when a disposed GObject will point to a wrapper that has been
already destroyed.

Added tests simulating this.

Fixes: #395
</pre>
</div>
</content>
</entry>
<entry>
<title>gerror: Handle any value when converting thrown value to GError</title>
<updated>2021-04-21T04:50:15+00:00</updated>
<author>
<name>Philip Chimento</name>
<email>philip.chimento@gmail.com</email>
</author>
<published>2021-04-18T04:45:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gjs.git/commit/?id=2df5407c156480102f24f921a64ac2e5d8f498fb'/>
<id>2df5407c156480102f24f921a64ac2e5d8f498fb</id>
<content type='text'>
In JS you can throw not only Error objects, but any value. If throwing a
value from a signal handler or vfunc with a GError** parameter, then that
value should be converted to a GError whether it is an Error object or
not.

Rename gjs_gerror_make_from_error() to gjs_gerror_make_from_thrown_value()
and refactor it to get the pending exception (thrown value) from the
context, and convert that into a GError.

If the object does not have a 'name' and 'message' property then it's
converted into a GJS_JS_ERROR_ERROR with an appropriate debug message; if
it does, then it's converted into the appropriate type of GJS_JS_ERROR.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In JS you can throw not only Error objects, but any value. If throwing a
value from a signal handler or vfunc with a GError** parameter, then that
value should be converted to a GError whether it is an Error object or
not.

Rename gjs_gerror_make_from_error() to gjs_gerror_make_from_thrown_value()
and refactor it to get the pending exception (thrown value) from the
context, and convert that into a GError.

If the object does not have a 'name' and 'message' property then it's
converted into a GJS_JS_ERROR_ERROR with an appropriate debug message; if
it does, then it's converted into the appropriate type of GJS_JS_ERROR.
</pre>
</div>
</content>
</entry>
</feed>
