Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package moarvm for openSUSE:Factory checked 
in at 2021-07-10 22:54:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/moarvm (Old)
 and      /work/SRC/openSUSE:Factory/.moarvm.new.2625 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "moarvm"

Sat Jul 10 22:54:47 2021 rev:30 rq:905573 version:2021.06

Changes:
--------
--- /work/SRC/openSUSE:Factory/moarvm/moarvm.changes    2021-06-01 
10:35:33.296618263 +0200
+++ /work/SRC/openSUSE:Factory/.moarvm.new.2625/moarvm.changes  2021-07-10 
22:55:19.767375600 +0200
@@ -1,0 +2,9 @@
+Sat Jul 10 15:45:40 CEST 2021 - [email protected]
+
+- update to version 2021.06
+
++ Set sc.idx during deserialization to avoid costly lookup later
++ Try to trap concurrent hash accesses
++ Fix a case of heap-use-after-free rarely affecting 
`t/spec/S17-promise/nonblocking-await.t`
+
+-------------------------------------------------------------------

Old:
----
  MoarVM-2021.05.tar.gz

New:
----
  MoarVM-2021.06.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ moarvm.spec ++++++
--- /var/tmp/diff_new_pack.HwqkMb/_old  2021-07-10 22:55:20.295371525 +0200
+++ /var/tmp/diff_new_pack.HwqkMb/_new  2021-07-10 22:55:20.295371525 +0200
@@ -16,7 +16,7 @@
 #
 
 
-%global mvrel 2021.05
+%global mvrel 2021.06
 Name:           moarvm
 Version:        %mvrel
 Release:        2.1

++++++ MoarVM-2021.05.tar.gz -> MoarVM-2021.06.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MoarVM-2021.05/Configure.pl 
new/MoarVM-2021.06/Configure.pl
--- old/MoarVM-2021.05/Configure.pl     2021-05-22 19:06:34.000000000 +0200
+++ new/MoarVM-2021.06/Configure.pl     2021-06-19 16:36:27.000000000 +0200
@@ -222,6 +222,8 @@
 # Set the remaining ldmiscflags. Do this after probing for gcc -Werror probe 
to not miss that change for the linker.
 $config{ldmiscflags}  = $config{ccmiscflags} unless defined 
$config{ldmiscflags};
 
+# Include paths that NQP/Rakudo are going to need in their build.
+my @hllincludes = qw( moar );
 
 if ($args{'has-sha'}) {
     $config{shaincludedir} = '/usr/include/sha';
@@ -230,7 +232,7 @@
 }
 else { $config{shaincludedir} = '3rdparty/sha1' }
 
-# After upgrading from libuv from 0.11.18 to 0.11.29 we see very weird erros
+# After upgrading from libuv from 0.11.18 to 0.11.29 we see very weird errors
 # when the old libuv files are still around. Running a `make realclean` in
 # case we spot an old file and the Makefile is already there.
 if (-e '3rdparty/libuv/src/unix/threadpool' . $defaults{obj}
@@ -268,6 +270,7 @@
                         . "\t\$(MKPATH) 
\"\$(DESTDIR)\$(PREFIX)/include/libuv/uv\"\n"
                         . "\t\$(CP) 3rdparty/libuv/include/*.h 
\"\$(DESTDIR)\$(PREFIX)/include/libuv\"\n"
                         . "\t\$(CP) 3rdparty/libuv/include/uv/*.h 
\"\$(DESTDIR)\$(PREFIX)/include/libuv/uv\"\n";
+    push @hllincludes, 'libuv';
 }
 
 if ($args{'has-libatomic_ops'}) {
@@ -297,6 +300,7 @@
                         . "\t\$(CP) 
3rdparty/libatomicops/src/atomic_ops/sysdeps/loadstore/*.h 
\"$lao/atomic_ops/sysdeps/loadstore\"\n"
                         . "\t\$(CP) 
3rdparty/libatomicops/src/atomic_ops/sysdeps/msftc/*.h 
\"$lao/atomic_ops/sysdeps/msftc\"\n"
                         . "\t\$(CP) 
3rdparty/libatomicops/src/atomic_ops/sysdeps/sunc/*.h 
\"$lao/atomic_ops/sysdeps/sunc\"\n";
+    push @hllincludes, 'libatomic_ops';
 }
 
 if ($args{'has-libtommath'}) {
@@ -315,6 +319,7 @@
     $config{moar_cincludes} .= ' ' . $defaults{ccinc} . '3rdparty/libtommath';
     $config{install}   .= "\t\$(MKPATH) 
\"\$(DESTDIR)\$(PREFIX)/include/libtommath\"\n"
                         . "\t\$(CP) 3rdparty/libtommath/*.h 
\"\$(DESTDIR)\$(PREFIX)/include/libtommath\"\n";
+    push @hllincludes, 'libtommath';
 }
 
 if ($args{'has-libffi'}) {
@@ -362,6 +367,7 @@
                         . "\t\$(CP) 3rdparty/dyncall/dynload/*.h 
\"\$(DESTDIR)\$(PREFIX)/include/dyncall\"\n"
                         . "\t\$(CP) 3rdparty/dyncall/dyncall/*.h 
\"\$(DESTDIR)\$(PREFIX)/include/dyncall\"\n"
                         . "\t\$(CP) 3rdparty/dyncall/dyncallback/*.h 
\"\$(DESTDIR)\$(PREFIX)/include/dyncall\"\n";
+    push @hllincludes, 'dyncall';
 }
 
 # The ZSTD_CStream API is only exposed starting at version 1.0.0
@@ -432,6 +438,17 @@
 push @cflags, '-DMVM_HEAPSNAPSHOT_FORMAT=' . $config{heapsnapformat};
 push @cflags, $ENV{CFLAGS} if $ENV{CFLAGS};
 push @cflags, $ENV{CPPFLAGS} if $ENV{CPPFLAGS};
+
+# Define _GNU_SOURCE for libuv to quell warnings with gcc.
+# According to the libuv developers, they define _GNU_SOURCE for
+# Linux use. Our code was showing warnings from libuv
+# because we did not. Adding -D_GNU_SOURCE conditionally
+# to our build then resulted in redefinition warnings in
+# our code for three of our files that already have that definition.
+# The fix was to bracket those definitions with
+# #ifdef _GNU_SOURCE/#endif.
+push @cflags, '-D_GNU_SOURCE' unless $args{'has-libuv'};
+
 $config{cflags} = join ' ', uniq(@cflags);
 
 # generate LDFLAGS
@@ -581,6 +598,7 @@
 if ($config{cc} eq 'cl') {
     $config{install}   .= "\t\$(MKPATH) 
\"\$(DESTDIR)\$(PREFIX)/include/msinttypes\"\n"
                         . "\t\$(CP) 3rdparty/msinttypes/*.h 
\"\$(DESTDIR)\$(PREFIX)/include/msinttypes\"\n";
+    push @hllincludes, 'msinttypes';
 }
 
 if ($^O eq 'aix' && $config{ptr_size} == 4) {
@@ -675,6 +693,10 @@
 
 print "OK\n";
 
+# the parser for config values used in the NQP/Rakudo build doesn't understand 
arrays,
+# so just join into a single string
+$config{hllincludes} = join " ", @hllincludes;
+
 write_backend_config();
 
 # dump 3rdparty libs we need to build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MoarVM-2021.05/README.markdown 
new/MoarVM-2021.06/README.markdown
--- old/MoarVM-2021.05/README.markdown  2021-05-22 19:06:34.000000000 +0200
+++ new/MoarVM-2021.06/README.markdown  2021-06-19 16:36:27.000000000 +0200
@@ -113,3 +113,7 @@
 If you _want_ to use a GNU toolchain, and you get an error telling you to see 
this file, simply supply the `--toolchain=gnu` flag and this package will 
configure and build with a GNU toolchain.
 
 **Please note:** If you use mixed Xcode and non-Xcode tools, you are likely to 
run into trouble. As such, this configuration is unsupported.
+
+### You need different code for `gcc` versus `clang`
+
+Note both compilers define macro `__GNUC__`, so macro `__clang__` needs to be 
tested first to disambiguate the two.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MoarVM-2021.05/VERSION new/MoarVM-2021.06/VERSION
--- old/MoarVM-2021.05/VERSION  2021-05-22 19:06:34.000000000 +0200
+++ new/MoarVM-2021.06/VERSION  2021-06-19 16:36:27.000000000 +0200
@@ -1 +1 @@
-2021.05
+2021.06
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MoarVM-2021.05/docs/ChangeLog 
new/MoarVM-2021.06/docs/ChangeLog
--- old/MoarVM-2021.05/docs/ChangeLog   2021-05-22 19:06:34.000000000 +0200
+++ new/MoarVM-2021.06/docs/ChangeLog   2021-06-19 16:36:27.000000000 +0200
@@ -1,3 +1,18 @@
+New in 2021.06
+
+6model:
++ [0d63ddad] Set `sc.idx` during deserialization to avoid costly lookup later
+
+Core:
++ [5ba30ed8,ae024a49,d8a16dfd,77756158] Try to trap concurrent hash accesses
++ [c53c0cdb] Fix a case of heap-use-after-free rarely affecting 
`t/spec/S17-promise/nonblocking-await.t`
+
+Tooling/Build:
++ [9b7ab7c4] Put include paths needed for HLL builds in config
++ [91b1ccf6,bb767ece,192ea6bb] Define _GNU_SOURCE for GNU builds
++ [12cbafce] Disable GCC pragmas when using MSVC
++ [4751ca6d] Add note about macro confusion between gcc and clang
+
 New in 2021.05
 
 Core:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MoarVM-2021.05/src/6model/serialization.c 
new/MoarVM-2021.06/src/6model/serialization.c
--- old/MoarVM-2021.05/src/6model/serialization.c       2021-05-22 
19:06:34.000000000 +0200
+++ new/MoarVM-2021.06/src/6model/serialization.c       2021-06-19 
16:36:27.000000000 +0200
@@ -2283,6 +2283,7 @@
 
     /* Set the STable's SC. */
     MVM_sc_set_stable_sc(tc, st, reader->root.sc);
+    MVM_sc_set_idx_in_sc((MVMCollectable*) st, i);
 
     /* Set STable read position, and set current read buffer to the
      * location of the REPR data. */
@@ -2356,6 +2357,7 @@
 
     /* Set the object's SC. */
     MVM_sc_set_obj_sc(tc, obj, reader->root.sc);
+    MVM_sc_set_idx_in_sc((MVMCollectable*)obj, i);
 }
 
 /* Deserializes a context. */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MoarVM-2021.05/src/core/frame.c 
new/MoarVM-2021.06/src/core/frame.c
--- old/MoarVM-2021.05/src/core/frame.c 2021-05-22 19:06:34.000000000 +0200
+++ new/MoarVM-2021.06/src/core/frame.c 2021-06-19 16:36:27.000000000 +0200
@@ -882,7 +882,7 @@
         /* Preserve the extras if the frame has been used in a ctx operation
          * and marked with caller info. */
         if (!(e->caller_deopt_idx || e->caller_jit_position)) {
-            MVM_fixed_size_free(tc, tc->instance->fsa, sizeof(MVMFrameExtra), 
e);
+            MVM_fixed_size_free_at_safepoint(tc, tc->instance->fsa, 
sizeof(MVMFrameExtra), e);
             returner->extra = NULL;
         }
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MoarVM-2021.05/src/core/str_hash_table.c 
new/MoarVM-2021.06/src/core/str_hash_table.c
--- old/MoarVM-2021.05/src/core/str_hash_table.c        2021-05-22 
19:06:34.000000000 +0200
+++ new/MoarVM-2021.06/src/core/str_hash_table.c        2021-06-19 
16:36:27.000000000 +0200
@@ -40,7 +40,7 @@
 
     size_t total_size
         = entries_size + sizeof(struct MVMStrHashTableControl) + metadata_size;
-    MVM_fixed_size_free(tc, tc->instance->fsa, total_size, start);
+    MVM_fixed_size_free_at_safepoint(tc, tc->instance->fsa, total_size, start);
 }
 
 /* Frees the entire contents of the hash, leaving you just the hashtable 
itself,
@@ -49,6 +49,10 @@
     struct MVMStrHashTableControl *control = hashtable->table;
     if (!control)
         return;
+    if (MVM_UNLIKELY(control->stale)) {
+        MVM_oops(tc, "MVM_str_hash_demolish called with a stale hashtable 
pointer");
+    }
+
     hash_demolish_internal(tc, control);
     hashtable->table = NULL;
 }
@@ -141,6 +145,7 @@
     control->max_probe_distance_limit = max_probe_distance_limit;
     control->key_right_shift = key_right_shift;
     control->entry_size = entry_size;
+    control->stale = 0;
 
     MVMuint8 *metadata = (MVMuint8 *)(control + 1);
     memset(metadata, 0, metadata_size);
@@ -328,6 +333,8 @@
          * the first entry. Which implies that we've had no insertions or
          * deletions prior to this, hence our debugging state must be (0, 0) */
         struct MVMStrHashTableControl *control_orig = control;
+
+        control_orig->stale = 1;
         control = hash_allocate_common(tc,
                                        control_orig->entry_size,
                                        (8 * sizeof(MVMuint64) - 
STR_MIN_SIZE_BASE_2),
@@ -339,7 +346,7 @@
         control->serial = 0;
         control->last_delete_at = 0;
 #endif
-        MVM_fixed_size_free(tc, tc->instance->fsa, sizeof(*control_orig), 
control_orig);
+        MVM_fixed_size_free_at_safepoint(tc, tc->instance->fsa, 
sizeof(*control_orig), control_orig);
         return control;
     }
 
@@ -395,6 +402,7 @@
 
     struct MVMStrHashTableControl *control_orig = control;
 
+    control_orig->stale = 1;
     control = hash_allocate_common(tc,
                                    entry_size,
                                    control_orig->key_right_shift - 1,
@@ -458,6 +466,9 @@
     if (MVM_UNLIKELY(!control)) {
         MVM_oops(tc, "Attempting insert on MVM_str_hash without first calling 
MVM_str_hash_build");
     }
+    else if (MVM_UNLIKELY(control->stale)) {
+        MVM_oops(tc, "MVM_str_hash_lvalue_fetch_nocheck called with a stale 
hashtable pointer");
+    }
     else if (MVM_UNLIKELY(control->cur_items >= control->max_items)) {
         /* We should avoid growing the hash if we don't need to.
          * It's expensive, and for hashes with iterators, growing the hash
@@ -465,20 +476,32 @@
          * need to create a key. */
         struct MVMStrHashHandle *entry = MVM_str_hash_fetch_nocheck(tc, 
hashtable, key);
         if (entry) {
+            if (MVM_UNLIKELY(control->stale)) {
+                MVM_oops(tc, "MVM_str_hash_lvalue_fetch_nocheck called with a 
hashtable pointer that turned stale");
+            }
             return entry;
         }
 
         struct MVMStrHashTableControl *new_control = maybe_grow_hash(tc, 
control);
         if (new_control) {
-            /* We could unconditionally assign this, but that would mean CPU
-             * cache writes even when it was unchanged, and the address of
-             * hashtable will not be in the same cache lines as we are writing
-             * for the hash internals, so it will churn the write cache. */
-            hashtable->table = control = new_control;
+            if (!MVM_trycas(&(hashtable->table), control, new_control)) {
+                /* Oh erk, a second thread has just executed this code on this
+                 * hashtable, allocated a new control structure, and both it 
and
+                 * us have passed the old control structure back to the FSA.
+                 * So we have a double free pending at the next safe point, and
+                 * who knows what else is racing uncontrolled on this hash.
+                 * Bad programmer, no cookie. */
+                MVM_oops(tc, "MVM_str_hash_lvalue_fetch_nocheck called 
concurrently on the same hash");
+            }
+            control = new_control;
         }
     }
 
-    return hash_insert_internal(tc, control, key);
+    void *result = hash_insert_internal(tc, control, key);
+    if (MVM_UNLIKELY(control->stale)) {
+        MVM_oops(tc, "MVM_str_hash_lvalue_fetch_nocheck called with a 
hashtable pointer that turned stale");
+    }
+    return result;
 }
 
 /* UNCONDITIONALLY creates a new hash entry with the given key and value.
@@ -505,11 +528,15 @@
 void MVM_str_hash_delete_nocheck(MVMThreadContext *tc,
                                  MVMStrHashTable *hashtable,
                                  MVMString *key) {
+    struct MVMStrHashTableControl *control = hashtable->table;
+
+    if (MVM_UNLIKELY(control && control->stale)) {
+        MVM_oops(tc, "MVM_str_hash_delete_nocheck called with a stale 
hashtable pointer");
+    }
     if (MVM_str_hash_is_empty(tc, hashtable)) {
         return;
     }
 
-    struct MVMStrHashTableControl *control = hashtable->table;
     struct MVM_hash_loop_state ls = MVM_str_hash_create_loop_state(tc, 
control, key);
 
     while (1) {
@@ -645,6 +672,10 @@
                 control->last_delete_at = 1 + ls.metadata - 
MVM_str_hash_metadata(control);
 #endif
 
+                if (MVM_UNLIKELY(control->stale)) {
+                    MVM_oops(tc, "MVM_str_hash_delete_nocheck called with a 
hashtable pointer that turned stale");
+                }
+
                 /* Job's a good 'un. */
                 return;
             }
@@ -657,6 +688,11 @@
                the hash table - it would have stolen this slot, and the key we
                find here now would have been displaced further on. Hence, the 
key
                we seek can't be in the hash table. */
+
+            if (MVM_UNLIKELY(control->stale)) {
+                MVM_oops(tc, "MVM_str_hash_delete_nocheck called with a 
hashtable pointer that turned stale");
+            }
+
             return;
         }
         ls.probe_distance += ls.metadata_increment;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MoarVM-2021.05/src/core/str_hash_table.h 
new/MoarVM-2021.06/src/core/str_hash_table.h
--- old/MoarVM-2021.05/src/core/str_hash_table.h        2021-05-22 
19:06:34.000000000 +0200
+++ new/MoarVM-2021.06/src/core/str_hash_table.h        2021-06-19 
16:36:27.000000000 +0200
@@ -439,6 +439,13 @@
      * to cache it as we have the space. */
     MVMuint8 max_probe_distance_limit;
     MVMuint8 metadata_hash_bits;
+    /* This is set to 0 when the control structure is allocated. When the hash
+     * expands (and needs a new larger allocation) this is set to 1 in the
+     * soon-to-be-freed memory, and the memory is scheduled to be released at
+     * the next safe point. This way avoid C-level use-after-free if threads
+     * attempt to mutate the same hash concurrently, and hopefully can spot at
+     * least some cases and fault them, often enough for bugs to be noticed. */
+    volatile MVMuint8 stale;
 };
 
 struct MVMStrHashTable {
@@ -467,6 +474,9 @@
      * deleted (and this is the only action on the hash since the iterator was
      * created) */
     struct MVMStrHashTableControl *control = hashtable->table;
+    if (MVM_UNLIKELY(control && control->stale)) {
+        MVM_oops(tc, "MVM_str_hash_iterator_target_deleted called with a stale 
hashtable pointer");
+    }
     return control && iterator.serial == control->serial - 1 &&
         iterator.pos == control->last_delete_at;
 }
@@ -483,6 +493,9 @@
 MVM_STATIC_INLINE int MVM_str_hash_at_end(MVMThreadContext *tc,
                                            MVMStrHashTable *hashtable,
                                            MVMStrHashIterator iterator) {
+    if (MVM_UNLIKELY(hashtable->table && hashtable->table->stale)) {
+        MVM_oops(tc, "MVM_str_hash_at_end called with a stale hashtable 
pointer");
+    }
 #if HASH_DEBUG_ITER
     struct MVMStrHashTableControl *control = hashtable->table;
     MVMuint64 ht_id = control ? control->ht_id : 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MoarVM-2021.05/src/core/str_hash_table_funcs.h 
new/MoarVM-2021.06/src/core/str_hash_table_funcs.h
--- old/MoarVM-2021.05/src/core/str_hash_table_funcs.h  2021-05-22 
19:06:34.000000000 +0200
+++ new/MoarVM-2021.06/src/core/str_hash_table_funcs.h  2021-06-19 
16:36:27.000000000 +0200
@@ -49,6 +49,10 @@
     struct MVMStrHashTableControl *control = hashtable->table;
     if (!control)
         return 0;
+    if (MVM_UNLIKELY(control->stale)) {
+        MVM_oops(tc, "MVM_str_hash_allocated_size called with a stale 
hashtable pointer");
+    }
+
     if (control->cur_items == 0 && control->max_items == 0)
         return sizeof(*control);
 
@@ -72,6 +76,9 @@
 MVM_STATIC_INLINE int MVM_str_hash_is_empty(MVMThreadContext *tc,
                                             MVMStrHashTable *hashtable) {
     struct MVMStrHashTableControl *control = hashtable->table;
+    if (MVM_UNLIKELY(control && control->stale)) {
+        MVM_oops(tc, "MVM_str_hash_is_empty called with a stale hashtable 
pointer");
+    }
     return !control || control->cur_items == 0;
 }
 
@@ -83,6 +90,9 @@
     const struct MVMStrHashTableControl *control = source->table;
     if (!control)
         return;
+    if (MVM_UNLIKELY(control->stale)) {
+        MVM_oops(tc, "MVM_str_hash_shallow_copy called with a stale hashtable 
pointer");
+    }
     if (control->cur_items == 0 && control->max_items == 0) {
         struct MVMStrHashTableControl *empty = MVM_fixed_size_alloc(tc, 
tc->instance->fsa, sizeof(*empty));
         memcpy(empty, control, sizeof(*empty));
@@ -101,6 +111,9 @@
 #if HASH_DEBUG_ITER
     dest->table->ht_id = MVM_proc_rand_i(tc);
 #endif
+    if (MVM_UNLIKELY(control->stale)) {
+        MVM_oops(tc, "MVM_str_hash_shallow_copy called with hashtable pointer 
that turned stale");
+    }
 }
 
 MVM_STATIC_INLINE MVMuint64 MVM_str_hash_code(MVMThreadContext *tc,
@@ -166,11 +179,16 @@
 MVM_STATIC_INLINE void *MVM_str_hash_fetch_nocheck(MVMThreadContext *tc,
                                                    MVMStrHashTable *hashtable,
                                                    MVMString *key) {
+    struct MVMStrHashTableControl *control = hashtable->table;
+
+    if (MVM_UNLIKELY(control && control->stale)) {
+        MVM_oops(tc, "MVM_str_hash_fetch_nocheck called with a stale hashtable 
pointer");
+    }
+
     if (MVM_str_hash_is_empty(tc, hashtable)) {
         return NULL;
     }
 
-    struct MVMStrHashTableControl *control = hashtable->table;
     struct MVM_hash_loop_state ls = MVM_str_hash_create_loop_state(tc, 
control, key);
 
     /* Comments in str_hash_table.h describe the various invariants.
@@ -259,6 +277,9 @@
                     && MVM_string_substrings_equal_nocheck(tc, key, 0,
                                                            
MVM_string_graphs_nocheck(tc, key),
                                                            entry->key, 0))) {
+                if (MVM_UNLIKELY(control->stale)) {
+                    MVM_oops(tc, "MVM_str_hash_fetch_nocheck called with a 
hashtable pointer that turned stale");
+                }
                 return entry;
             }
         }
@@ -270,6 +291,10 @@
                the hash table - it would have stolen this slot, and the key we
                find here now would have been displaced further on. Hence, the 
key
                we seek can't be in the hash table. */
+            if (MVM_UNLIKELY(control->stale)) {
+                MVM_oops(tc, "MVM_str_hash_fetch_nocheck called with a 
hashtable pointer that turned stale");
+            }
+
             return NULL;
         }
         /* This is actually the "body" of the lookup loop. gcc on 32 bit arm
@@ -382,6 +407,10 @@
                                                                MVMStrHashTable 
*hashtable,
                                                                
MVMStrHashIterator iterator) {
     struct MVMStrHashTableControl *control = hashtable->table;
+    if (MVM_UNLIKELY(control->stale)) {
+        MVM_oops(tc, "MVM_str_hash_iterator_next_nocheck called with a stale 
hashtable pointer");
+    }
+
     /* Whilst this looks like it can be optimised to word at a time skip ahead.
      * (Beware of endianness) it isn't easy *yet*, because one can overrun the
      * allocated buffer, and that makes ASAN very excited. */
@@ -438,6 +467,10 @@
         return iterator;
     }
 
+    if (MVM_UNLIKELY(control->stale)) {
+        MVM_oops(tc, "MVM_str_hash_iterator_first called with a stale 
hashtable pointer");
+    }
+
 #if HASH_DEBUG_ITER
     iterator.owner = control->ht_id;
     iterator.serial = control->serial;
@@ -470,6 +503,10 @@
         return retval;
     }
 
+    if (MVM_UNLIKELY(control->stale)) {
+        MVM_oops(tc, "MVM_str_hash_start called with a stale hashtable 
pointer");
+    }
+
 #if HASH_DEBUG_ITER
     retval.owner = control->ht_id;
     retval.serial = control->serial;
@@ -485,6 +522,11 @@
     if (MVM_UNLIKELY(!control)) {
         return iterator.pos == 1;
     }
+
+    if (MVM_UNLIKELY(control->stale)) {
+        MVM_oops(tc, "MVM_str_hash_at_start called with a stale hashtable 
pointer");
+    }
+
 #if HASH_DEBUG_ITER
     if (iterator.owner != control->ht_id) {
         MVM_oops(tc, "MVM_str_hash_at_start called with an iterator from a 
different hash table: %016" PRIx64 " != %016" PRIx64,
@@ -503,6 +545,11 @@
                                                      MVMStrHashTable 
*hashtable,
                                                      MVMStrHashIterator 
iterator) {
     struct MVMStrHashTableControl *control = hashtable->table;
+
+    if (MVM_UNLIKELY(control->stale)) {
+        MVM_oops(tc, "MVM_str_hash_current_nocheck called with a stale 
hashtable pointer");
+    }
+
     assert(MVM_str_hash_metadata(control)[iterator.pos - 1]);
     return MVM_str_hash_entries(control) - control->entry_size * (iterator.pos 
- 1);
 }
@@ -535,6 +582,11 @@
 MVM_STATIC_INLINE MVMHashNumItems MVM_str_hash_count(MVMThreadContext *tc,
                                                      MVMStrHashTable 
*hashtable) {
     struct MVMStrHashTableControl *control = hashtable->table;
+
+    if (MVM_UNLIKELY(control && control->stale)) {
+        MVM_oops(tc, "MVM_str_hash_count called with a stale hashtable 
pointer");
+    }
+
     return control ? control->cur_items : 0;
 }
 
@@ -542,5 +594,10 @@
 MVM_STATIC_INLINE MVMHashNumItems MVM_str_hash_entry_size(MVMThreadContext *tc,
                                                           MVMStrHashTable 
*hashtable) {
     struct MVMStrHashTableControl *control = hashtable->table;
+
+    if (MVM_UNLIKELY(control && control->stale)) {
+        MVM_oops(tc, "MVM_str_hash_entry_size called with a stale hashtable 
pointer");
+    }
+
     return control ? control->entry_size : 0;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MoarVM-2021.05/src/io/signals.c 
new/MoarVM-2021.06/src/io/signals.c
--- old/MoarVM-2021.05/src/io/signals.c 2021-05-22 19:06:34.000000000 +0200
+++ new/MoarVM-2021.06/src/io/signals.c 2021-06-19 16:36:27.000000000 +0200
@@ -129,12 +129,16 @@
 #define GEN_ENUMS(v)   v,
 #define GEN_STRING(v) #v,
 
+#ifndef _MSC_VER
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
 static enum {
     PROCESS_SIGS(GEN_ENUMS)
 } MVM_sig_names;
+#ifndef _MSC_VER
 #pragma GCC diagnostic pop
+#endif
 
 
 static char const * const SIG_WANTED[NUM_SIG_WANTED] = {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MoarVM-2021.05/src/jit/x64/emit.dasc 
new/MoarVM-2021.06/src/jit/x64/emit.dasc
--- old/MoarVM-2021.05/src/jit/x64/emit.dasc    2021-05-22 19:06:34.000000000 
+0200
+++ new/MoarVM-2021.06/src/jit/x64/emit.dasc    2021-06-19 16:36:27.000000000 
+0200
@@ -1,11 +1,15 @@
 /* -*-C-*- */
 #include "moar.h"
 #include "jit/internal.h"
+#ifndef _MSC_VER
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
+#endif
 #include "dasm_x86.h"
+#ifndef _MSC_VER
 #pragma GCC diagnostic pop
 #pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
 
 #ifdef _MSC_VER
 #pragma warning( disable : 4129 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MoarVM-2021.05/src/jit/x64/tiles.dasc 
new/MoarVM-2021.06/src/jit/x64/tiles.dasc
--- old/MoarVM-2021.05/src/jit/x64/tiles.dasc   2021-05-22 19:06:34.000000000 
+0200
+++ new/MoarVM-2021.06/src/jit/x64/tiles.dasc   2021-06-19 16:36:27.000000000 
+0200
@@ -1,5 +1,7 @@
 /* -*-C-*- */
+#ifndef _MSC_VER
 #pragma GCC diagnostic ignored "-Wunused-variable"
+#endif
 #define DIE(...) do { MVM_oops(tc, __VA_ARGS__); } while (0)
 
 /* NB: The rax/eax/ax/al/ah register is *reserved* for internal use in tiles by
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MoarVM-2021.05/src/moar.h 
new/MoarVM-2021.06/src/moar.h
--- old/MoarVM-2021.05/src/moar.h       2021-05-22 19:06:34.000000000 +0200
+++ new/MoarVM-2021.06/src/moar.h       2021-06-19 16:36:27.000000000 +0200
@@ -5,8 +5,10 @@
 /* pthread_setname_np only exists if we set _GNU_SOURCE extremely early.
  * We will need to be vgilant to not accidentally use gnu extensions in
  * other places without checking properly. */
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
+#endif
 
 #include <stdarg.h>
 #include <stdio.h>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MoarVM-2021.05/src/platform/memmem.h 
new/MoarVM-2021.06/src/platform/memmem.h
--- old/MoarVM-2021.05/src/platform/memmem.h    2021-05-22 19:06:34.000000000 
+0200
+++ new/MoarVM-2021.06/src/platform/memmem.h    2021-06-19 16:36:27.000000000 
+0200
@@ -12,7 +12,9 @@
 #else
 /* On systems that use glibc, you must define _GNU_SOURCE before including 
string.h
  * to get access to memmem. */
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 #include <string.h>
 #endif
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MoarVM-2021.05/src/platform/random.c 
new/MoarVM-2021.06/src/platform/random.c
--- old/MoarVM-2021.05/src/platform/random.c    2021-05-22 19:06:34.000000000 
+0200
+++ new/MoarVM-2021.06/src/platform/random.c    2021-06-19 16:36:27.000000000 
+0200
@@ -16,7 +16,9 @@
     #if defined(SYS_getrandom)
     /* With glibc you are supposed to declare _GNU_SOURCE to use the
      * syscall function */
-        #define _GNU_SOURCE
+        #ifndef _GNU_SOURCE
+            #define _GNU_SOURCE
+        #endif
         #define GRND_NONBLOCK 0x01
         #include <unistd.h>
         #define MVM_random_use_getrandom_syscall 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MoarVM-2021.05/src/profiler/heapsnapshot.c 
new/MoarVM-2021.06/src/profiler/heapsnapshot.c
--- old/MoarVM-2021.05/src/profiler/heapsnapshot.c      2021-05-22 
19:06:34.000000000 +0200
+++ new/MoarVM-2021.06/src/profiler/heapsnapshot.c      2021-06-19 
16:36:27.000000000 +0200
@@ -913,16 +913,20 @@
          * warning aside, strncpy seems like exactly the right tool for the job
          * as we want at most 8 bytes and don't care for any trailing \0, but
          * are OK with zero padding at the end. */
+#ifndef _MSC_VER
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunknown-pragmas"
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wunknown-warning-option"
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wstringop-truncation"
+#endif
         strncpy(namebuf, name, 8);
+#ifndef _MSC_VER
 #pragma GCC diagnostic pop
 #pragma clang diagnostic pop
 #pragma GCC diagnostic pop
+#endif
         fwrite(namebuf, 8, 1, fh);
     }
 

Reply via email to