From 33e8ee7786162dd132f36b766f7c2435171e7b50 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 22 Oct 2018 15:22:40 -0600 Subject: [PATCH] zo-lib: updates for virtual machine identifier in bytecode --- pkgs/zo-lib/compiler/zo-marshal.rkt | 12 +++++++++--- pkgs/zo-lib/compiler/zo-parse.rkt | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/zo-lib/compiler/zo-marshal.rkt b/pkgs/zo-lib/compiler/zo-marshal.rkt index f9678bfb61..435ff4f2de 100644 --- a/pkgs/zo-lib/compiler/zo-marshal.rkt +++ b/pkgs/zo-lib/compiler/zo-marshal.rkt @@ -45,7 +45,9 @@ (define version-bs (string->bytes/latin-1 (version))) (write-bytes (bytes (bytes-length version-bs)) outp) (write-bytes version-bs outp) - + (define vm-bs #"racket") + (write-bytes (bytes (bytes-length vm-bs)) outp) + (write-bytes vm-bs outp) (write-byte (char->integer #\D) outp) (struct bundle-bytes (code-bstr name-list name-bstr offset)) @@ -87,8 +89,9 @@ (write-bytes (int->bytes (length pre-bundle-bytess)) outp) ;; Size of btree: (define header-size - (+ 8 - (string-length (version)))) + (+ 9 + (string-length (version)) + (string-length "racket"))) (define btree-size (+ header-size (apply + (for/list ([mb (in-list pre-bundle-bytess)]) @@ -232,6 +235,9 @@ (define version-bs (string->bytes/latin-1 (version))) (write-bytes (bytes (bytes-length version-bs)) outp) (write-bytes version-bs outp) + (define vm-bs #"racket") + (write-bytes (bytes (bytes-length vm-bs)) outp) + (write-bytes vm-bs outp) ;; "B" is for linklet "bundle" (as opposed to a linklet directory) (write-byte (char->integer #\B) outp) diff --git a/pkgs/zo-lib/compiler/zo-parse.rkt b/pkgs/zo-lib/compiler/zo-parse.rkt index 32183beb67..25204e8452 100644 --- a/pkgs/zo-lib/compiler/zo-parse.rkt +++ b/pkgs/zo-lib/compiler/zo-parse.rkt @@ -737,6 +737,7 @@ [(equal? #"#f" tag) #f] [else (define version (read-bytes (min 63 (read-byte port)) port)) + (define vm (read-bytes (min 63 (read-byte port)) port)) (read-char port)])) ;; path -> bytes