@@ -82,25 +82,12 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
82
82
push! (new_expr. args, QuoteNode (x))
83
83
end
84
84
return maybe_recurse_expanded_builtin (frame, new_expr)
85
- elseif f === Core. _apply_pure
86
- return Some {Any} (Core. _apply_pure (getargs (args, frame)... ))
87
- elseif f === Core. _call_in_world
88
- return Some {Any} (Core. _call_in_world (getargs (args, frame)... ))
89
85
elseif f === Core. _call_in_world_total
90
86
return Some {Any} (Core. _call_in_world_total (getargs (args, frame)... ))
91
- elseif f === Core. _call_latest
92
- args = getargs (args, frame)
93
- if ! expand
94
- return Some {Any} (Core. _call_latest (args... ))
95
- end
96
- new_expr = Expr (:call , args[1 ])
97
- popfirst! (args)
98
- for x in args
99
- push! (new_expr. args, QuoteNode (x))
100
- end
101
- return maybe_recurse_expanded_builtin (frame, new_expr)
102
87
elseif f === Core. _compute_sparams
103
88
return Some {Any} (Core. _compute_sparams (getargs (args, frame)... ))
89
+ elseif f === Core. _defaultctors
90
+ return Some {Any} (Core. _defaultctors (getargs (args, frame)... ))
104
91
elseif f === Core. _equiv_typedef
105
92
return Some {Any} (Core. _equiv_typedef (getargs (args, frame)... ))
106
93
elseif f === Core. _expr
@@ -153,16 +140,20 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
153
140
end
154
141
elseif f === Core. get_binding_type
155
142
if nargs == 2
156
- return Some {Any} (Core. get_binding_type ( @lookup (frame, args[2 ]), @lookup (frame, args[3 ])))
143
+ return Some {Any} (Base . invoke_in_world (frame . world, Core. get_binding_type, @lookup (frame, args[2 ]), @lookup (frame, args[3 ])))
157
144
else
158
- return Some {Any} (Core. get_binding_type ( getargs (args, frame)... ))
145
+ return Some {Any} (Base . invoke_in_world (frame . world, Core. get_binding_type, getargs (args, frame)... ))
159
146
end
160
147
elseif f === Core. ifelse
161
148
if nargs == 3
162
149
return Some {Any} (Core. ifelse (@lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ])))
163
150
else
164
151
return Some {Any} (Core. ifelse (getargs (args, frame)... ))
165
152
end
153
+ elseif f === Core. invoke_in_world
154
+ return Some {Any} (Core. invoke_in_world (getargs (args, frame)... ))
155
+ elseif f === Core. invokelatest
156
+ return Some {Any} (Core. invokelatest (getargs (args, frame)... ))
166
157
elseif @static isdefined (Core, :memorynew ) && f === Core. memorynew
167
158
if nargs == 2
168
159
return Some {Any} (Core. memorynew (@lookup (frame, args[2 ]), @lookup (frame, args[3 ])))
@@ -303,11 +294,11 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
303
294
end
304
295
elseif @static isdefined (Core, :modifyglobal! ) && f === modifyglobal!
305
296
if nargs == 4
306
- return Some {Any} (modifyglobal! ( @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ])))
297
+ return Some {Any} (Base . invoke_in_world (frame . world, modifyglobal!, @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ])))
307
298
elseif nargs == 5
308
- return Some {Any} (modifyglobal! ( @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ]), @lookup (frame, args[6 ])))
299
+ return Some {Any} (Base . invoke_in_world (frame . world, modifyglobal!, @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ]), @lookup (frame, args[6 ])))
309
300
else
310
- return Some {Any} (modifyglobal! ( getargs (args, frame)... ))
301
+ return Some {Any} (Base . invoke_in_world (frame . world, modifyglobal!, getargs (args, frame)... ))
311
302
end
312
303
elseif f === nfields
313
304
if nargs == 1
@@ -327,13 +318,13 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
327
318
end
328
319
elseif @static isdefined (Core, :replaceglobal! ) && f === replaceglobal!
329
320
if nargs == 4
330
- return Some {Any} (replaceglobal! ( @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ])))
321
+ return Some {Any} (Base . invoke_in_world (frame . world, replaceglobal!, @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ])))
331
322
elseif nargs == 5
332
- return Some {Any} (replaceglobal! ( @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ]), @lookup (frame, args[6 ])))
323
+ return Some {Any} (Base . invoke_in_world (frame . world, replaceglobal!, @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ]), @lookup (frame, args[6 ])))
333
324
elseif nargs == 6
334
- return Some {Any} (replaceglobal! ( @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ]), @lookup (frame, args[6 ]), @lookup (frame, args[7 ])))
325
+ return Some {Any} (Base . invoke_in_world (frame . world, replaceglobal!, @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ]), @lookup (frame, args[6 ]), @lookup (frame, args[7 ])))
335
326
else
336
- return Some {Any} (replaceglobal! ( getargs (args, frame)... ))
327
+ return Some {Any} (Base . invoke_in_world (frame . world, replaceglobal!, getargs (args, frame)... ))
337
328
end
338
329
elseif f === setfield!
339
330
if nargs == 3
@@ -355,21 +346,21 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
355
346
end
356
347
elseif f === setglobal!
357
348
if nargs == 3
358
- return Some {Any} (setglobal! ( @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ])))
349
+ return Some {Any} (Base . invoke_in_world (frame . world, setglobal!, @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ])))
359
350
elseif nargs == 4
360
- return Some {Any} (setglobal! ( @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ])))
351
+ return Some {Any} (Base . invoke_in_world (frame . world, setglobal!, @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ])))
361
352
else
362
- return Some {Any} (setglobal! ( getargs (args, frame)... ))
353
+ return Some {Any} (Base . invoke_in_world (frame . world, setglobal!, getargs (args, frame)... ))
363
354
end
364
355
elseif @static isdefined (Core, :setglobalonce! ) && f === setglobalonce!
365
356
if nargs == 3
366
- return Some {Any} (setglobalonce! ( @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ])))
357
+ return Some {Any} (Base . invoke_in_world (frame . world, setglobalonce!, @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ])))
367
358
elseif nargs == 4
368
- return Some {Any} (setglobalonce! ( @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ])))
359
+ return Some {Any} (Base . invoke_in_world (frame . world, setglobalonce!, @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ])))
369
360
elseif nargs == 5
370
- return Some {Any} (setglobalonce! ( @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ]), @lookup (frame, args[6 ])))
361
+ return Some {Any} (Base . invoke_in_world (frame . world, setglobalonce!, @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ]), @lookup (frame, args[6 ])))
371
362
else
372
- return Some {Any} (setglobalonce! ( getargs (args, frame)... ))
363
+ return Some {Any} (Base . invoke_in_world (frame . world, setglobalonce!, getargs (args, frame)... ))
373
364
end
374
365
elseif f === swapfield!
375
366
if nargs == 3
@@ -381,11 +372,11 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
381
372
end
382
373
elseif @static isdefined (Core, :swapglobal! ) && f === swapglobal!
383
374
if nargs == 3
384
- return Some {Any} (swapglobal! ( @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ])))
375
+ return Some {Any} (Base . invoke_in_world (frame . world, swapglobal!, @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ])))
385
376
elseif nargs == 4
386
- return Some {Any} (swapglobal! ( @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ])))
377
+ return Some {Any} (Base . invoke_in_world (frame . world, swapglobal!, @lookup (frame, args[2 ]), @lookup (frame, args[3 ]), @lookup (frame, args[4 ]), @lookup (frame, args[5 ])))
387
378
else
388
- return Some {Any} (swapglobal! ( getargs (args, frame)... ))
379
+ return Some {Any} (Base . invoke_in_world (frame . world, swapglobal!, getargs (args, frame)... ))
389
380
end
390
381
elseif f === throw
391
382
if nargs == 1
@@ -503,6 +494,22 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
503
494
else
504
495
return Some {Any} (Core. set_binding_type! (getargs (args, frame)... ))
505
496
end
497
+ elseif @static (isdefined (Core, :_apply_pure ) && Core. _apply_pure isa Core. Builtin) && f === Core. _apply_pure
498
+ return Some {Any} (Core. _apply_pure (getargs (args, frame)... ))
499
+ elseif @static (isdefined (Core, :_call_in_world ) && Core. _call_in_world isa Core. Builtin) && f === Core. _call_in_world
500
+ return Some {Any} (Core. _call_in_world (getargs (args, frame)... ))
501
+ elseif @static (isdefined (Core, :_call_latest ) && Core. _call_latest isa Core. Builtin) && f === Core. _call_latest
502
+ args = getargs (args, frame)
503
+ if ! expand
504
+ return Some {Any} (Core. _call_latest (args... ))
505
+ end
506
+ new_expr = Expr (:call , args[1 ])
507
+ popfirst! (args)
508
+ for x in args
509
+ push! (new_expr. args, QuoteNode (x))
510
+ end
511
+ return maybe_recurse_expanded_builtin (frame, new_expr)
512
+
506
513
elseif f === Core. Intrinsics. llvmcall
507
514
return Some {Any} (Core. Intrinsics. llvmcall (getargs (args, frame)... ))
508
515
end
0 commit comments