reference clarifications on immutable literals; JIT tweak

svn: r8491
This commit is contained in:
Matthew Flatt 2008-01-31 23:15:10 +00:00
parent 5652f64f3e
commit 10ce5150d4
5 changed files with 41 additions and 16 deletions

View File

@ -553,7 +553,8 @@ is used for all slots.
In @scheme[read-syntax] mode, each recursive read for the vector
elements is also in @scheme[read-syntax] mode, so that the wrapped
vector's elements are also wraped as syntax objects.
vector's elements are also wraped as syntax objects, and the vector is
immutable.
@reader-examples[
"#(1 apple 3)"
@ -598,7 +599,7 @@ datum.
In @scheme[read-syntax] mode, the recursive read for the box content
is also in @scheme[read-syntax] mode, so that the wrapped box's
content is also wraped as a syntax object.
content is also wraped as a syntax object, and the box is immutable.
@reader-examples[
"#&17"

View File

@ -54,30 +54,39 @@ Within such specifications,
@;------------------------------------------------------------------------
@section[#:tag "quote"]{Literals: @scheme[quote] and @scheme[#%datum]}
Many forms are implicitly quoted (via @scheme[#%datum]) as literals. See
@secref["expand-steps"] for more information.
@guideintro["quote"]{@scheme[quote]}
@defform[(quote datum)]{
Produces a constant value corresponding to @scheme[datum] (i.e., the
actual representation of the program fragment) without its
@tech{lexical information} or source location.
representation of the program fragment) without its @tech{lexical
information}, source location, etc. Quoted pairs, vectors, and boxes
are immutable.
@examples[
(eval:alts (#,(schemekeywordfont "quote") x) 'x)
(eval:alts (#,(schemekeywordfont "quote") (+ 1 2)) '(+ 1 2))
(+ 1 2)
]
}
@defform[(#%datum . datum)]{
Expands to @scheme[(#,(schemekeywordfont "quote") datum)]. See also @secref["expand-steps"]
for information on how the expander introduces @schemeidfont{#%datum}
identifiers.
Expands to @scheme[(#,(schemekeywordfont "quote") datum)], as long as
@scheme[datum] is not a keyword. If @scheme[datum] is a keyword, and
syntax error is reported.
See also @secref["expand-steps"] for information on how the expander
introduces @schemeidfont{#%datum} identifiers.
@examples[
(#%datum . 10)
(#%datum . x)
(#%datum . #:x)
]
}

View File

@ -7,7 +7,7 @@
;; Written by Dima Dorfman, 2004
;; Converted to MzScheme by Brent Fulgham
(module nseive mzscheme
(module nsieve mzscheme
(require (only (lib "13.ss" "srfi") string-index string-pad))
(define (nsieve m)

View File

@ -4,7 +4,7 @@
("ackermann.ss" "11")
("ary.ss" "9000")
("binarytrees.ss" "16")
("chameneos.ss")
("chameneos.ss" "1000000")
("cheapconcurrency.ss" "15000")
("echo.ss" "150000")
("except.ss" "2500000")
@ -20,15 +20,15 @@
("moments.ss") ; 200 somethings...
("nbody.ss" "20000000")
("nestedloop.ss" "18")
("nsieve.ss")
("nsievebits.ss")
("nsieve.ss" "9")
("nsievebits.ss" "11")
("partialsums.ss" "2500000")
("pidigits.ss")
("pidigits.ss" "2500")
("pidigits1.ss")
("random.ss" "900000")
("recursive.ss" "11")
("regexmatch.ss")
("regexpdna.ss")
("regexpdna.ss" #f ,(lambda () (mk-regexpdna-input)))
("reversecomplement.ss" #f ,(lambda () (mk-revcomp-input)))
("k-nucleotide.ss" #f ,(lambda () (mk-knuc-input)))
("reversefile.ss")
@ -42,7 +42,7 @@
))
(define (dynreq f)
(dynamic-require `(lib ,f "tests" "mzscheme" "benchmarks" "shootout") #f))
(dynamic-require f #f))
(define (mk-fasta n suffix)
(let ([f (build-path (find-system-path 'temp-dir) (string-append "fasta-" suffix))])
@ -60,6 +60,9 @@
(define (mk-knuc-input)
(mk-fasta "1000000" "1m"))
(define (mk-regexpdna-input)
(mk-fasta "5000000" "5m"))
(define (mk-sumcol-input)
(let ([f (build-path (find-system-path 'temp-dir) "sumcol-21k")])
(unless (file-exists? f)

View File

@ -156,8 +156,15 @@ typedef struct {
void *self_restart_code;
Scheme_Native_Closure *nc; /* for extract_globals, only */
Scheme_Closure_Data *self_data;
void *status_at_ptr;
int reg_status;
} mz_jit_state;
#define mz_RECORD_STATUS(s) (jitter->status_at_ptr = _jit.x.pc, jitter->reg_status = (s))
#define mz_CURRENT_STATUS() ((jitter->status_at_ptr == _jit.x.pc) ? jitter->reg_status : 0)
#define mz_RS_R0_HAS_RUNSTACK0 0x1
typedef int (*Native_Check_Arity_Proc)(Scheme_Object *o, int argc, int dummy);
typedef Scheme_Object *(*Native_Get_Arity_Proc)(Scheme_Object *o, int dumm1, int dummy2);
static Native_Check_Arity_Proc check_arity_code;
@ -434,6 +441,7 @@ static void *generate_one(mz_jit_state *old_jitter,
jitter->max_extra_pushed = max_extra_pushed;
jitter->self_pos = 1; /* beyond end of stack */
jitter->self_toplevel_pos = -1;
jitter->status_at_ptr = NULL;
ok = generate(jitter, data);
@ -4562,8 +4570,10 @@ static int generate(Scheme_Object *obj, mz_jit_state *jitter, int is_tail, int m
START_JIT_DATA();
LOG_IT(("local\n"));
pos = mz_remap(SCHEME_LOCAL_POS(obj));
jit_ldxi_p(JIT_R0, JIT_RUNSTACK, WORDS_TO_BYTES(pos));
VALIDATE_RESULT(JIT_R0);
if (pos || (mz_CURRENT_STATUS() != mz_RS_R0_HAS_RUNSTACK0)) {
jit_ldxi_p(JIT_R0, JIT_RUNSTACK, WORDS_TO_BYTES(pos));
VALIDATE_RESULT(JIT_R0);
}
END_JIT_DATA(2);
return 1;
}
@ -5305,6 +5315,8 @@ static int generate(Scheme_Object *obj, mz_jit_state *jitter, int is_tail, int m
LOG_IT(("...in\n"));
mz_RECORD_STATUS(mz_RS_R0_HAS_RUNSTACK0);
return generate(lv->body, jitter, is_tail, multi_ok);
}
case scheme_with_cont_mark_type: