@geastack/compiler 1.0.30 → 1.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geastack/compiler",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.31",
|
|
4
4
|
"description": "The geastack TypeScript-to-C++ compiler: one semantic spine, no source-shaped authority, no boxing of statically typed values.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -4255,6 +4255,13 @@ namespace host {
|
|
|
4255
4255
|
}
|
|
4256
4256
|
|
|
4257
4257
|
namespace detail {
|
|
4258
|
+
// Out of line and cold so a `Ref` dereference stays one compare clang inlines:
|
|
4259
|
+
// with the message built at every `->`, clang at -Os stopped inlining
|
|
4260
|
+
// `operator->` and gea-raw lost ~8% throughput (bench box, 2026-10-11).
|
|
4261
|
+
[[noreturn, gnu::cold, gnu::noinline]] inline void throwNullDereference(bool undefined) {
|
|
4262
|
+
host::throwRuntimeError("TypeError", undefined ? "Cannot read properties of undefined" : "Cannot read properties of null");
|
|
4263
|
+
}
|
|
4264
|
+
|
|
4258
4265
|
/**
|
|
4259
4266
|
* The one word every `Ref<T>` is: the object, erased.
|
|
4260
4267
|
*
|
|
@@ -4401,14 +4408,14 @@ struct Ref : detail::RefStorage {
|
|
|
4401
4408
|
}
|
|
4402
4409
|
|
|
4403
4410
|
T* get() const { return pointer(); }
|
|
4404
|
-
T* operator->() const {
|
|
4405
|
-
if (!ownsObject())
|
|
4406
|
-
return
|
|
4411
|
+
[[gnu::always_inline]] T* operator->() const {
|
|
4412
|
+
if (!ownsObject()) [[unlikely]] detail::throwNullDereference(isUndefined());
|
|
4413
|
+
return static_cast<T*>(erased_);
|
|
4407
4414
|
}
|
|
4408
4415
|
/** `add_lvalue_reference_t` rather than `T&`, for the same reason `std::shared_ptr` spells it that way: `Ref<void>` is the box's own storage, and `void&` is not a type. */
|
|
4409
|
-
typename std::add_lvalue_reference<T>::type operator*() const {
|
|
4410
|
-
if (!ownsObject())
|
|
4411
|
-
return *
|
|
4416
|
+
[[gnu::always_inline]] typename std::add_lvalue_reference<T>::type operator*() const {
|
|
4417
|
+
if (!ownsObject()) [[unlikely]] detail::throwNullDereference(isUndefined());
|
|
4418
|
+
return *static_cast<T*>(erased_);
|
|
4412
4419
|
}
|
|
4413
4420
|
explicit operator bool() const { return ownsObject(); }
|
|
4414
4421
|
|