Skip to content

Commit 70f80e7

Browse files
committed
Remove some mostly-unused lowering functions
`jl_expand_stmt`, `jl_expand_stmt_with_loc`, `jl_expand_with_loc`
1 parent d7163da commit 70f80e7

File tree

6 files changed

+4
-39
lines changed

6 files changed

+4
-39
lines changed

src/ast.c

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,21 +1281,7 @@ JL_DLLEXPORT jl_value_t *jl_expand(jl_value_t *expr, jl_module_t *inmodule)
12811281
return jl_lower(expr, inmodule, "none", 0, ~(size_t)0, 0, 0);
12821282
}
12831283

1284-
// Lowering, with starting program location specified
1285-
JL_DLLEXPORT jl_value_t *jl_expand_with_loc(jl_value_t *expr, jl_module_t *inmodule,
1286-
const char *file, int line)
1287-
{
1288-
return jl_lower(expr, inmodule, file, line, ~(size_t)0, 0, 0);
1289-
}
1290-
1291-
// Lowering, with starting program location and worldage specified
1292-
JL_DLLEXPORT jl_value_t *jl_expand_in_world(jl_value_t *expr, jl_module_t *inmodule,
1293-
const char *file, int line, size_t world)
1294-
{
1295-
return jl_lower(expr, inmodule, file, line, world, 0, 0);
1296-
}
1297-
1298-
// Main entry point to flisp lowering
1284+
// Main entry point to flisp lowering. Most arguments are optional; see `jl_expand`.
12991285
// warn: Print any lowering warnings returned; otherwise ignore
13001286
// stmt: Lower knowing that the value of expr is unused
13011287
JL_DLLEXPORT jl_value_t *jl_fl_lower(jl_value_t *expr, jl_module_t *inmodule,
@@ -1351,17 +1337,6 @@ JL_DLLEXPORT jl_value_t *jl_lower(jl_value_t *expr, jl_module_t *inmodule,
13511337
return jl_fl_lower(expr, inmodule, file, line, world, warn, stmt);
13521338
}
13531339

1354-
JL_DLLEXPORT jl_value_t *jl_expand_stmt_with_loc(jl_value_t *expr, jl_module_t *inmodule,
1355-
const char *file, int line)
1356-
{
1357-
return jl_lower(expr, inmodule, file, line, ~(size_t)0, 0, 1);
1358-
}
1359-
1360-
JL_DLLEXPORT jl_value_t *jl_expand_stmt(jl_value_t *expr, jl_module_t *inmodule)
1361-
{
1362-
return jl_lower(expr, inmodule, "none", 0, ~(size_t)0, 0, 1);
1363-
}
1364-
13651340
jl_code_info_t *jl_outer_ctor_body(jl_value_t *thistype, size_t nfields, size_t nsparams, jl_module_t *inmodule, const char *file, int line)
13661341
{
13671342
JL_TIMING(LOWERING, LOWERING);

src/jl_exported_funcs.inc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,6 @@
126126
XX(jl_exit_on_sigint) \
127127
XX(jl_exit_threaded_region) \
128128
XX(jl_expand) \
129-
XX(jl_expand_stmt) \
130-
XX(jl_expand_stmt_with_loc) \
131-
XX(jl_expand_with_loc) \
132129
XX(jl_field_index) \
133130
XX(jl_field_isdefined) \
134131
XX(jl_gc_add_finalizer) \

src/julia.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2258,16 +2258,9 @@ JL_DLLEXPORT jl_value_t *jl_parse_string(const char *text, size_t text_len,
22582258
int offset, int greedy);
22592259
// lowering
22602260
JL_DLLEXPORT jl_value_t *jl_expand(jl_value_t *expr, jl_module_t *inmodule);
2261-
JL_DLLEXPORT jl_value_t *jl_expand_with_loc(jl_value_t *expr, jl_module_t *inmodule,
2262-
const char *file, int line);
22632261
JL_DLLEXPORT jl_value_t *jl_lower(jl_value_t *expr, jl_module_t *inmodule,
22642262
const char *file, int line, size_t world,
22652263
bool_t warn, bool_t stmt);
2266-
JL_DLLEXPORT jl_value_t *jl_expand_in_world(jl_value_t *expr, jl_module_t *inmodule,
2267-
const char *file, int line, size_t world);
2268-
JL_DLLEXPORT jl_value_t *jl_expand_stmt(jl_value_t *expr, jl_module_t *inmodule);
2269-
JL_DLLEXPORT jl_value_t *jl_expand_stmt_with_loc(jl_value_t *expr, jl_module_t *inmodule,
2270-
const char *file, int line);
22712264
// deprecated; use jl_parse_all
22722265
JL_DLLEXPORT jl_value_t *jl_parse_input_line(const char *text, size_t text_len,
22732266
const char *filename, size_t filename_len);

src/toplevel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ static jl_value_t *jl_eval_module_expr(jl_module_t *parent_module, jl_expr_t *ex
196196
for (int i = 0; i < jl_array_nrows(exprs); i++) {
197197
// process toplevel form
198198
ct->world_age = jl_atomic_load_acquire(&jl_world_counter);
199-
form = jl_expand_stmt_with_loc(jl_array_ptr_ref(exprs, i), newm, filename, lineno);
199+
form = jl_lower(jl_array_ptr_ref(exprs, i), newm, filename, lineno, ~(size_t)0, 0, 1);
200200
ct->world_age = jl_atomic_load_acquire(&jl_world_counter);
201201
(void)jl_toplevel_eval_flex(newm, form, 1, 1, &filename, &lineno);
202202
}

stdlib/REPL/src/REPL.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ const install_packages_hooks = Any[]
298298
# We need to do this for both the actual eval and macroexpand, since the latter can cause custom macro
299299
# code to run (and error).
300300
__repl_entry_lower_with_loc(mod::Module, @nospecialize(ast), toplevel_file::Ref{Ptr{UInt8}}, toplevel_line::Ref{Cint}) =
301-
ccall(:jl_expand_with_loc, Any, (Any, Any, Ptr{UInt8}, Cint), ast, mod, toplevel_file[], toplevel_line[])
301+
ccall(:jl_lower, Any, (Any, Any, Ptr{UInt8}, Cint, Csize_t, Cint, Cint), ast, mod, toplevel_file[], toplevel_line[], typemax(Csize_t), 0, 0)
302302
__repl_entry_eval_expanded_with_loc(mod::Module, @nospecialize(ast), toplevel_file::Ref{Ptr{UInt8}}, toplevel_line::Ref{Cint}) =
303303
ccall(:jl_toplevel_eval_flex, Any, (Any, Any, Cint, Cint, Ptr{Ptr{UInt8}}, Ptr{Cint}), mod, ast, 1, 1, toplevel_file, toplevel_line)
304304

test/meta.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ let ex = Meta.parseall("@foo", filename=:bar)
234234
@test isa(arg2arg2, LineNumberNode) && arg2arg2.file === :bar
235235
end
236236

237-
_lower(m::Module, ex, world::UInt) = ccall(:jl_expand_in_world, Any, (Any, Ref{Module}, Cstring, Cint, Csize_t), ex, m, "none", 0, world)
237+
_lower(m::Module, ex, world::UInt) = ccall(:jl_lower, Any, (Any, Ref{Module}, Cstring, Cint, Csize_t, Cint, Cint), ex, m, "none", 0, world, 0, 0)
238238

239239
module TestExpandInWorldModule
240240
macro m() 1 end

0 commit comments

Comments
 (0)