From 1cd5e9b7cc334378305db0b0629fb0f5ccbfb9b2 Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Thu, 1 Mar 2012 17:40:24 -0500 Subject: [PATCH] expanding the set of simple expressions to include primitive references --- compiler/compiler.rkt | 23 ++++++++++++++--------- version.rkt | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/compiler/compiler.rkt b/compiler/compiler.rkt index 3441cb2..ecaa734 100644 --- a/compiler/compiler.rkt +++ b/compiler/compiler.rkt @@ -1243,7 +1243,8 @@ [operand-poss (simple-operands->opargs (map (lambda: ([op : Expression]) - (adjust-expression-depth op n n)) + (ensure-simple-expression + (adjust-expression-depth op n n))) (App-operands exp)) operand-knowledge)]) (end-with-linkage @@ -1342,11 +1343,12 @@ -(: ensure-simple-expression (Expression -> (U Constant ToplevelRef LocalRef))) +(: ensure-simple-expression (Expression -> (U Constant ToplevelRef LocalRef PrimitiveKernelValue))) (define (ensure-simple-expression e) (if (or (Constant? e) (LocalRef? e) - (ToplevelRef? e)) + (ToplevelRef? e) + (PrimitiveKernelValue? e)) e (error 'ensure-simple-expression))) @@ -1359,13 +1361,16 @@ (define (simple-expression? e) (or (Constant? e) (LocalRef? e) - (ToplevelRef? e))) + (ToplevelRef? e) + (PrimitiveKernelValue? e))) -(: simple-operands->opargs ((Listof Expression) (Listof CompileTimeEnvironmentEntry) -> (Listof OpArg))) -;; Produces a list of OpArgs if all the operands are particularly simple, and false otherwise. +(: simple-operands->opargs ((Listof (U Constant LocalRef ToplevelRef PrimitiveKernelValue)) + (Listof CompileTimeEnvironmentEntry) + -> (Listof OpArg))) +;; Produces a list of OpArgs if all the operands are particularly simple. (define (simple-operands->opargs rands knowledge) - (map (lambda: ([e : Expression] + (map (lambda: ([e : (U Constant LocalRef ToplevelRef PrimitiveKernelValue)] [k : CompileTimeEnvironmentEntry]) (cond [(Constant? e) @@ -1380,8 +1385,8 @@ [else (make-EnvPrefixReference (ToplevelRef-depth e) (ToplevelRef-pos e) #f)])] - [else - (error 'all-operands-are-constant "Impossible")])) + [(PrimitiveKernelValue? e) + e])) rands knowledge)) diff --git a/version.rkt b/version.rkt index aed9ed6..303bf48 100644 --- a/version.rkt +++ b/version.rkt @@ -7,4 +7,4 @@ (provide version) (: version String) -(define version "1.205") +(define version "1.208")