From 9f2fba9625f9695ad46841ea41688139809c06ae Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 22 Apr 2011 14:42:57 -0600 Subject: [PATCH] safe-for-space repairs for functions with rest args original commit: 0754ad01148f3de83b4ce97102d2d0859d56a370 --- collects/compiler/decompile.rkt | 1 + collects/compiler/zo-marshal.rkt | 2 ++ collects/compiler/zo-parse.rkt | 2 ++ collects/compiler/zo-structs.rkt | 3 ++- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/collects/compiler/decompile.rkt b/collects/compiler/decompile.rkt index 4af6bb5d08..0c9c7049b3 100644 --- a/collects/compiler/decompile.rkt +++ b/collects/compiler/decompile.rkt @@ -307,6 +307,7 @@ ,@(if (and name (not (null? name))) `(',name) null) + ,@(if (null? flags) null `('(flags: ,@flags))) ,@(if (null? captures) null `('(captures: ,@(map (lambda (c t) diff --git a/collects/compiler/zo-marshal.rkt b/collects/compiler/zo-marshal.rkt index 659d5da608..d670f06eea 100644 --- a/collects/compiler/zo-marshal.rkt +++ b/collects/compiler/zo-marshal.rkt @@ -257,6 +257,7 @@ (define CLOS_HAS_REST 1) (define CLOS_HAS_REF_ARGS 2) (define CLOS_PRESERVES_MARKS 4) +(define CLOS_NEED_REST_CLEAR 8) (define CLOS_IS_METHOD 16) (define CLOS_SINGLE_RESULT 32) @@ -1006,6 +1007,7 @@ (+ (if rest? CLOS_HAS_REST 0) (if any-refs? CLOS_HAS_REF_ARGS 0) (if (memq 'preserves-marks flags) CLOS_PRESERVES_MARKS 0) + (if (memq 'sfs-clear-rest-args flags) CLOS_NEED_REST_CLEAR 0) (if (memq 'is-method flags) CLOS_IS_METHOD 0) (if (memq 'single-result flags) CLOS_SINGLE_RESULT 0)) num-all-params diff --git a/collects/compiler/zo-parse.rkt b/collects/compiler/zo-parse.rkt index d14a296e28..2290bc30bc 100644 --- a/collects/compiler/zo-parse.rkt +++ b/collects/compiler/zo-parse.rkt @@ -81,6 +81,7 @@ (define CLOS_HAS_REST 1) (define CLOS_HAS_REF_ARGS 2) (define CLOS_PRESERVES_MARKS 4) + (define CLOS_NEED_REST_CLEAR 8) (define CLOS_IS_METHOD 16) (define CLOS_SINGLE_RESULT 32) (define BITS_PER_MZSHORT 32) @@ -118,6 +119,7 @@ (if (zero? (bitwise-and flags flags CLOS_PRESERVES_MARKS)) null '(preserves-marks)) (if (zero? (bitwise-and flags flags CLOS_IS_METHOD)) null '(is-method)) (if (zero? (bitwise-and flags flags CLOS_SINGLE_RESULT)) null '(single-result)) + (if (zero? (bitwise-and flags flags CLOS_NEED_REST_CLEAR)) null '(sfs-clear-rest-args)) (if (and rest? (zero? num-params)) '(only-rest-arg-not-used) null)) (if (and rest? (num-params . > . 0)) (sub1 num-params) diff --git a/collects/compiler/zo-structs.rkt b/collects/compiler/zo-structs.rkt index d3933aa349..b9919e4ff3 100644 --- a/collects/compiler/zo-structs.rkt +++ b/collects/compiler/zo-structs.rkt @@ -131,7 +131,8 @@ [internal-context (or/c #f #t stx?)])) (define-form-struct (lam expr) ([name (or/c symbol? vector? empty?)] - [flags (listof (or/c 'preserves-marks 'is-method 'single-result 'only-rest-arg-not-used))] + [flags (listof (or/c 'preserves-marks 'is-method 'single-result + 'only-rest-arg-not-used 'sfs-clear-rest-args))] [num-params exact-nonnegative-integer?] [param-types (listof (or/c 'val 'ref 'flonum))] [rest? boolean?]