annotate some primitives as "immediate"

This annotation is useful mainly for functions that might be called
frequently from JIT-generated code.
This commit is contained in:
Matthew Flatt 2013-11-12 10:16:53 -07:00
parent 24a132b8d1
commit c81a468bc4
4 changed files with 170 additions and 170 deletions

View File

@ -317,7 +317,7 @@ void scheme_init_file(Scheme_Env *env)
windows_symbol = scheme_intern_symbol("windows");
unix_symbol = scheme_intern_symbol("unix");
p = scheme_make_prim_w_arity(path_p, "path?", 1, 1);
p = scheme_make_immed_prim(path_p, "path?", 1, 1);
SCHEME_PRIM_PROC_FLAGS(p) |= scheme_intern_prim_opt_flags(SCHEME_PRIM_IS_UNARY_INLINED
| SCHEME_PRIM_IS_OMITABLE);
scheme_add_global_constant("path?", p, env);
@ -333,49 +333,49 @@ void scheme_init_file(Scheme_Env *env)
1, 1, 1),
env);
scheme_add_global_constant("system-path-convention-type",
scheme_make_prim_w_arity(platform_path_kind,
"system-path-convention-type",
0, 0),
scheme_make_immed_prim(platform_path_kind,
"system-path-convention-type",
0, 0),
env);
scheme_add_global_constant("path->string",
scheme_make_prim_w_arity(path_to_string,
"path->string",
1, 1),
scheme_make_immed_prim(path_to_string,
"path->string",
1, 1),
env);
scheme_add_global_constant("path->bytes",
scheme_make_prim_w_arity(path_to_bytes,
"path->bytes",
1, 1),
scheme_make_immed_prim(path_to_bytes,
"path->bytes",
1, 1),
env);
scheme_add_global_constant("path-element->bytes",
scheme_make_prim_w_arity(path_element_to_bytes,
"path-element->bytes",
1, 1),
scheme_make_immed_prim(path_element_to_bytes,
"path-element->bytes",
1, 1),
env);
scheme_add_global_constant("path-element->string",
scheme_make_prim_w_arity(path_element_to_string,
"path-element->string",
1, 1),
scheme_make_immed_prim(path_element_to_string,
"path-element->string",
1, 1),
env);
scheme_add_global_constant("string->path",
scheme_make_prim_w_arity(string_to_path,
"string->path",
1, 1),
scheme_make_immed_prim(string_to_path,
"string->path",
1, 1),
env);
scheme_add_global_constant("bytes->path",
scheme_make_prim_w_arity(bytes_to_path,
"bytes->path",
1, 2),
scheme_make_immed_prim(bytes_to_path,
"bytes->path",
1, 2),
env);
scheme_add_global_constant("bytes->path-element",
scheme_make_prim_w_arity(bytes_to_path_element,
"bytes->path-element",
1, 2),
scheme_make_immed_prim(bytes_to_path_element,
"bytes->path-element",
1, 2),
env);
scheme_add_global_constant("string->path-element",
scheme_make_prim_w_arity(string_to_path_element,
"string->path-element",
1, 1),
scheme_make_immed_prim(string_to_path_element,
"string->path-element",
1, 1),
env);
scheme_add_global_constant("file-exists?",
@ -410,19 +410,19 @@ void scheme_init_file(Scheme_Env *env)
2, 3),
env);
scheme_add_global_constant("build-path",
scheme_make_prim_w_arity(scheme_build_path,
"build-path",
1, -1),
scheme_make_immed_prim(scheme_build_path,
"build-path",
1, -1),
env);
scheme_add_global_constant("build-path/convention-type",
scheme_make_prim_w_arity(build_path_kind,
"build-path/convention-type",
2, -1),
scheme_make_immed_prim(build_path_kind,
"build-path/convention-type",
2, -1),
env);
scheme_add_global_constant("path->directory-path",
scheme_make_prim_w_arity(path_to_directory_path,
"path->directory-path",
1, 1),
scheme_make_immed_prim(path_to_directory_path,
"path->directory-path",
1, 1),
env);
scheme_add_global_constant("split-path",
scheme_make_prim_w_arity2(split_path,
@ -431,29 +431,29 @@ void scheme_init_file(Scheme_Env *env)
3, 3),
env);
scheme_add_global_constant("explode-path",
scheme_make_prim_w_arity(explode_path,
"explode-path",
1, 1),
scheme_make_immed_prim(explode_path,
"explode-path",
1, 1),
env);
scheme_add_global_constant("relative-path?",
scheme_make_prim_w_arity(relative_path_p,
"relative-path?",
1, 1),
scheme_make_immed_prim(relative_path_p,
"relative-path?",
1, 1),
env);
scheme_add_global_constant("absolute-path?",
scheme_make_prim_w_arity(absolute_path_p,
"absolute-path?",
1, 1),
scheme_make_immed_prim(absolute_path_p,
"absolute-path?",
1, 1),
env);
scheme_add_global_constant("complete-path?",
scheme_make_prim_w_arity(complete_path_p,
"complete-path?",
1, 1),
scheme_make_immed_prim(complete_path_p,
"complete-path?",
1, 1),
env);
scheme_add_global_constant("path->complete-path",
scheme_make_prim_w_arity(path_to_complete_path,
"path->complete-path",
1, 2),
scheme_make_immed_prim(path_to_complete_path,
"path->complete-path",
1, 2),
env);
scheme_add_global_constant("resolve-path",
scheme_make_prim_w_arity(resolve_path,

View File

@ -498,34 +498,34 @@ scheme_init_fun (Scheme_Env *env)
4, 4),
env);
scheme_add_global_constant("current-milliseconds",
scheme_make_prim_w_arity(current_milliseconds,
"current-milliseconds",
0, 0),
scheme_make_immed_prim(current_milliseconds,
"current-milliseconds",
0, 0),
env);
scheme_add_global_constant("current-inexact-milliseconds",
scheme_make_prim_w_arity(current_inexact_milliseconds,
"current-inexact-milliseconds",
0, 0),
scheme_make_immed_prim(current_inexact_milliseconds,
"current-inexact-milliseconds",
0, 0),
env);
scheme_add_global_constant("current-process-milliseconds",
scheme_make_prim_w_arity(current_process_milliseconds,
"current-process-milliseconds",
0, 1),
scheme_make_immed_prim(current_process_milliseconds,
"current-process-milliseconds",
0, 1),
env);
scheme_add_global_constant("current-gc-milliseconds",
scheme_make_prim_w_arity(current_gc_milliseconds,
"current-gc-milliseconds",
0, 0),
scheme_make_immed_prim(current_gc_milliseconds,
"current-gc-milliseconds",
0, 0),
env);
scheme_add_global_constant("current-seconds",
scheme_make_prim_w_arity(current_seconds,
"current-seconds",
0, 0),
scheme_make_immed_prim(current_seconds,
"current-seconds",
0, 0),
env);
scheme_add_global_constant("seconds->date",
scheme_make_prim_w_arity(seconds_to_date,
"seconds->date",
1, 2),
scheme_make_immed_prim(seconds_to_date,
"seconds->date",
1, 2),
env);
#endif

View File

@ -94,9 +94,9 @@ SHARED_OK static Scheme_Object *num_limits[3];
void scheme_init_numstr(Scheme_Env *env)
{
scheme_add_global_constant("number->string",
scheme_make_prim_w_arity(number_to_string,
"number->string",
1, 2),
scheme_make_immed_prim(number_to_string,
"number->string",
1, 2),
env);
scheme_add_global_constant("string->number",
scheme_make_folding_prim(string_to_number,
@ -105,70 +105,70 @@ void scheme_init_numstr(Scheme_Env *env)
env);
scheme_add_global_constant("integer-bytes->integer",
scheme_make_prim_w_arity(bytes_to_integer,
"integer-bytes->integer",
2, 5),
scheme_make_immed_prim(bytes_to_integer,
"integer-bytes->integer",
2, 5),
env);
scheme_add_global_constant("integer->integer-bytes",
scheme_make_prim_w_arity(integer_to_bytes,
"integer->integer-bytes",
3, 6),
scheme_make_immed_prim(integer_to_bytes,
"integer->integer-bytes",
3, 6),
env);
scheme_add_global_constant("floating-point-bytes->real",
scheme_make_prim_w_arity(bytes_to_real,
"floating-point-bytes->real",
1, 4),
scheme_make_immed_prim(bytes_to_real,
"floating-point-bytes->real",
1, 4),
env);
scheme_add_global_constant("real->floating-point-bytes",
scheme_make_prim_w_arity(real_to_bytes,
"real->floating-point-bytes",
2, 5),
scheme_make_immed_prim(real_to_bytes,
"real->floating-point-bytes",
2, 5),
env);
scheme_add_global_constant("system-big-endian?",
scheme_make_prim_w_arity(system_big_endian_p,
"system-big-endian?",
0, 0),
scheme_make_immed_prim(system_big_endian_p,
"system-big-endian?",
0, 0),
env);
scheme_add_global_constant("random",
scheme_make_prim_w_arity(sch_random,
"random",
0, 2),
scheme_make_immed_prim(sch_random,
"random",
0, 2),
env);
scheme_add_global_constant("random-seed",
scheme_make_prim_w_arity(random_seed,
"random-seed",
1, 1),
scheme_make_immed_prim(random_seed,
"random-seed",
1, 1),
env);
scheme_add_global_constant("make-pseudo-random-generator",
scheme_make_prim_w_arity(make_pseudo_random_generator,
"make-pseudo-random-generator",
0, 0),
scheme_make_immed_prim(make_pseudo_random_generator,
"make-pseudo-random-generator",
0, 0),
env);
scheme_add_global_constant("vector->pseudo-random-generator",
scheme_make_prim_w_arity(sch_pack,
"vector->pseudo-random-generator",
1, 1),
scheme_make_immed_prim(sch_pack,
"vector->pseudo-random-generator",
1, 1),
env);
scheme_add_global_constant("vector->pseudo-random-generator!",
scheme_make_prim_w_arity(sch_pack_bang,
"vector->pseudo-random-generator!",
2, 2),
scheme_make_immed_prim(sch_pack_bang,
"vector->pseudo-random-generator!",
2, 2),
env);
scheme_add_global_constant("pseudo-random-generator->vector",
scheme_make_prim_w_arity(sch_unpack,
"pseudo-random-generator->vector",
1, 1),
scheme_make_immed_prim(sch_unpack,
"pseudo-random-generator->vector",
1, 1),
env);
scheme_add_global_constant("pseudo-random-generator-vector?",
scheme_make_prim_w_arity(sch_check_pack,
"pseudo-random-generator-vector?",
1, 1),
scheme_make_immed_prim(sch_check_pack,
"pseudo-random-generator-vector?",
1, 1),
env);
scheme_add_global_constant("pseudo-random-generator?",
scheme_make_prim_w_arity(pseudo_random_generator_p,
"pseudo-random-generator?",
1, 1),
scheme_make_immed_prim(pseudo_random_generator_p,
"pseudo-random-generator?",
1, 1),
env);
scheme_add_global_constant("current-pseudo-random-generator",
scheme_register_parameter(current_pseudo_random_generator,
@ -205,14 +205,14 @@ void scheme_init_numstr(Scheme_Env *env)
void scheme_init_extfl_numstr(Scheme_Env *env)
{
scheme_add_global_constant("floating-point-bytes->extfl",
scheme_make_prim_w_arity(bytes_to_long_double,
"floating-point-bytes->extfl",
1, 4),
scheme_make_immed_prim(bytes_to_long_double,
"floating-point-bytes->extfl",
1, 4),
env);
scheme_add_global_constant("extfl->floating-point-bytes",
scheme_make_prim_w_arity(long_double_to_bytes,
"extfl->floating-point-bytes",
1, 4),
scheme_make_immed_prim(long_double_to_bytes,
"extfl->floating-point-bytes",
1, 4),
env);
}

View File

@ -406,7 +406,7 @@ scheme_init_struct (Scheme_Env *env)
2, 2);
REGISTER_SO(scheme_impersonator_of_property);
scheme_impersonator_of_property = scheme_make_struct_type_property_w_guard(scheme_intern_symbol("impersonator-of"),
guard);
guard);
scheme_add_global_constant("prop:impersonator-of", scheme_impersonator_of_property, env);
}
@ -447,7 +447,7 @@ scheme_init_struct (Scheme_Env *env)
"guard-for-prop:rename-transformer",
2, 2);
rename_transformer_property = scheme_make_struct_type_property_w_guard(scheme_intern_symbol("rename-transformer"),
guard);
guard);
scheme_add_global_constant("prop:rename-transformer", rename_transformer_property, env);
}
@ -471,7 +471,7 @@ scheme_init_struct (Scheme_Env *env)
2, 2);
REGISTER_SO(scheme_checked_proc_property);
scheme_checked_proc_property = scheme_make_struct_type_property_w_guard(scheme_intern_symbol("checked-procedure"),
guard);
guard);
scheme_add_global_constant("prop:checked-procedure", scheme_checked_proc_property, env);
}
@ -522,14 +522,14 @@ scheme_init_struct (Scheme_Env *env)
scheme_add_global_constant("make-struct-type",
scheme_make_struct_type_proc,
env);
env);
scheme_add_global_constant("make-struct-type-property",
scheme_make_prim_w_arity2(make_struct_type_property,
"make-struct-type-property",
1, 4,
3, 3),
env);
scheme_make_prim_w_arity2(make_struct_type_property,
"make-struct-type-property",
1, 4,
3, 3),
env);
REGISTER_SO(scheme_make_struct_field_accessor_proc);
scheme_make_struct_field_accessor_proc = scheme_make_prim_w_arity(make_struct_field_accessor,
@ -592,14 +592,14 @@ scheme_init_struct (Scheme_Env *env)
scheme_add_global_constant("struct-type-property?",
scheme_make_folding_prim(struct_type_property_p,
"struct-type-property?",
1, 1, 1),
env);
"struct-type-property?",
1, 1, 1),
env);
scheme_add_global_constant("procedure-struct-type?",
scheme_make_folding_prim(proc_struct_type_p,
"procedure-struct-type?",
1, 1, 1),
env);
"procedure-struct-type?",
1, 1, 1),
env);
scheme_add_global_constant("procedure-extract-target",
scheme_make_prim_w_arity(procedure_extract_target,
"procedure-extract-target",
@ -636,9 +636,9 @@ scheme_init_struct (Scheme_Env *env)
1, 2),
env);
scheme_add_global_constant("prefab-struct-key",
scheme_make_prim_w_arity(prefab_struct_key,
"prefab-struct-key",
1, 1),
scheme_make_immed_prim(prefab_struct_key,
"prefab-struct-key",
1, 1),
env);
scheme_add_global_constant("make-prefab-struct",
scheme_make_prim_w_arity(make_prefab_struct,
@ -658,52 +658,52 @@ scheme_init_struct (Scheme_Env *env)
/*** Predicates ****/
scheme_add_global_constant("struct-mutator-procedure?",
scheme_make_prim_w_arity(struct_setter_p,
"struct-mutator-procedure?",
1, 1),
env);
scheme_make_immed_prim(struct_setter_p,
"struct-mutator-procedure?",
1, 1),
env);
scheme_add_global_constant("struct-accessor-procedure?",
scheme_make_prim_w_arity(struct_getter_p,
"struct-accessor-procedure?",
1, 1),
env);
scheme_make_immed_prim(struct_getter_p,
"struct-accessor-procedure?",
1, 1),
env);
scheme_add_global_constant("struct-predicate-procedure?",
scheme_make_prim_w_arity(struct_pred_p,
"struct-predicate-procedure?",
1, 1),
scheme_make_immed_prim(struct_pred_p,
"struct-predicate-procedure?",
1, 1),
env);
scheme_add_global_constant("struct-constructor-procedure?",
scheme_make_prim_w_arity(struct_constr_p,
"struct-constructor-procedure?",
1, 1),
scheme_make_immed_prim(struct_constr_p,
"struct-constructor-procedure?",
1, 1),
env);
scheme_add_global_constant("struct-type-property-accessor-procedure?",
scheme_make_prim_w_arity(struct_prop_getter_p,
"struct-type-property-accessor-procedure?",
1, 1),
scheme_make_immed_prim(struct_prop_getter_p,
"struct-type-property-accessor-procedure?",
1, 1),
env);
scheme_add_global_constant("impersonator-property-accessor-procedure?",
scheme_make_prim_w_arity(chaperone_prop_getter_p,
"impersonator-property-accessor-procedure?",
1, 1),
scheme_make_immed_prim(chaperone_prop_getter_p,
"impersonator-property-accessor-procedure?",
1, 1),
env);
/*** Inspectors ****/
REGISTER_SO(scheme_make_inspector_proc);
scheme_make_inspector_proc = scheme_make_prim_w_arity(make_inspector,
"make-inspector",
0, 1);
scheme_make_inspector_proc = scheme_make_immed_prim(make_inspector,
"make-inspector",
0, 1);
scheme_add_global_constant("make-inspector", scheme_make_inspector_proc, env);
scheme_add_global_constant("make-sibling-inspector",
scheme_make_prim_w_arity(make_sibling_inspector,
"make-sibling-inspector",
0, 1),
scheme_make_immed_prim(make_sibling_inspector,
"make-sibling-inspector",
0, 1),
env);
scheme_add_global_constant("inspector?",
scheme_make_prim_w_arity(inspector_p,
scheme_make_folding_prim(inspector_p,
"inspector?",
1, 1),
1, 1, 1),
env);
REGISTER_SO(scheme_current_inspector_proc);
@ -721,14 +721,14 @@ scheme_init_struct (Scheme_Env *env)
scheme_add_global_constant("make-special-comment",
scheme_make_prim_w_arity(make_special_comment,
"make-special-comment",
1, 1),
scheme_make_immed_prim(make_special_comment,
"make-special-comment",
1, 1),
env);
scheme_add_global_constant("special-comment-value",
scheme_make_prim_w_arity(special_comment_value,
"special-comment-value",
1, 1),
scheme_make_immed_prim(special_comment_value,
"special-comment-value",
1, 1),
env);
scheme_add_global_constant("special-comment?",
scheme_make_folding_prim(special_comment_p,