From 8506b70253ec001fbe3dc5c0df193a405edae2a1 Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Wed, 14 Sep 2011 22:03:24 -0400 Subject: [PATCH] function labels are short by default now. --- compiler/expression-structs.rkt | 10 +++++++++- parameters.rkt | 3 ++- parser/baby-parser.rkt | 6 +++++- parser/lam-entry-gensym.rkt | 14 -------------- parser/parse-bytecode-5.1.1.rkt | 8 +++++--- parser/parse-bytecode-5.1.2.rkt | 8 ++++---- 6 files changed, 25 insertions(+), 24 deletions(-) delete mode 100644 parser/lam-entry-gensym.rkt diff --git a/compiler/expression-structs.rkt b/compiler/expression-structs.rkt index d38ffe3..3d2f415 100644 --- a/compiler/expression-structs.rkt +++ b/compiler/expression-structs.rkt @@ -1,6 +1,7 @@ #lang typed/racket/base (require "lexical-structs.rkt") + (provide (all-defined-out)) @@ -157,9 +158,16 @@ + +(: current-short-labels? (Parameterof Boolean)) +(define current-short-labels? (make-parameter #t)) + + (: make-label (Symbol -> Symbol)) (define make-label (let ([n 0]) (lambda (l) (set! n (add1 n)) - (string->symbol (format "~a~a" l n))))) \ No newline at end of file + (if (current-short-labels?) + (string->symbol (format "_~a" n)) + (string->symbol (format "~a~a" l n)))))) diff --git a/parameters.rkt b/parameters.rkt index 46de1c4..709af26 100644 --- a/parameters.rkt +++ b/parameters.rkt @@ -18,8 +18,8 @@ current-seen-unimplemented-kernel-primitives current-kernel-module-locator? current-compress-javascript? - current-report-port + current-report-port current-timing-port ) @@ -75,6 +75,7 @@ + (: current-report-port (Parameterof Output-Port)) (define current-report-port (make-parameter (current-output-port))) diff --git a/parser/baby-parser.rkt b/parser/baby-parser.rkt index 37c9473..156ee0f 100644 --- a/parser/baby-parser.rkt +++ b/parser/baby-parser.rkt @@ -5,7 +5,6 @@ "../compiler/lexical-structs.rkt" "../helpers.rkt" "../parameters.rkt" - "lam-entry-gensym.rkt" racket/list) (provide (rename-out (-parse parse))) @@ -16,6 +15,11 @@ (make-Top prefix (parse exp (extend-lexical-environment '() prefix) #t)))) +(define (make-lam-label) + (make-label 'lamEntry)) + + + (define (construct-the-prefix exp) (let ([unbound-names (find-unbound-names exp)] diff --git a/parser/lam-entry-gensym.rkt b/parser/lam-entry-gensym.rkt deleted file mode 100644 index 9d2e082..0000000 --- a/parser/lam-entry-gensym.rkt +++ /dev/null @@ -1,14 +0,0 @@ -#lang typed/racket/base - - -(define-values (make-lam-label reset-lam-label-counter!/unit-testing) - (let ([n 0]) - (values - (lambda () - (set! n (add1 n)) - (string->symbol (format "lamEntry~a" n))) - (lambda () - (set! n 0))))) - - -(provide make-lam-label reset-lam-label-counter!/unit-testing) \ No newline at end of file diff --git a/parser/parse-bytecode-5.1.1.rkt b/parser/parse-bytecode-5.1.1.rkt index 1714518..91efd45 100644 --- a/parser/parse-bytecode-5.1.1.rkt +++ b/parser/parse-bytecode-5.1.1.rkt @@ -11,7 +11,6 @@ ;; Parsing Racket 5.1.1 bytecode structures into our own structures. (require "typed-module-path.rkt" - "lam-entry-gensym.rkt" "path-rewriter.rkt" "../compiler/expression-structs.rkt" "../compiler/lexical-structs.rkt" @@ -24,11 +23,14 @@ racket/list) - (provide parse-bytecode - reset-lam-label-counter!/unit-testing) + (provide parse-bytecode) + (define (make-lam-label) + (make-label 'lamEntry)) + + ;; current-module-path-index-resolver: (module-path-index (U Path #f) -> (U Symbol Path)) -> void ;; The module path index resolver figures out how to translate module path indices to module names. (define current-module-path-index-resolver diff --git a/parser/parse-bytecode-5.1.2.rkt b/parser/parse-bytecode-5.1.2.rkt index 2a342c3..0ac12d4 100644 --- a/parser/parse-bytecode-5.1.2.rkt +++ b/parser/parse-bytecode-5.1.2.rkt @@ -13,7 +13,6 @@ ;; Parsing Racket 5.1.2 bytecode structures into our own structures. (require "typed-module-path.rkt" - "lam-entry-gensym.rkt" "path-rewriter.rkt" "../compiler/expression-structs.rkt" "../compiler/lexical-structs.rkt" @@ -26,8 +25,7 @@ racket/list) - (provide parse-bytecode - reset-lam-label-counter!/unit-testing) + (provide parse-bytecode) @@ -465,7 +463,9 @@ - + (define (make-lam-label) + (make-label 'lamEntry)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (parse-expr expr)