After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 690688 - Miscellaneuous fixes to gi/object.c
Miscellaneuous fixes to gi/object.c
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2012-12-24 01:25 UTC by Giovanni Campagna
Modified: 2015-10-27 23:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
object: mark a number of debug and error path as LIKELY/UNLIKELY as appropriate (15.88 KB, patch)
2012-12-24 01:26 UTC, Giovanni Campagna
needs-work Details | Review
object: stop checking for a number of impossible conditions (5.16 KB, patch)
2012-12-24 01:26 UTC, Giovanni Campagna
committed Details | Review
object: use g_signal_connect_closure_by_id (1.18 KB, patch)
2012-12-24 01:26 UTC, Giovanni Campagna
committed Details | Review
object: typecheck the object passed to _init (896 bytes, patch)
2012-12-24 01:26 UTC, Giovanni Campagna
committed Details | Review
object: remove support for multiple JSRuntimes (2.50 KB, patch)
2012-12-24 01:26 UTC, Giovanni Campagna
committed Details | Review
object: mark a number of debug and error path as LIKELY/UNLIKELY as appropriate (13.96 KB, patch)
2012-12-27 19:05 UTC, Giovanni Campagna
none Details | Review
object: consolidate code to resolve methods without introspection (2.32 KB, patch)
2012-12-27 19:06 UTC, Giovanni Campagna
committed Details | Review

Description Giovanni Campagna 2012-12-24 01:25:40 UTC
Mostly micro-optimizations caught while working on bug 690450
Comment 1 Giovanni Campagna 2012-12-24 01:26:00 UTC
Created attachment 232178 [details] [review]
object: mark a number of debug and error path as LIKELY/UNLIKELY as appropriate

Marking conditional expression with branch probabilities should help the
compiler optimize for the common case, even without actual profile feedback.
Comment 2 Giovanni Campagna 2012-12-24 01:26:08 UTC
Created attachment 232179 [details] [review]
object: stop checking for a number of impossible conditions

We were checking and trying to resume from a few impossible conditions,
that are indicative from a gjs bug. It's better to just assert here,
so the error is caught early and the check is removed in optimized builds.
Comment 3 Giovanni Campagna 2012-12-24 01:26:15 UTC
Created attachment 232180 [details] [review]
object: use g_signal_connect_closure_by_id

We parse the signal name few lines earlier, we might just as well use
the parsed id.
Comment 4 Giovanni Campagna 2012-12-24 01:26:22 UTC
Created attachment 232181 [details] [review]
object: typecheck the object passed to _init

While unlikely and generally a programmer error, calling GObject.Object.prototype._init
with a this argument that is not a GObject should not assert but only
throw.
Comment 5 Giovanni Campagna 2012-12-24 01:26:30 UTC
Created attachment 232182 [details] [review]
object: remove support for multiple JSRuntimes

That support will never happen, and removing that code allows us
to replace g_object_get_data with a faster g_object_get_qdata.
Comment 6 Jasper St. Pierre (not reading bugmail) 2012-12-24 02:15:23 UTC
Review of attachment 232178 [details] [review]:

I'd be cautious about this. It's *really* bad if we have a miss with one of these, and branch prediction should work in most cases.

::: gi/object.c
@@ -596,3 @@
-        GType *interfaces;
-        guint n_interfaces;
-        guint i;

this large deletion needs to be a separate patch, if it was intentional.

it's breaking interface lookup, so i assume the comment needs fixing.
Comment 7 Jasper St. Pierre (not reading bugmail) 2012-12-24 02:15:35 UTC
Review of attachment 232179 [details] [review]:

OK.
Comment 8 Jasper St. Pierre (not reading bugmail) 2012-12-24 02:15:55 UTC
Review of attachment 232180 [details] [review]:

OK.
Comment 9 Jasper St. Pierre (not reading bugmail) 2012-12-24 02:16:07 UTC
Review of attachment 232181 [details] [review]:

OK.
Comment 10 Jasper St. Pierre (not reading bugmail) 2012-12-24 02:16:22 UTC
Review of attachment 232182 [details] [review]:

Sure.
Comment 11 Giovanni Campagna 2012-12-27 19:05:48 UTC
Created attachment 232290 [details] [review]
object: mark a number of debug and error path as LIKELY/UNLIKELY as appropriate

Marking conditional expression with branch probabilities should help the
compiler optimize for the common case, even without actual profile feedback.
Comment 12 Giovanni Campagna 2012-12-27 19:06:17 UTC
Created attachment 232291 [details] [review]
object: consolidate code to resolve methods without introspection

The code that attempted to find a method using GType interfaces and
the code that resolved methods for classes without all introspection
info is the same. Consolidate it and reduce instruction cache
pressure.
Comment 13 Giovanni Campagna 2012-12-27 19:23:54 UTC
Attachment 232179 [details] pushed as 0a0a6d4 - object: stop checking for a number of impossible conditions
Attachment 232180 [details] pushed as 412cb8d - object: use g_signal_connect_closure_by_id
Attachment 232181 [details] pushed as 22cbe54 - object: typecheck the object passed to _init
Attachment 232182 [details] pushed as c1bcc19 - object: remove support for multiple JSRuntimes
Comment 14 Jasper St. Pierre (not reading bugmail) 2012-12-28 00:10:35 UTC
Review of attachment 232291 [details] [review]:

OK.
Comment 15 Giovanni Campagna 2012-12-28 00:29:27 UTC
Comment on attachment 232291 [details] [review]
object: consolidate code to resolve methods without introspection

Attachment 232291 [details] pushed as ef9a05a - object: consolidate code to resolve methods without introspection
Comment 16 Cosimo Cecchi 2015-10-27 23:04:38 UTC
Not going to push the LIKELY/UNLIKELY patch at this point. It's also dubious it would really help.
Closing this one as FIXED.