diff --git a/miniml/compiler/compile.scm b/miniml/compiler/compile.scm index 58e2a38..02a96f7 100644 --- a/miniml/compiler/compile.scm +++ b/miniml/compiler/compile.scm @@ -1167,13 +1167,27 @@ )) (emit-header (lambda () ; we assume that 'count' ran first to initialize len, objcount, size32, size64 - (bytecode-put-u32 #x8495A6BF) ; Intext_magic_number_big - (bytecode-put-u32 0) ; Unused - (bytecode-put-u64 len) - (bytecode-put-u64 objcount) ; note: always 0, as objects are not used in the bytecode-object format - (bytecode-put-u64 size64) + (cond + ((and + (fits-unsigned 32 len) + (fits-unsigned 32 size32) + (fits-unsigned 32 size64) + ) + (bytecode-put-u32 #x8495A6BE) ; Intext_magic_number_small + (bytecode-put-u32 len) + (bytecode-put-u32 objcount) ; note: always 0, as objects are not used in the bytecode-object format + (bytecode-put-u32 size32) + (bytecode-put-u32 size64) + ) + (else + (bytecode-put-u32 #x8495A6BF) ; Intext_magic_number_big + (bytecode-put-u32 0) ; Unused + (bytecode-put-u64 len) + (bytecode-put-u64 objcount) + (bytecode-put-u64 size64) )) - ) + )) + ) (begin (count value) (emit-header) diff --git a/miniml/compiler/test/arith.info.reference b/miniml/compiler/test/arith.info.reference index 6763685..35a072a 100644 --- a/miniml/compiler/test/arith.info.reference +++ b/miniml/compiler/test/arith.info.reference @@ -1 +1 @@ -Bytecode size: 7624 bytes +Bytecode size: 7600 bytes diff --git a/miniml/compiler/test/empty.info.reference b/miniml/compiler/test/empty.info.reference index b6bd20a..90819d5 100644 --- a/miniml/compiler/test/empty.info.reference +++ b/miniml/compiler/test/empty.info.reference @@ -1 +1 @@ -Bytecode size: 5044 bytes +Bytecode size: 5020 bytes diff --git a/miniml/compiler/test/exceptions.info.reference b/miniml/compiler/test/exceptions.info.reference index e408a4d..4771c83 100644 --- a/miniml/compiler/test/exceptions.info.reference +++ b/miniml/compiler/test/exceptions.info.reference @@ -1 +1 @@ -Bytecode size: 10060 bytes +Bytecode size: 10036 bytes diff --git a/miniml/compiler/test/exits.info.reference b/miniml/compiler/test/exits.info.reference index e0ce680..e16ac1c 100644 --- a/miniml/compiler/test/exits.info.reference +++ b/miniml/compiler/test/exits.info.reference @@ -1 +1 @@ -Bytecode size: 7920 bytes +Bytecode size: 7896 bytes diff --git a/miniml/compiler/test/external_exceptions.info.reference b/miniml/compiler/test/external_exceptions.info.reference index 46c739d..c7c6b5c 100644 --- a/miniml/compiler/test/external_exceptions.info.reference +++ b/miniml/compiler/test/external_exceptions.info.reference @@ -1 +1 @@ -Bytecode size: 10622 bytes +Bytecode size: 10598 bytes diff --git a/miniml/compiler/test/functions.info.reference b/miniml/compiler/test/functions.info.reference index 6c40e92..acdb790 100644 --- a/miniml/compiler/test/functions.info.reference +++ b/miniml/compiler/test/functions.info.reference @@ -1 +1 @@ -Bytecode size: 9316 bytes +Bytecode size: 9292 bytes diff --git a/miniml/compiler/test/functors.info.reference b/miniml/compiler/test/functors.info.reference index 942e82c..f47e5b7 100644 --- a/miniml/compiler/test/functors.info.reference +++ b/miniml/compiler/test/functors.info.reference @@ -1 +1 @@ -Bytecode size: 6183 bytes +Bytecode size: 6159 bytes diff --git a/miniml/compiler/test/infix_sugar.info.reference b/miniml/compiler/test/infix_sugar.info.reference index 0df3330..7857200 100644 --- a/miniml/compiler/test/infix_sugar.info.reference +++ b/miniml/compiler/test/infix_sugar.info.reference @@ -1 +1 @@ -Bytecode size: 5613 bytes +Bytecode size: 5589 bytes diff --git a/miniml/compiler/test/labels.info.reference b/miniml/compiler/test/labels.info.reference index 2552120..b8b968b 100644 --- a/miniml/compiler/test/labels.info.reference +++ b/miniml/compiler/test/labels.info.reference @@ -1 +1 @@ -Bytecode size: 6704 bytes +Bytecode size: 6680 bytes diff --git a/miniml/compiler/test/let_open.info.reference b/miniml/compiler/test/let_open.info.reference index bc7f847..96f98e2 100644 --- a/miniml/compiler/test/let_open.info.reference +++ b/miniml/compiler/test/let_open.info.reference @@ -1 +1 @@ -Bytecode size: 6327 bytes +Bytecode size: 6303 bytes diff --git a/miniml/compiler/test/lists.info.reference b/miniml/compiler/test/lists.info.reference index 3dc340e..3277568 100644 --- a/miniml/compiler/test/lists.info.reference +++ b/miniml/compiler/test/lists.info.reference @@ -1 +1 @@ -Bytecode size: 7883 bytes +Bytecode size: 7859 bytes diff --git a/miniml/compiler/test/loops.info.reference b/miniml/compiler/test/loops.info.reference index aa30120..7e829ec 100644 --- a/miniml/compiler/test/loops.info.reference +++ b/miniml/compiler/test/loops.info.reference @@ -1 +1 @@ -Bytecode size: 6862 bytes +Bytecode size: 6838 bytes diff --git a/miniml/compiler/test/patterns.info.reference b/miniml/compiler/test/patterns.info.reference index c80c778..cb2f9d9 100644 --- a/miniml/compiler/test/patterns.info.reference +++ b/miniml/compiler/test/patterns.info.reference @@ -1 +1 @@ -Bytecode size: 17753 bytes +Bytecode size: 17729 bytes diff --git a/miniml/compiler/test/records.info.reference b/miniml/compiler/test/records.info.reference index ea68be0..d0dcb60 100644 --- a/miniml/compiler/test/records.info.reference +++ b/miniml/compiler/test/records.info.reference @@ -1 +1 @@ -Bytecode size: 7311 bytes +Bytecode size: 7287 bytes