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

View File

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

View File

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

View File

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