Commit bd56950b authored by Simon McVittie's avatar Simon McVittie

New upstream version 1.52.4

parents 0e5fae5e 45f3d1b6
Version 1.52.4
--------------
- Closed bugs and merge requests:
* `ARGV` encoding issues [#22, !108, Evan Welsh]
* Segfault on enumeration of GjSFileImporter properties when a searchpath
entry contains a symlink [#154, !144, Ole Jørgen Brønner]
* Possible refcounting bug around GtkListbox signal handlers [#24, !154,
Philip Chimento]
* Fix up GJS_DISABLE_JIT flag now the JIT is enabled by default in
SpiderMonkey [!159, Christopher Wheeldon]
* Expose GObject static property symbols. [!197, Evan Welsh]
* Do not run linters on tagged commits [!181, Claudio André]
* gjs-1.52.0 fails to compile against x86_64 musl systems [#132, !214, Philip
Chimento]
* gjs no longer builds after recent autoconf-archive updates [#149, !217,
Philip Chimento]
Version 1.52.3
--------------
- Closed bugs and merge requests:
* Include calc.js example from Seed [!130, William Barath, Philip Chimento]
* CI: Un-pin the Fedora Docker image [#141, !131, Claudio André]
* Reduce overhead of wrapped objects [#142, !121, Carlos Garnacho, Philip
Chimento]
* Various CI changes [!134, !136, Claudio André]
Version 1.52.2
--------------
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for gjs 1.52.2.
# Generated by GNU Autoconf 2.69 for gjs 1.52.4.
#
# Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=gjs>.
#
......@@ -591,8 +591,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='gjs'
PACKAGE_TARNAME='gjs'
PACKAGE_VERSION='1.52.2'
PACKAGE_STRING='gjs 1.52.2'
PACKAGE_VERSION='1.52.4'
PACKAGE_STRING='gjs 1.52.4'
PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=gjs'
PACKAGE_URL='https://wiki.gnome.org/Projects/Gjs'
......@@ -1451,7 +1451,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures gjs 1.52.2 to adapt to many kinds of systems.
\`configure' configures gjs 1.52.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1521,7 +1521,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of gjs 1.52.2:";;
short | recursive ) echo "Configuration of gjs 1.52.4:";;
esac
cat <<\_ACEOF
......@@ -1700,7 +1700,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
gjs configure 1.52.2
gjs configure 1.52.4
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -2251,7 +2251,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by gjs $as_me 1.52.2, which was
It was created by gjs $as_me 1.52.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
......@@ -3114,7 +3114,7 @@ fi
# Define the identity of the package.
PACKAGE='gjs'
VERSION='1.52.2'
VERSION='1.52.4'
cat >>confdefs.h <<_ACEOF
......@@ -3341,10 +3341,10 @@ ac_config_headers="$ac_config_headers config.h"
GJS_VERSION=15202
GJS_VERSION=15204
$as_echo "#define GJS_VERSION (1 * 100 + 52) * 100 + 2" >>confdefs.h
$as_echo "#define GJS_VERSION (1 * 100 + 52) * 100 + 4" >>confdefs.h
GETTEXT_PACKAGE=gjs
......@@ -21806,6 +21806,7 @@ fi
if test x$enable_profiler != xno; then :
# Requires timer_settime() - only on Linux
......@@ -21886,8 +21887,37 @@ done
LIBS=$gl_saved_libs
if test x$ac_cv_func_timer_settime = xno; then :
# Requires SIGEV_THREAD_ID - not in some stdlibs
have_sigev_thread_id=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux SIGEV_THREAD_ID" >&5
$as_echo_n "checking for Linux SIGEV_THREAD_ID... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <signal.h>
int
main ()
{
return SIGEV_THREAD_ID;
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
have_sigev_thread_id=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test x$ac_cv_func_timer_settime = xno -o x$have_sigev_thread_id = xno; then :
as_fn_error $? "The profiler is currently only supported on Linux.
The standard library must support timer_settime() and SIGEV_THREAD_ID.
Configure with --disable-profiler to skip it on other platforms." "$LINENO" 5
fi
......@@ -23346,7 +23376,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by gjs $as_me 1.52.2, which was
This file was extended by gjs $as_me 1.52.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -23417,7 +23447,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
gjs config.status 1.52.2
gjs config.status 1.52.4
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
......
......@@ -3,7 +3,7 @@
m4_define(pkg_major_version, 1)
m4_define(pkg_minor_version, 52)
m4_define(pkg_micro_version, 2)
m4_define(pkg_micro_version, 4)
m4_define(pkg_version, pkg_major_version.pkg_minor_version.pkg_micro_version)
m4_define(pkg_int_version, (pkg_major_version * 100 + pkg_minor_version) * 100 + pkg_micro_version)
......@@ -152,9 +152,20 @@ AS_IF([test x$have_gtk = xyes], [
AC_ARG_ENABLE([profiler],
[AS_HELP_STRING([--disable-profiler], [Don't build profiler])])
AS_IF([test x$enable_profiler != xno], [
# Requires timer_settime() - only on Linux
gl_TIMER_TIME
AS_IF([test x$ac_cv_func_timer_settime = xno],
# Requires SIGEV_THREAD_ID - not in some stdlibs
have_sigev_thread_id=no
AC_MSG_CHECKING([for Linux SIGEV_THREAD_ID])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[#include <signal.h>]], [return SIGEV_THREAD_ID;])
], [
have_sigev_thread_id=yes
AC_MSG_RESULT([yes])
], [AC_MSG_RESULT([no])])
AS_IF([test x$ac_cv_func_timer_settime = xno -o x$have_sigev_thread_id = xno],
[AC_MSG_ERROR([The profiler is currently only supported on Linux.
The standard library must support timer_settime() and SIGEV_THREAD_ID.
Configure with --disable-profiler to skip it on other platforms.])])
AC_DEFINE([ENABLE_PROFILER], [1], [Define if the profiler should be built.])
])
......
......@@ -54,6 +54,65 @@
#include <util/log.h>
#include <girepository.h>
typedef class GjsListLink GjsListLink;
typedef struct ObjectInstance ObjectInstance;
static GjsListLink* object_instance_get_link(ObjectInstance *priv);
class GjsListLink {
private:
ObjectInstance *m_prev;
ObjectInstance *m_next;
public:
ObjectInstance* prev() {
return m_prev;
}
ObjectInstance* next() {
return m_next;
}
void prepend(ObjectInstance *this_instance,
ObjectInstance *head) {
GjsListLink *elem = object_instance_get_link(head);
g_assert(object_instance_get_link(this_instance) == this);
if (elem->m_prev) {
GjsListLink *prev = object_instance_get_link(elem->m_prev);
prev->m_next = this_instance;
this->m_prev = elem->m_prev;
}
elem->m_prev = this_instance;
this->m_next = head;
}
void unlink() {
if (m_prev)
object_instance_get_link(m_prev)->m_next = m_next;
if (m_next)
object_instance_get_link(m_next)->m_prev = m_prev;
m_prev = m_next = NULL;
}
int size() {
GjsListLink *elem = this;
int count = 0;
do {
count++;
if (!elem->m_next)
break;
elem = object_instance_get_link(elem->m_next);
} while (elem);
return count;
}
};
struct ObjectInstance {
GIObjectInfo *info;
GObject *gobj; /* NULL if we are the prototype and not an instance */
......@@ -68,6 +127,8 @@ struct ObjectInstance {
prototypes) */
GTypeClass *klass;
GjsListLink instance_link;
unsigned js_object_finalized : 1;
unsigned g_object_finalized : 1;
};
......@@ -79,7 +140,7 @@ using ParamRefArray = std::vector<ParamRef>;
static std::unordered_map<GType, ParamRefArray> class_init_properties;
static bool weak_pointer_callback = false;
static std::set<ObjectInstance *> wrapped_gobject_list;
ObjectInstance *wrapped_gobject_list;
extern struct JSClass gjs_object_instance_class;
GJS_DEFINE_PRIV_FROM_JS(ObjectInstance, gjs_object_instance_class)
......@@ -755,18 +816,6 @@ object_instance_resolve(JSContext *context,
return true;
}
if (priv->g_object_finalized) {
g_critical("Object %s.%s (%p), has been already finalized. "
"Impossible to resolve it.",
priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype),
priv->gobj);
gjs_dumpstack();
*resolved = false;
return true;
}
/* If we have no GIRepository information (we're a JS GObject subclass),
* we need to look at exposing interfaces. Look up our interfaces through
* GType data, and then hope that *those* are introspectable. */
......@@ -945,6 +994,28 @@ object_instance_props_to_g_parameters(JSContext *context,
return true;
}
static GjsListLink *
object_instance_get_link(ObjectInstance *priv)
{
return &priv->instance_link;
}
static void
object_instance_unlink(ObjectInstance *priv)
{
if (wrapped_gobject_list == priv)
wrapped_gobject_list = priv->instance_link.next();
priv->instance_link.unlink();
}
static void
object_instance_link(ObjectInstance *priv)
{
if (wrapped_gobject_list)
priv->instance_link.prepend(priv, wrapped_gobject_list);
wrapped_gobject_list = priv;
}
static void
wrapped_gobj_dispose_notify(gpointer data,
GObject *where_the_object_was)
......@@ -952,7 +1023,7 @@ wrapped_gobj_dispose_notify(gpointer data,
auto *priv = static_cast<ObjectInstance *>(data);
priv->g_object_finalized = true;
wrapped_gobject_list.erase(priv);
object_instance_unlink(priv);
gjs_debug_lifecycle(GJS_DEBUG_GOBJECT, "Wrapped GObject %p disposed",
where_the_object_was);
}
......@@ -971,7 +1042,7 @@ gobj_no_longer_kept_alive_func(JS::HandleObject obj,
G_OBJECT_TYPE_NAME(priv->gobj));
priv->keep_alive.reset();
wrapped_gobject_list.erase(priv);
object_instance_unlink(priv);
}
static void
......@@ -1156,14 +1227,15 @@ gjs_object_prepare_shutdown(void)
* toggle ref removal -> gobj dispose -> toggle ref notify
* by emptying the toggle queue earlier in the shutdown sequence. */
std::vector<ObjectInstance *> to_be_released;
for (auto iter = wrapped_gobject_list.begin(); iter != wrapped_gobject_list.end(); ) {
ObjectInstance *priv = *iter;
if (priv->keep_alive.rooted()) {
to_be_released.push_back(priv);
iter = wrapped_gobject_list.erase(iter);
} else {
iter++;
ObjectInstance *link = wrapped_gobject_list;
while (link) {
ObjectInstance *next = link->instance_link.next();
if (link->keep_alive.rooted()) {
to_be_released.push_back(link);
object_instance_unlink(link);
}
link = next;
}
for (ObjectInstance *priv : to_be_released)
release_native_object(priv);
......@@ -1209,16 +1281,17 @@ update_heap_wrapper_weak_pointers(JSContext *cx,
{
gjs_debug_lifecycle(GJS_DEBUG_GOBJECT, "Weak pointer update callback, "
"%zu wrapped GObject(s) to examine",
wrapped_gobject_list.size());
wrapped_gobject_list->instance_link.size());
std::vector<GObject *> to_be_disassociated;
ObjectInstance *priv = wrapped_gobject_list;
for (auto iter = wrapped_gobject_list.begin(); iter != wrapped_gobject_list.end(); ) {
ObjectInstance *priv = *iter;
if (priv->keep_alive.rooted() || priv->keep_alive == nullptr ||
!priv->keep_alive.update_after_gc()) {
iter++;
} else {
while (priv) {
ObjectInstance *next = priv->instance_link.next();
if (!priv->keep_alive.rooted() &&
priv->keep_alive != nullptr &&
priv->keep_alive.update_after_gc()) {
/* Ouch, the JS object is dead already. Disassociate the
* GObject and hope the GObject dies too. (Remove it from
* the weak pointer list first, since the disassociation
......@@ -1229,8 +1302,10 @@ update_heap_wrapper_weak_pointers(JSContext *cx,
"%p (%s)", priv->keep_alive.get(), priv->gobj,
G_OBJECT_TYPE_NAME(priv->gobj));
to_be_disassociated.push_back(priv->gobj);
iter = wrapped_gobject_list.erase(iter);
object_instance_unlink(priv);
}
priv = next;
}
for (GObject *gobj : to_be_disassociated)
......@@ -1263,7 +1338,7 @@ associate_js_gobject (JSContext *context,
set_object_qdata(gobj, priv);
ensure_weak_pointer_callback(context);
wrapped_gobject_list.insert(priv);
object_instance_link(priv);
g_object_weak_ref(gobj, wrapped_gobj_dispose_notify, priv);
......@@ -1463,15 +1538,6 @@ object_instance_trace(JSTracer *tracer,
if (priv == NULL)
return;
if (priv->g_object_finalized) {
g_debug("Object %s.%s (%p), has been already finalized. "
"Impossible to trace it.",
priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype),
priv->gobj);
return;
}
for (GClosure *closure : priv->closures)
gjs_closure_trace(closure, tracer);
}
......@@ -1541,7 +1607,7 @@ object_instance_finalize(JSFreeOp *fop,
priv->keep_alive.reset();
}
wrapped_gobject_list.erase(priv);
object_instance_unlink(priv);
if (priv->info) {
g_base_info_unref( (GIBaseInfo*) priv->info);
......@@ -2142,6 +2208,19 @@ gjs_g_object_from_object(JSContext *context,
return NULL;
priv = priv_from_js(context, obj);
if (priv->g_object_finalized) {
g_critical("Object %s.%s (%p), has been already deallocated - "
"impossible to access it. This might be caused by the "
"object having been destroyed from C code using something "
"such as destroy(), dispose(), or remove() vfuncs",
priv->info ? g_base_info_get_namespace(priv->info) : "",
priv->info ? g_base_info_get_name(priv->info) : g_type_name(priv->gtype),
priv->gobj);
gjs_dumpstack();
return nullptr;
}
return priv->gobj;
}
......@@ -2188,19 +2267,7 @@ gjs_typecheck_object(JSContext *context,
return false;
}
if (priv->g_object_finalized) {
g_critical("Object %s.%s (%p), has been already deallocated - impossible to access to it. "
"This might be caused by the fact that the object has been destroyed from C "
"code using something such as destroy(), dispose(), or remove() vfuncs",
priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
priv->info ? g_base_info_get_name( (GIBaseInfo*) priv->info) : g_type_name(priv->gtype),
priv->gobj);
gjs_dumpstack();
return true;
}
g_assert(priv->gtype == G_OBJECT_TYPE(priv->gobj));
g_assert(priv->g_object_finalized || priv->gtype == G_OBJECT_TYPE(priv->gobj));
if (expected_type != G_TYPE_NONE)
result = g_type_is_a (priv->gtype, expected_type);
......
......@@ -308,13 +308,14 @@ gjs_create_js_context(GjsContext *js_context)
JS::ContextOptionsRef(cx).setExtraWarnings(true);
}
if (!g_getenv("GJS_DISABLE_JIT")) {
bool enable_jit = !(g_getenv("GJS_DISABLE_JIT"));
if (enable_jit) {
gjs_debug(GJS_DEBUG_CONTEXT, "Enabling JIT");
JS::ContextOptionsRef(cx)
.setIon(true)
.setBaseline(true)
.setAsmJS(true);
}
JS::ContextOptionsRef(cx)
.setIon(enable_jit)
.setBaseline(enable_jit)
.setAsmJS(enable_jit);
return cx;
}
......@@ -706,7 +706,7 @@ importer_enumerate(JSContext *context,
/* new_for_commandline_arg handles resource:/// paths */
GjsAutoUnref<GFile> dir = g_file_new_for_commandline_arg(dirname);
GjsAutoUnref<GFileEnumerator> direnum =
g_file_enumerate_children(dir, G_FILE_ATTRIBUTE_STANDARD_TYPE,
g_file_enumerate_children(dir, "standard::name,standard::type",
G_FILE_QUERY_INFO_NONE, NULL, NULL);
while (true) {
......
......@@ -219,6 +219,7 @@ public:
return m_root->get() == nullptr;
return m_heap.unbarrieredGet() == nullptr;
}
inline bool operator!=(std::nullptr_t) const { return !(*this == nullptr); }
/* You can get a Handle<T> if the thing is rooted, so that you can use this
* wrapper with stack rooting. However, you must not do this if the
......
......@@ -313,8 +313,9 @@ gjs_build_string_array(JSContext *context,
g_error("Unable to reserve memory for vector");
for (i = 0; i < array_length; ++i) {
JS::ConstUTF8CharsZ chars(array_values[i], strlen(array_values[i]));
JS::RootedValue element(context,
JS::StringValue(JS_NewStringCopyZ(context, array_values[i])));
JS::StringValue(JS_NewStringCopyUTF8Z(context, chars)));
if (!elems.append(element))
g_error("Unable to append to vector");
}
......
......@@ -28,12 +28,12 @@
#ifdef G_OS_WIN32
# ifdef GJS_COMPILATION
# define GJS_EXPORT __declspec(dllexport)
# define GJS_EXPORT __attribute__((visibility("default"))) __declspec(dllexport)
# else
# define GJS_EXPORT __declspec(dllimport)
# define GJS_EXPORT __attribute__((visibility("default"))) __declspec(dllimport)
# endif
#else
# define GJS_EXPORT
# define GJS_EXPORT __attribute__((visibility("default")))
#endif
#endif /* GJS_MACROS_H */
......@@ -441,6 +441,14 @@ function _init() {
GObject._children = _children;
GObject._internalChildren = _internalChildren;
// Expose GObject static properties for ES6 classes
GObject.GTypeName = GTypeName;
GObject.requires = requires;
GObject.interfaces = interfaces;
GObject.properties = properties;
GObject.signals = signals;
// fake enum for signal accumulators, keep in sync with gi/object.c
this.AccumulatorType = {
NONE: 0,
......
......@@ -13,7 +13,7 @@
#define GETTEXT_PACKAGE "gjs"
/* The gjs version as an integer */
#define GJS_VERSION 15202
#define GJS_VERSION 15204
/* define if the compiler supports basic C++11 syntax */
#define HAVE_CXX11 1
......@@ -74,7 +74,7 @@
#define PACKAGE_NAME "gjs"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "gjs 1.52.2"
#define PACKAGE_STRING "gjs 1.52.4"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "gjs"
......@@ -83,10 +83,10 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.52.2"
#define PACKAGE_VERSION "1.52.4"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "1.52.2"
#define VERSION "1.52.4"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment