Skip to content

Commit 9da26f2

Browse files
authored
Merge pull request #17286 from JuliaLang/jn/anticg
fallback anticodegen compile to use interpreter, rather than error
2 parents 5c44a4a + 339849d commit 9da26f2

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/anticodegen.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ void jl_dump_objfile(char *fname, int jit_model, const char *sysimg_data, size_t
1414
int32_t jl_get_llvm_gv(jl_value_t *p) UNAVAILABLE
1515
void jl_write_malloc_log(void) UNAVAILABLE
1616
void jl_write_coverage_data(void) UNAVAILABLE
17-
void jl_generate_fptr(jl_lambda_info_t *li) UNAVAILABLE
18-
void jl_compile_linfo(jl_lambda_info_t *li) UNAVAILABLE
1917

2018
JL_DLLEXPORT void jl_clear_malloc_data(void) UNAVAILABLE
2119
JL_DLLEXPORT void jl_extern_c(jl_function_t *f, jl_value_t *rt, jl_value_t *argt, char *name) UNAVAILABLE
@@ -48,3 +46,12 @@ void jl_register_fptrs(uint64_t sysimage_base, void **fptrs, jl_lambda_info_t **
4846
{
4947
(void)sysimage_base; (void)fptrs; (void)linfos; (void)n;
5048
}
49+
50+
void jl_compile_linfo(jl_lambda_info_t *li) { }
51+
52+
jl_value_t *jl_interpret_call(jl_lambda_info_t *lam, jl_value_t **args, uint32_t nargs);
53+
void jl_generate_fptr(jl_lambda_info_t *li)
54+
{
55+
li->fptr = (jl_fptr_t)&jl_interpret_call;
56+
li->jlcall_api = 3;
57+
}

src/julia.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ STATIC_INLINE int jl_array_ndimwords(uint32_t ndims)
168168
}
169169

170170
typedef struct _jl_datatype_t jl_tupletype_t;
171+
struct _jl_lambda_info_t;
171172

172173
// TypeMap is an implicitly defined type
173174
// that can consist of any of the following nodes:
@@ -187,6 +188,7 @@ union jl_typemap_t {
187188
// This defines the default ABI used by compiled julia functions.
188189
typedef jl_value_t *(*jl_fptr_t)(jl_value_t*, jl_value_t**, uint32_t);
189190
typedef jl_value_t *(*jl_fptr_sparam_t)(jl_svec_t*, jl_value_t*, jl_value_t**, uint32_t);
191+
typedef jl_value_t *(*jl_fptr_linfo_t)(struct _jl_lambda_info_t*, jl_value_t**, uint32_t, jl_svec_t*);
190192

191193
typedef struct _jl_llvm_functions_t {
192194
void *functionObject; // jlcall llvm Function

src/julia_internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ STATIC_INLINE jl_value_t *jl_call_method_internal(jl_lambda_info_t *meth, jl_val
174174
return ((jl_fptr_sparam_t)mfptr->fptr)(meth->sparam_vals, args[0], &args[1], nargs-1);
175175
else if (mfptr->jlcall_api == 2)
176176
return meth->constval;
177+
else if (mfptr->jlcall_api == 3)
178+
return ((jl_fptr_linfo_t)mfptr->fptr)(mfptr, &args[0], nargs, meth->sparam_vals);
177179
else
178180
abort();
179181
}

0 commit comments

Comments
 (0)