Handle arrays properly in the runtime (part 1)
Compare changes
Some changes are not shown
For a faster browsing experience, some files are collapsed by default.
Files
18+ 225
− 14
@@ -258,6 +259,27 @@ impl<'a> FunctionContext<'a> {
@@ -327,14 +349,12 @@ impl<'a> PartitionContext<'a> {
@@ -342,7 +362,9 @@ impl<'a> PartitionContext<'a> {
@@ -359,11 +381,9 @@ impl<'a> PartitionContext<'a> {
@@ -374,7 +394,7 @@ impl<'a> PartitionContext<'a> {
@@ -423,13 +443,13 @@ pub(crate) fn generate_type_string(ty: &Type, llvm_types: &Vec<String>) -> Strin
@@ -524,3 +544,194 @@ pub(crate) fn generate_dynamic_constant_strings(module: &Module) -> Vec<String>
ConstantBytes::Zero(size, _) => acc_bytes.extend(repeat(0).take(size.expect("PANIC: Attempted to embed a zero constant with unknown size into a non-zero constant product. Non-zero constants must have compile-time known size. This is probably because an array field is a zero constant with non-constant dynamic constant dimensions."))),
ConstantBytes::Zero(size, _) => vec![0; size.expect("PANIC: Attempted to embed a zero constant with unknown size into a non-zero constant array. Non-zero constants must have compile-time known size. This is probably because an array element is a zero constant with non-constant dynamic constant dimensions.")],
assert_eq!(array_bytes.len(), size.expect("PANIC: Size of a non-zero constant array is unknown at compile time. All non-zero constants must have compile time known size."), "PANIC: Size of array type calculated by type_size_and_alignment differs from calculated in-memory byte representation's size.");