Skip to content

Commit 80f7db8

Browse files
authored
remove jl_function_t typealias (#59216)
This has been an alias for a long time now, remove it since it is just confusing/misleading to be different from jl_value_t.
1 parent ecdb4be commit 80f7db8

File tree

19 files changed

+66
-69
lines changed

19 files changed

+66
-69
lines changed

doc/src/devdocs/ast.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -658,10 +658,10 @@ for important details on how to modify these fields safely.
658658
The ABI to use when calling `fptr`. Some significant ones include:
659659

660660
* 0 - Not compiled yet
661-
* 1 - `JL_CALLABLE` `jl_value_t *(*)(jl_function_t *f, jl_value_t *args[nargs], uint32_t nargs)`
661+
* 1 - `JL_CALLABLE` `jl_value_t *(*)(jl_value_t *f, jl_value_t *args[nargs], uint32_t nargs)`
662662
* 2 - Constant (value stored in `rettype_const`)
663-
* 3 - With Static-parameters forwarded `jl_value_t *(*)(jl_svec_t *sparams, jl_function_t *f, jl_value_t *args[nargs], uint32_t nargs)`
664-
* 4 - Run in interpreter `jl_value_t *(*)(jl_method_instance_t *meth, jl_function_t *f, jl_value_t *args[nargs], uint32_t nargs)`
663+
* 3 - With Static-parameters forwarded `jl_value_t *(*)(jl_svec_t *sparams, jl_value_t *f, jl_value_t *args[nargs], uint32_t nargs)`
664+
* 4 - Run in interpreter `jl_value_t *(*)(jl_method_instance_t *meth, jl_value_t *f, jl_value_t *args[nargs], uint32_t nargs)`
665665

666666
* `min_world` / `max_world`
667667

doc/src/devdocs/debuggingtips.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ $2 = void
177177

178178
The most recent `jl_apply` is at frame #3, so we can go back there and look at the AST for the
179179
function `julia_convert_16886`. This is the uniqued name for some method of `convert`. `f` in
180-
this frame is a `jl_function_t*`, so we can look at the type signature, if any, from the `specTypes`
180+
this frame is a `jl_value_t*`, so we can look at the type signature, if any, from the `specTypes`
181181
field:
182182

183183
```

doc/src/devdocs/functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ This entry point for the same functionality accepts the function separately, so
3838
does not contain the function:
3939
4040
```c
41-
jl_value_t *jl_call(jl_function_t *f, jl_value_t **args, int32_t nargs);
41+
jl_value_t *jl_call(jl_value_t *f, jl_value_t **args, int32_t nargs);
4242
```
4343

4444
## Adding methods

doc/src/devdocs/object.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ jl_sym_t *jl_symbol(const char *str);
155155
Functions and MethodInstance:
156156
157157
```c
158-
jl_function_t *jl_new_generic_function(jl_sym_t *name);
158+
jl_value_t *jl_new_generic_function(jl_sym_t *name);
159159
jl_method_instance_t *jl_new_method_instance(jl_value_t *ast, jl_tuple_t *sparams);
160160
```
161161

doc/src/manual/embedding.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ passing arguments computed in C to Julia. For this you will need to invoke Julia
228228
using `jl_call`:
229229

230230
```c
231-
jl_function_t *func = jl_get_function(jl_base_module, "sqrt");
231+
jl_value_t *func = jl_get_function(jl_base_module, "sqrt");
232232
jl_value_t *argument = jl_box_float64(2.0);
233233
jl_value_t *ret = jl_call1(func, argument);
234234
```
@@ -240,7 +240,7 @@ the function is called using `jl_call1`. `jl_call0`, `jl_call2`, and `jl_call3`
240240
exist, to conveniently handle different numbers of arguments. To pass more arguments, use `jl_call`:
241241

242242
```
243-
jl_value_t *jl_call(jl_function_t *f, jl_value_t **args, int32_t nargs)
243+
jl_value_t *jl_call(jl_value_t *f, jl_value_t **args, int32_t nargs)
244244
```
245245

246246
Its second argument `args` is an array of `jl_value_t*` arguments and `nargs` is the number of
@@ -319,7 +319,7 @@ jl_value_t *ret1 = jl_eval_string("sqrt(2.0)");
319319
JL_GC_PUSH1(&ret1);
320320
jl_value_t *ret2 = 0;
321321
{
322-
jl_function_t *func = jl_get_function(jl_base_module, "exp");
322+
jl_value_t *func = jl_get_function(jl_base_module, "exp");
323323
ret2 = jl_call1(func, ret1);
324324
JL_GC_PUSH1(&ret2);
325325
// Do something with ret2.
@@ -350,7 +350,7 @@ properly with mutable types.
350350
```c
351351
// This functions shall be executed only once, during the initialization.
352352
jl_value_t* refs = jl_eval_string("refs = IdDict()");
353-
jl_function_t* setindex = jl_get_function(jl_base_module, "setindex!");
353+
jl_value_t* setindex = jl_get_function(jl_base_module, "setindex!");
354354
355355
...
356356
@@ -374,7 +374,7 @@ container is created by `jl_call*`, then you will need to reload the pointer to
374374
```c
375375
// This functions shall be executed only once, during the initialization.
376376
jl_value_t* refs = jl_eval_string("refs = IdDict()");
377-
jl_function_t* setindex = jl_get_function(jl_base_module, "setindex!");
377+
jl_value_t* setindex = jl_get_function(jl_base_module, "setindex!");
378378
jl_datatype_t* reft = (jl_datatype_t*)jl_eval_string("Base.RefValue{Any}");
379379

380380
...
@@ -401,7 +401,7 @@ The GC can be allowed to deallocate a variable by removing the reference to it f
401401
the function `delete!`, provided that no other reference to the variable is kept anywhere:
402402
403403
```c
404-
jl_function_t* delete = jl_get_function(jl_base_module, "delete!");
404+
jl_value_t* delete = jl_get_function(jl_base_module, "delete!");
405405
jl_call2(delete, refs, rvar);
406406
```
407407

@@ -505,7 +505,7 @@ for (size_t i = 0; i < jl_array_nrows(x); i++)
505505
Now let us call a Julia function that performs an in-place operation on `x`:
506506

507507
```c
508-
jl_function_t *func = jl_get_function(jl_base_module, "reverse!");
508+
jl_value_t *func = jl_get_function(jl_base_module, "reverse!");
509509
jl_call1(func, (jl_value_t*)x);
510510
```
511511
@@ -517,7 +517,7 @@ If a Julia function returns an array, the return value of `jl_eval_string` and `
517517
cast to a `jl_array_t*`:
518518
519519
```c
520-
jl_function_t *func = jl_get_function(jl_base_module, "reverse");
520+
jl_value_t *func = jl_get_function(jl_base_module, "reverse");
521521
jl_array_t *y = (jl_array_t*)jl_call1(func, (jl_value_t*)x);
522522
```
523523

@@ -664,7 +664,7 @@ double c_func(int i)
664664
printf("[C %08x] i = %d\n", pthread_self(), i);
665665

666666
// Call the Julia sqrt() function to compute the square root of i, and return it
667-
jl_function_t *sqrt = jl_get_function(jl_base_module, "sqrt");
667+
jl_value_t *sqrt = jl_get_function(jl_base_module, "sqrt");
668668
jl_value_t* arg = jl_box_int32(i);
669669
double ret = jl_unbox_float64(jl_call1(sqrt, arg));
670670

src/builtins.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,8 +663,8 @@ static jl_value_t *jl_arrayref(jl_array_t *a, size_t i)
663663
JL_CALLABLE(jl_f__apply_iterate)
664664
{
665665
JL_NARGSV(_apply_iterate, 2);
666-
jl_function_t *iterate = args[0];
667-
jl_function_t *f = args[1];
666+
jl_value_t *iterate = args[0];
667+
jl_value_t *f = args[1];
668668
assert(iterate);
669669
args += 1;
670670
nargs -= 1;

src/gc-common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ JL_DLLEXPORT void jl_gc_add_quiescent(jl_ptls_t ptls, void **v, void *f) JL_NOTS
460460
jl_gc_add_finalizer_(ptls, (void*)(((uintptr_t)v) | 3), f);
461461
}
462462

463-
JL_DLLEXPORT void jl_gc_add_finalizer_th(jl_ptls_t ptls, jl_value_t *v, jl_function_t *f) JL_NOTSAFEPOINT
463+
JL_DLLEXPORT void jl_gc_add_finalizer_th(jl_ptls_t ptls, jl_value_t *v, jl_value_t *f) JL_NOTSAFEPOINT
464464
{
465465
if (__unlikely(jl_typetagis(f, jl_voidpointer_type))) {
466466
jl_gc_add_ptr_finalizer(ptls, v, jl_unbox_voidpointer(f));
@@ -470,7 +470,7 @@ JL_DLLEXPORT void jl_gc_add_finalizer_th(jl_ptls_t ptls, jl_value_t *v, jl_funct
470470
}
471471
}
472472

473-
JL_DLLEXPORT void jl_gc_add_finalizer(jl_value_t *v, jl_function_t *f)
473+
JL_DLLEXPORT void jl_gc_add_finalizer(jl_value_t *v, jl_value_t *f)
474474
{
475475
jl_ptls_t ptls = jl_current_task->ptls;
476476
jl_gc_add_finalizer_th(ptls, v, f);

src/gc-common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ extern arraylist_t to_finalize;
195195
void schedule_finalization(void *o, void *f) JL_NOTSAFEPOINT;
196196
void run_finalizer(jl_task_t *ct, void *o, void *ff);
197197
void run_finalizers(jl_task_t *ct, int finalizers_thread);
198-
JL_DLLEXPORT void jl_gc_add_finalizer_th(jl_ptls_t ptls, jl_value_t *v, jl_function_t *f) JL_NOTSAFEPOINT;
198+
JL_DLLEXPORT void jl_gc_add_finalizer_th(jl_ptls_t ptls, jl_value_t *v, jl_value_t *f) JL_NOTSAFEPOINT;
199199
JL_DLLEXPORT void jl_finalize_th(jl_task_t *ct, jl_value_t *o);
200200

201201

src/gf.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -939,12 +939,12 @@ int jl_foreach_reachable_mtable(int (*visit)(jl_methtable_t *mt, void *env), jl_
939939
return 1;
940940
}
941941

942-
jl_function_t *jl_typeinf_func JL_GLOBALLY_ROOTED = NULL;
942+
jl_value_t *jl_typeinf_func JL_GLOBALLY_ROOTED = NULL;
943943
JL_DLLEXPORT size_t jl_typeinf_world = 1;
944944

945945
JL_DLLEXPORT void jl_set_typeinf_func(jl_value_t *f)
946946
{
947-
jl_typeinf_func = (jl_function_t*)f;
947+
jl_typeinf_func = (jl_value_t*)f;
948948
jl_typeinf_world = jl_get_tls_world_age();
949949
}
950950

@@ -4342,7 +4342,7 @@ jl_sym_t *jl_gf_supertype_name(jl_sym_t *name)
43424342
}
43434343

43444344
// Return value is rooted globally
4345-
jl_function_t *jl_new_generic_function_with_supertype(jl_sym_t *name, jl_module_t *module, jl_datatype_t *st, size_t new_world)
4345+
jl_value_t *jl_new_generic_function_with_supertype(jl_sym_t *name, jl_module_t *module, jl_datatype_t *st, size_t new_world)
43464346
{
43474347
// type name is function name prefixed with #
43484348
jl_sym_t *tname = jl_gf_supertype_name(name);
@@ -4358,10 +4358,10 @@ jl_function_t *jl_new_generic_function_with_supertype(jl_sym_t *name, jl_module_
43584358
ftype->instance = f;
43594359
jl_gc_wb(ftype, f);
43604360
JL_GC_POP();
4361-
return (jl_function_t*)f;
4361+
return (jl_value_t*)f;
43624362
}
43634363

4364-
jl_function_t *jl_new_generic_function(jl_sym_t *name, jl_module_t *module, size_t new_world)
4364+
jl_value_t *jl_new_generic_function(jl_sym_t *name, jl_module_t *module, size_t new_world)
43654365
{
43664366
return jl_new_generic_function_with_supertype(name, module, jl_function_type, new_world);
43674367
}

src/jitlayers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ enum CompilationPolicy {
317317
Extern = 1,
318318
};
319319

320-
Function *jl_cfunction_object(jl_function_t *f, jl_value_t *rt, jl_tupletype_t *argt,
320+
Function *jl_cfunction_object(jl_value_t *f, jl_value_t *rt, jl_tupletype_t *argt,
321321
jl_codegen_params_t &params);
322322

323323
extern "C" JL_DLLEXPORT_CODEGEN

0 commit comments

Comments
 (0)