File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -625,11 +625,27 @@ struct TargetMetadata {
625
625
getValueWitnesses ()->_asEVWT ()->destructiveInjectEnumTag (value, tag, this );
626
626
}
627
627
628
+ size_t vw_size () const {
629
+ return getValueWitnesses ()->getSize ();
630
+ }
631
+
632
+ size_t vw_alignment () const {
633
+ return getValueWitnesses ()->getAlignment ();
634
+ }
635
+
636
+ size_t vw_stride () const {
637
+ return getValueWitnesses ()->getStride ();
638
+ }
639
+
628
640
// / Allocate an out-of-line buffer if values of this type don't fit in the
629
641
// / ValueBuffer.
630
642
// / NOTE: This is not a box for copy-on-write existentials.
631
643
OpaqueValue *allocateBufferIn (ValueBuffer *buffer) const ;
632
644
645
+ // / Get the address of the memory previously allocated in the ValueBuffer.
646
+ // / NOTE: This is not a box for copy-on-write existentials.
647
+ OpaqueValue *projectBufferFrom (ValueBuffer *buffer) const ;
648
+
633
649
// / Deallocate an out-of-line buffer stored in 'buffer' if values of this type
634
650
// / are not stored inline in the ValueBuffer.
635
651
void deallocateBufferIn (ValueBuffer *buffer) const ;
Original file line number Diff line number Diff line change @@ -3712,6 +3712,13 @@ template <> OpaqueValue *Metadata::allocateBufferIn(ValueBuffer *buffer) const {
3712
3712
return reinterpret_cast <OpaqueValue *>(ptr);
3713
3713
}
3714
3714
3715
+ template <> OpaqueValue *Metadata::projectBufferFrom (ValueBuffer *buffer) const {
3716
+ auto *vwt = getValueWitnesses ();
3717
+ if (vwt->isValueInline ())
3718
+ return reinterpret_cast <OpaqueValue *>(buffer);
3719
+ return reinterpret_cast <OpaqueValue *>(buffer->PrivateData [0 ]);
3720
+ }
3721
+
3715
3722
template <> void Metadata::deallocateBufferIn (ValueBuffer *buffer) const {
3716
3723
auto *vwt = getValueWitnesses ();
3717
3724
if (vwt->isValueInline ())
You can’t perform that action at this time.
0 commit comments