Branch: refs/heads/topic/robin/runtime-types
Home:
https://github.com/zeek/spicy
Commit: a0b7c2fcd80814047c9651c28e50d8e0fa8c3d89
https://github.com/zeek/spicy/commit/a0b7c2fcd80814047c9651c28e50d8e0fa8c3d89
Author: Robin Sommer <
ro...@corelight.com>
Date: 2025-10-14 (Tue, 14 Oct 2025)
Changed paths:
M hilti/runtime/include/types/bytes.h
M hilti/runtime/include/types/integer.h
M hilti/runtime/include/types/stream.h
M hilti/runtime/include/types/tuple.h
M hilti/runtime/src/tests/bytes.cc
M hilti/runtime/src/tests/integer.cc
M hilti/runtime/src/tests/real.cc
M hilti/runtime/src/tests/regexp.cc
M hilti/runtime/src/tests/stream.cc
M hilti/runtime/src/tests/string.cc
M hilti/runtime/src/tests/tuple.cc
M hilti/runtime/src/types/address.cc
M hilti/runtime/src/types/bytes.cc
M hilti/runtime/src/types/real.cc
M hilti/runtime/src/types/regexp.cc
M hilti/runtime/src/types/stream.cc
M hilti/runtime/src/types/string.cc
M hilti/toolchain/src/compiler/codegen/coercions.cc
M hilti/toolchain/src/compiler/codegen/types.cc
M spicy/runtime/src/tests/init.cc
M spicy/runtime/src/tests/parser.cc
M spicy/toolchain/bin/spicy-dump/printer-text.cc
Log Message:
-----------
No longer use `std::*` for working with HILTI tuples.
Even though tuples remain instances of `std::tuple` for now, we now
consistently use `hilti::rt::tuple::{make,get}` to work with them. We
also no longer use brace initialization when instantiating them, but
likewise `tuple::make`. This makes it clear where exactly we work with
HILTI runtime tuples.
Commit: ba7a7bb46cde24d681db38a706e9584cc598174b
https://github.com/zeek/spicy/commit/ba7a7bb46cde24d681db38a706e9584cc598174b
Author: Robin Sommer <
ro...@corelight.com>
Date: 2025-10-14 (Tue, 14 Oct 2025)
Changed paths:
M hilti/runtime/include/type-info.h
M hilti/runtime/include/types/bitfield.h
M hilti/runtime/include/types/tuple.h
M hilti/runtime/src/tests/regexp.cc
M hilti/runtime/src/tests/tuple.cc
M hilti/runtime/src/type-info.cc
M hilti/toolchain/include/ast/types/bitfield.h
M hilti/toolchain/src/compiler/codegen/types.cc
M tests/Baseline/hilti.types.tuple.coercion/output
M tests/hilti/codegen/type-info.hlt
Log Message:
-----------
New tuple implementation.
So far our runtime `rt::Tuple` type was just an alias to
`std::tuple<std::optional<Ts...>>`. This commit moves away from that and
instead provides our own, custom tuple type. Doing so encapsulates the
implementation and allows for HILTI-specific changes in semantics and
implementation. This is similar to how we already wrap other `std` types into
custom runtime types (e.g., vector).
One immediate benefit we get is a cleaner semantics for unset elements. With
the prior alias, the `optional` wrappers remained visible to tuple users, even
though semantically the cases where they matter qre very rare. When retrieving
a tuple element, it's much more natural to get the element itself back, not an
optional to it; and instead handle the unset case through exceptions. The new
class does that now.
Internally, behind the scenes, we still implement our custom tuple class
through a `std::tuple`, but now without the `optional` wrappers. Instead we
maintain a bitmask that records which elements are set. This implementeation
should save a little bit of memory, and maybe also some cycles (although we now
instantiate some otherwise unneeded default values for elements that aren't
set; but, as said, unset elements are rare).
The move away from `optional` elements requires a small tweak to the type
information API for tuples: when iterating over elements, there's likewise no
optional returned anymore. Instead we nullify the values directly in case an
element is not set. Because bitfields rely on tuples internally, they get a
corresponding change.
Commit: d8a58c1bc340eba52c51a855be8a81d7d575fc39
https://github.com/zeek/spicy/commit/d8a58c1bc340eba52c51a855be8a81d7d575fc39
Author: Robin Sommer <
ro...@corelight.com>
Date: 2025-10-17 (Fri, 17 Oct 2025)
Changed paths:
M hilti/runtime/include/profiler-state.h
M hilti/runtime/include/profiler.h
M hilti/runtime/include/result.h
M hilti/runtime/include/types/bitfield.h
M hilti/runtime/include/types/map.h
M hilti/runtime/include/types/null.h
M hilti/runtime/include/types/optional.h
M hilti/runtime/include/types/struct.h
M hilti/runtime/include/types/tuple.h
M hilti/runtime/include/util.h
M hilti/runtime/src/profiler.cc
M hilti/runtime/src/tests/map.cc
M hilti/runtime/src/tests/optional.cc
M hilti/runtime/src/tests/struct.cc
M hilti/runtime/src/tests/to_string.cc
M hilti/runtime/src/tests/tuple.cc
M hilti/runtime/src/tests/util.cc
M hilti/runtime/src/types/optional.cc
M hilti/runtime/src/util.cc
M hilti/toolchain/src/compiler/cfg.cc
M hilti/toolchain/src/compiler/codegen/codegen.cc
M hilti/toolchain/src/compiler/codegen/coercions.cc
M hilti/toolchain/src/compiler/codegen/ctors.cc
M hilti/toolchain/src/compiler/codegen/types.cc
M hilti/toolchain/src/compiler/cxx/elements.cc
M hilti/toolchain/src/compiler/optimizer.cc
M hilti/toolchain/tests/util.cc
M spicy/runtime/include/driver.h
M spicy/runtime/include/filter.h
M spicy/runtime/include/global-state.h
M spicy/runtime/include/parser.h
M spicy/runtime/include/sink.h
M spicy/runtime/include/typedefs.h
M spicy/runtime/include/unit-context.h
M spicy/runtime/include/util.h
M spicy/runtime/src/driver.cc
M spicy/runtime/src/init.cc
M spicy/runtime/src/parser.cc
M spicy/runtime/src/sink.cc
M spicy/runtime/src/tests/init.cc
M spicy/runtime/src/tests/parser.cc
M spicy/runtime/src/util.cc
M tests/Baseline/hilti.hiltic.print.globals/output
M tests/Baseline/hilti.hiltic.print.globals/output2
M tests/Baseline/hilti.hiltic.print.import/output
M tests/Baseline/hilti.hiltic.print.import/output2
M tests/Baseline/hilti.types.real.nops/output
M tests/Baseline/hilti.types.tuple.coercion/output
M tests/Baseline/spicy.tools.spicyc-hello-world/test.hlt
M tests/hilti/types/integer/on-heap.hlt
Log Message:
-----------
No longer use `std::*` for working with HILTI optionals.
Even though optionals remain instances of `std::optional` for now, we
now consistently use `hilti::rt::Optional<T>` and
`hilti::rt::optional::make()` to work with them. We also use
`rt::Null()` instead of `std::nullopt`, and we also no longer use
brace initialization when instantiating them, but likewise
`optional::make`. This makes it clear where exactly we work with HILTI
runtime optionals.
Commit: 025a291a636f37bb391ababf1bb284658be73d56
https://github.com/zeek/spicy/commit/025a291a636f37bb391ababf1bb284658be73d56
Author: Robin Sommer <
ro...@corelight.com>
Date: 2025-10-20 (Mon, 20 Oct 2025)
Changed paths:
M hilti/runtime/include/types/bitfield.h
M hilti/runtime/include/types/null.h
M hilti/runtime/include/types/optional.h
M hilti/runtime/include/types/struct.h
M hilti/runtime/include/types/tuple.h
M hilti/runtime/src/tests/optional.cc
M hilti/toolchain/src/compiler/codegen/coercions.cc
M hilti/toolchain/src/compiler/codegen/operators.cc
M hilti/toolchain/src/compiler/jit.cc
M spicy/runtime/src/init.cc
M spicy/runtime/src/parser.cc
Log Message:
-----------
New `Optional` implementation.
So far the runtime used `std::optional` for representing optionals.
This commit replaces that with a custom `Optional` class that
encapsulates the implementation, and directly provides the semantics
we want. That means in particular that we can now remove most of the
former free functions, and move their functionality directly into the
class. For example, the `value()` method now throws the expected HILTI
exception directly, without needing to remember to use a wrapper. We
also rename some method to follow our coding conventions.
Behind the scenes, we continue to use `std::optional` for implementing
optionals, now through protected inheritance, similar like we do for
some other types as well.
This is all similar to how we already wrap other `std` types into
custom runtime types (e.g., vector).
Compare:
https://github.com/zeek/spicy/compare/a0b7c2fcd808%5E...025a291a636f
To unsubscribe from these emails, change your notification settings at
https://github.com/zeek/spicy/settings/notifications