Skip to content

ocamldep refactors#7

Closed
MisterDA wants to merge 48 commits intotrunkfrom
ocamldep-refactors
Closed

ocamldep refactors#7
MisterDA wants to merge 48 commits intotrunkfrom
ocamldep-refactors

Conversation

@MisterDA
Copy link
Owner

No description provided.

@MisterDA MisterDA force-pushed the ocamldep-refactors branch 8 times, most recently from 21b050f to a235748 Compare September 18, 2023 14:42
fabbing and others added 22 commits September 20, 2023 15:27
Co-authored-by: Olivier Nicole <olivier@chnik.fr>
Co-authored-by: Olivier Nicole <olivier@chnik.fr>
Co-authored-by: Olivier Nicole <olivier@chnik.fr>
This conforms to the documented behavior,
and aligns `make_matrix` with the new `init_matrix`.
This aligns with the implementation of `init_matrix`, where this
short-circuit is not just an optimization, but a required test.
Co-authored-by: Fabrice Buoro <fabrice@tarides.com>
Fix crash when combining TSan and frame-pointers
Fix a typo in inheritance error message.
Move `caml_collect_gc_stats_sample` before barrier arrival
Octachron and others added 26 commits September 22, 2023 17:58
use a single name for contributions from the same person.
Changes: normalize contributor names (and fix typos)
There is currently a race on the `orph_structs` global, which is read by
`no_orphaned_work()` without being protected by the `orphaned_lock`
mutex. We will add locking inside `no_orphaned_work`, but to reduce
the performance impact we first ensure that the `orphaned_lock`
critical sections are as short as possible.
To avoid taking a lock in `no_orphaned_work()`, we make the
orph_struct fields atomic. The lock is now only used to guarantee
that the `add_*` and `adopt` operations do not race to each other.

Suggested-by: Guillaume Munch-Maccagnoni <Guillaume.Munch-Maccagnoni@inria.fr>
runtime: fix a race on the orphaning structure in major_gc.c
Reimplements the LongString module defined in utils/misc.ml on top of 1-dimension bigarrays of characters, which are a more efficient representation than the currently implemented one, based on an array of strings.
---------

Co-authored-by: Stephen Dolan <sdolan@janestreet.com>
This switches the code generation back to the usual "compare and branch"
logic used by all other native backends.
Remove the SIGTRAP-based bounds checking on POWER
This variable has been unused and write-only since its introduction in
381328e.
Replace add_to_list with prepend_to_list, to explicit where the new
element is added. Use the new combinator consistently.
@MisterDA MisterDA closed this Sep 25, 2023
@MisterDA MisterDA deleted the ocamldep-refactors branch September 25, 2023 13:13
MisterDA pushed a commit that referenced this pull request Jul 25, 2024
…l#13294)

The toplevel printer detects cycles by keeping a hashtable of values
that it has already traversed.

However, some OCaml runtime types (at least bigarrays) may be
partially uninitialized, and hashing them at arbitrary program points
may read uninitialized memory. In particular, the OCaml testsuite
fails when running with a memory-sanitizer enabled, as bigarray
printing results in reads to uninitialized memory:

```
==133712==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x4e6d11 in caml_ba_hash /var/home/edwin/git/ocaml/runtime/bigarray.c:486:45
    #1 0x52474a in caml_hash /var/home/edwin/git/ocaml/runtime/hash.c:251:35
    #2 0x599ebf in caml_interprete /var/home/edwin/git/ocaml/runtime/interp.c:1065:14
    #3 0x5a909a in caml_main /var/home/edwin/git/ocaml/runtime/startup_byt.c:575:9
    #4 0x540ccb in main /var/home/edwin/git/ocaml/runtime/main.c:37:3
    #5 0x7f0910abb087 in __libc_start_call_main (/lib64/libc.so.6+0x2a087) (BuildId: 8f53abaad945a669f2bdcd25f471d80e077568ef)
    #6 0x7f0910abb14a in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x2a14a) (BuildId: 8f53abaad945a669f2bdcd25f471d80e077568ef)
    #7 0x441804 in _start (/var/home/edwin/git/ocaml/runtime/ocamlrun+0x441804) (BuildId: 7a60eef57e1c2baf770bc38d10d6c227e60ead37)

  Uninitialized value was created by a heap allocation
    #0 0x47d306 in malloc (/var/home/edwin/git/ocaml/runtime/ocamlrun+0x47d306) (BuildId: 7a60eef57e1c2baf770bc38d10d6c227e60ead37)
    #1 0x4e7960 in caml_ba_alloc /var/home/edwin/git/ocaml/runtime/bigarray.c:246:12
    #2 0x4e801f in caml_ba_create /var/home/edwin/git/ocaml/runtime/bigarray.c:673:10
    #3 0x59b8fc in caml_interprete /var/home/edwin/git/ocaml/runtime/interp.c:1058:14
    #4 0x5a909a in caml_main /var/home/edwin/git/ocaml/runtime/startup_byt.c:575:9
    #5 0x540ccb in main /var/home/edwin/git/ocaml/runtime/main.c:37:3
    #6 0x7f0910abb087 in __libc_start_call_main (/lib64/libc.so.6+0x2a087) (BuildId: 8f53abaad945a669f2bdcd25f471d80e077568ef)
    #7 0x7f0910abb14a in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x2a14a) (BuildId: 8f53abaad945a669f2bdcd25f471d80e077568ef)
    #8 0x441804 in _start (/var/home/edwin/git/ocaml/runtime/ocamlrun+0x441804) (BuildId: 7a60eef57e1c2baf770bc38d10d6c227e60ead37)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /var/home/edwin/git/ocaml/runtime/bigarray.c:486:45 in caml_ba_hash
```

The only use of hashing in genprintval is to avoid cycles, that is, it
is only useful for OCaml values that contain other OCaml values
(including possibly themselves). Bigarrays cannot introduce cycles,
and they are always printed as "<abstr>" anyway.

The present commit proposes to be more conservative in which values
are hashed by the cycle detector to avoid this issue: we skip hashing
any value with tag above No_scan_tag -- which may not contain any
OCaml values.

Suggested-by: Gabriel Scherer <gabriel.scherer@gmail.com>

Signed-off-by: Edwin Török <edwin.torok@cloud.com>
Co-authored-by: Edwin Török <edwin.torok@cloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants