<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/gjs.git/gi/function.h, 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>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>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>function: Save original allocated pointers</title>
<updated>2021-04-11T22:00:37+00:00</updated>
<author>
<name>Philip Chimento</name>
<email>philip.chimento@gmail.com</email>
</author>
<published>2021-03-12T19:20:05+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gjs.git/commit/?id=da3c0f2b1ac7b52339e12adc92fbf5e968c4eb6e'/>
<id>da3c0f2b1ac7b52339e12adc92fbf5e968c4eb6e</id>
<content type='text'>
cppcheck is not smart enough to determine that when we save an allocated
pointer plus an offset, and then free the saved pointer minus that offset,
it amounts to the same thing. But, maybe it is clearer anyway to save the
original pointers and add the offset in an accessor.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
cppcheck is not smart enough to determine that when we save an allocated
pointer plus an offset, and then free the saved pointer minus that offset,
it amounts to the same thing. But, maybe it is clearer anyway to save the
original pointers and add the offset in an accessor.
</pre>
</div>
</content>
</entry>
<entry>
<title>arg-cache: Never throw when building the argument cache</title>
<updated>2021-03-21T02:52:48+00:00</updated>
<author>
<name>Philip Chimento</name>
<email>philip.chimento@gmail.com</email>
</author>
<published>2021-03-21T02:11:26+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gjs.git/commit/?id=c641ca8752ae95e0322738f127cbcbb103a860b8'/>
<id>c641ca8752ae95e0322738f127cbcbb103a860b8</id>
<content type='text'>
Previously, the methods for building the argument cache for a function
could fail, and throw an exception. Normally this was not a problem, since
the argument cache was built when creating the Function object, and that
was generally created right before it was about to be called.

However, static methods are created eagerly when defining a type's
constructor, so if a type contained a method that would throw when
building the argument cache, then merely resolving that type would throw.
(For example, resolving `GLib.ByteArray` would throw.)

Instead, change all the argument cache building methods to be infallible.
If an argument is not supported in GJS, then its in-marshaller throws
instead. This causes the error to happen when the Function object is
called, not when it is created.

In order to give good exception messages, we add a "reason" field to the
GjsArgumentCache union, used by the new gjs_marshal_not_introspectable_in
marshaller, and a display_name() method to GjsFunctionCallState.

Closes: #386
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, the methods for building the argument cache for a function
could fail, and throw an exception. Normally this was not a problem, since
the argument cache was built when creating the Function object, and that
was generally created right before it was about to be called.

However, static methods are created eagerly when defining a type's
constructor, so if a type contained a method that would throw when
building the argument cache, then merely resolving that type would throw.
(For example, resolving `GLib.ByteArray` would throw.)

Instead, change all the argument cache building methods to be infallible.
If an argument is not supported in GJS, then its in-marshaller throws
instead. This causes the error to happen when the Function object is
called, not when it is created.

In order to give good exception messages, we add a "reason" field to the
GjsArgumentCache union, used by the new gjs_marshal_not_introspectable_in
marshaller, and a display_name() method to GjsFunctionCallState.

Closes: #386
</pre>
</div>
</content>
</entry>
<entry>
<title>function: Mark accessor methods as const</title>
<updated>2021-03-13T00:46:36+00:00</updated>
<author>
<name>Philip Chimento</name>
<email>philip.chimento@gmail.com</email>
</author>
<published>2021-03-12T19:37:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gjs.git/commit/?id=6df163acfaf1a7f71138572fd310712cbc7bc62f'/>
<id>6df163acfaf1a7f71138572fd310712cbc7bc62f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>function: Prevent copying of GjsFunctionCallState</title>
<updated>2021-03-13T00:46:30+00:00</updated>
<author>
<name>Philip Chimento</name>
<email>philip.chimento@gmail.com</email>
</author>
<published>2021-03-12T19:09:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gjs.git/commit/?id=a30da63eac6b8875e6ce51894b0d512a93bb8948'/>
<id>a30da63eac6b8875e6ce51894b0d512a93bb8948</id>
<content type='text'>
This class is meant to be allocated once, on the stack, and passed by
reference. Copying it would reallocate the in and out C-values arrays,
which would be bad.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This class is meant to be allocated once, on the stack, and passed by
reference. Copying it would reallocate the in and out C-values arrays,
which would be bad.
</pre>
</div>
</content>
</entry>
</feed>
