From 95fba70f4d18bb07d41defb8b3b418c64aa07d93 Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Wed, 2 Nov 2011 15:27:38 -0400 Subject: [PATCH] trying to fight the code expansion --- get-module-bytecode.rkt | 6 ++++-- js-assembler/assemble-expression.rkt | 2 +- js-assembler/assemble.rkt | 8 ++++++-- js-assembler/runtime-src/baselib-functions.js | 2 +- version.rkt | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/get-module-bytecode.rkt b/get-module-bytecode.rkt index 627cdf0..eb18f99 100644 --- a/get-module-bytecode.rkt +++ b/get-module-bytecode.rkt @@ -81,7 +81,8 @@ (lambda (ip) (get-compiled-code-from-port ip))) )]) - (parameterize ([compile-context-preservation-enabled #f]) + ;; Note: we're trying to preserve the context, to avoid code expansion. + (parameterize ([compile-context-preservation-enabled #t]) (get-module-code p)))) @@ -90,7 +91,8 @@ (define (get-compiled-code-from-port ip) ;(printf "get-compiled-code-from-port\n") (parameterize ([read-accept-reader #t] - [compile-context-preservation-enabled #f] + ;; Note: we're trying to preserve the context, to avoid code expansion. + [compile-context-preservation-enabled #t] [current-namespace base-namespace]) (define stx (read-syntax (object-name ip) ip)) ;(printf "got stx; now expanding out the images\n") diff --git a/js-assembler/assemble-expression.rkt b/js-assembler/assemble-expression.rkt index 1b8d82e..78210bc 100644 --- a/js-assembler/assemble-expression.rkt +++ b/js-assembler/assemble-expression.rkt @@ -60,4 +60,4 @@ [(CallKernelPrimitiveProcedure? op) (open-code-kernel-primitive-procedure op blockht)] [(ApplyPrimitiveProcedure? op) - "M.p.rawImpl(M)"])) \ No newline at end of file + "M.p._i(M)"])) \ No newline at end of file diff --git a/js-assembler/assemble.rkt b/js-assembler/assemble.rkt index 00dee23..1249cec 100644 --- a/js-assembler/assemble.rkt +++ b/js-assembler/assemble.rkt @@ -567,8 +567,12 @@ EOF (let: ([skip : OpArg (PopEnvironment-skip stmt)]) (cond [(and (Const? skip) (= (ensure-natural (Const-const skip)) 0)) - (format "M.e.length-=~a;" - (assemble-oparg (PopEnvironment-n stmt) blockht))] + (cond [(equal? (PopEnvironment-n stmt) + (make-Const 1)) + "M.e.pop();"] + [else + (format "M.e.length-=~a;" + (assemble-oparg (PopEnvironment-n stmt) blockht))])] [else (format "M.e.splice(M.e.length-(~a+~a),~a);" (assemble-oparg (PopEnvironment-skip stmt) blockht) diff --git a/js-assembler/runtime-src/baselib-functions.js b/js-assembler/runtime-src/baselib-functions.js index 0dfffe0..83f6424 100644 --- a/js-assembler/runtime-src/baselib-functions.js +++ b/js-assembler/runtime-src/baselib-functions.js @@ -327,7 +327,7 @@ }, []); // Also, record the raw implementation of the function. - proc.rawImpl = f; + proc._i = f; return proc; }; diff --git a/version.rkt b/version.rkt index 3f35af7..888d16e 100644 --- a/version.rkt +++ b/version.rkt @@ -6,4 +6,4 @@ (provide version) (: version String) -(define version "1.50") +(define version "1.51")