Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Compiler/test/codegen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ let io = IOBuffer()
code_llvm(io,foo54166, (Vector{Union{Missing,Int}}, Int, Int), dump_module=true, raw=true)
str = String(take!(io))
@test !occursin("jtbaa_unionselbyte", str)
@test occursin("jtbaa_arrayselbyte", str)
@test occursin("jtbaa_memoryselbyte", str)
end

ex54166 = Union{Missing, Int64}[missing -2; missing -2];
Expand Down
4 changes: 2 additions & 2 deletions base/errorshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@ end

function _backtrace_remove_kwcall_frames!(trace)
todelete = findall(trace) do (frame, _)
code = frame.linfo
code = StackTraces.frame_mi(frame)
if code isa MethodInstance
def = code.def
if def isa Method && def.name !== :kwcall && def.sig <: Tuple{typeof(Core.kwcall),NamedTuple,Any,Vararg}
Expand All @@ -1205,7 +1205,7 @@ function _backtrace_remove_kwcall_frames!(trace)
# the argument list, since it has the right line number info)
return true
end
else
else # this branch may not be needed, from before current keyword argument handling
frame.func === :kwcall && return true
end
return false
Expand Down
5 changes: 5 additions & 0 deletions base/essentials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,11 @@ unsafe_convert(::Type{P}, x::Ptr) where {P<:Ptr} = convert(P, x)
unsafe_convert(::Type{Ptr{UInt8}}, s::String) = ccall(:jl_string_ptr, Ptr{UInt8}, (Any,), s)
unsafe_convert(::Type{Ptr{Int8}}, s::String) = ccall(:jl_string_ptr, Ptr{Int8}, (Any,), s)

# We don't add any _reinterpret methods until we include reinterpretarray.jl,
# but defining the function up front avoids a whole lot of invalidations when we
# do.
function _reinterpret end

"""
reinterpret(::Type{Out}, x::In)

Expand Down
2 changes: 1 addition & 1 deletion base/rational.jl
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ function hash(x::Rational{<:BitInteger64}, h::UInt)
end
end
h = hash_integer(pow, h)
h = hash_integer((pow > 0) ? (num << (pow % 64)) : num, h)
h = hash_integer((pow > 0) ? (num << (pow % 8)) : num, h)
return h
end

Expand Down
17 changes: 12 additions & 5 deletions base/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1130,13 +1130,20 @@ function hasmethod(f, t, kwnames::Tuple{Vararg{Symbol}}; world::UInt=get_world_c
end

"""
fbody = bodyfunction(basemethod::Method)
fbody = bodyfunction(basemethod::Method; world::UInt=Base.get_world_counter())

Find the keyword "body function" (the function that contains the body of the method
as written, called after all missing keyword-arguments have been assigned default values).
`basemethod` is the method you obtain via [`which`](@ref) or [`methods`](@ref).

The binding of the body function is looked up in the world age given by `world`, which
defaults to the current world counter.

!!! compat "Julia 1.14"
The `world` keyword argument requires Julia 1.14 or later. Before Julia 1.14,
the binding was looked up in the world age of the calling task.
"""
function bodyfunction(basemethod::Method)
function bodyfunction(basemethod::Method; world::UInt=get_world_counter())
fmod = parentmodule(basemethod)
# The lowered code for `basemethod` should look like
# %1 = mkw(kwvalues..., #self#, args...)
Expand All @@ -1149,17 +1156,17 @@ function bodyfunction(basemethod::Method)
fsym = callexpr.args[0]
while true
if isa(fsym, Symbol)
return getfield(fmod, fsym)
return invoke_in_world(world, getglobal, fmod, fsym)
elseif isa(fsym, GlobalRef)
if fsym.mod === Core && fsym.name === :_apply
fsym = callexpr.args[1]
elseif fsym.mod === Core && fsym.name === :_apply_iterate
fsym = callexpr.args[2]
end
if isa(fsym, Symbol)
return getfield(fmod, fsym)::Function
return invoke_in_world(world, getglobal, fmod, fsym)::Function
elseif isa(fsym, GlobalRef)
return getfield(fsym.mod, fsym.name)::Function
return invoke_in_world(world, getglobal, fsym.mod, fsym.name)::Function
elseif isa(fsym, Core.SSAValue)
fsym = ast.code[fsym.id-1]
else
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contrib/upstream-sync/state.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"upstream": "https://github.com/JuliaLang/julia.git",
"branch": "master",
"integrated_sha": "81093121d4e6cf469154d977e2ecd6b7488ea0de",
"integrated_sha": "346d02acc25c3c4c7d56f2fa825a0af0b6b5cd79",
"max_commits": 20,
"max_changed_lines": 2500,
"max_patch_bytes": 250000
Expand Down
2 changes: 1 addition & 1 deletion deps/ittapi.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ITTAPI_GIT_URL := https://github.com/intel/ittapi.git
ITTAPI_TAR_URL = https://api.github.com/repos/intel/ittapi/tarball/$1
$(eval $(call git-external,ittapi,ITTAPI,CMakeLists.txt,,$(SRCCACHE)))

ITTAPI_OPTS := $(CMAKE_COMMON) -DCMAKE_BUILD_TYPE=Release -DITT_API_IPT_SUPPORT= -DITT_API_FORTRAN_SUPPORT=0
ITTAPI_OPTS := $(CMAKE_COMMON) -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=Release -DITT_API_IPT_SUPPORT= -DITT_API_FORTRAN_SUPPORT=0

$(BUILDDIR)/$(ITTAPI_SRC_DIR)/build-configured: $(SRCCACHE)/$(ITTAPI_SRC_DIR)/source-extracted
mkdir -p $(dir $@)
Expand Down
5 changes: 3 additions & 2 deletions deps/tools/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,10 @@ install-$(strip $1): $$(build_prefix)/manifest/$(strip $1)
ifeq (exists, $$(shell [ -e $$(build_staging)/$2.tar ] && echo exists ))
# clean depends on uninstall only if the staged file exists
distclean-$(strip $1) clean-$(strip $1): uninstall-$(strip $1)
else
else ifeq (exists, $$(shell [ -e $$(build_prefix)/manifest/$(strip $1) ] && echo exists ))
# uninstall depends on staging only if the staged file doesn't exist
# otherwise, uninstall doesn't actually want the file to be updated first
# but the dep is installed; otherwise, uninstall doesn't actually want
# the file to be updated first (or has nothing to uninstall)
uninstall-$(strip $1): | $$(build_staging)/$2.tar
endif

Expand Down
5 changes: 4 additions & 1 deletion deps/tools/uninstallers.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ ifeq (undefined,$$(flavor $$(word 2,$$(MANIFEST_$1))))
MANIFEST_$1 := $$(UNINSTALL_$1)
endif
UNINST_HOW_$1 := $$(word 2,$$(MANIFEST_$1))
ifneq ($$(UNINST_HOW_$1),)
ifeq (,$$(wildcard $$(build_prefix)/manifest/$1))
uninstall-$1:
@echo "skipping uninstall: $1 not installed"
else ifneq ($$(UNINST_HOW_$1),)
UNINST_WHO_$1 := $$(firstword $$(MANIFEST_$1))
UNINST_WHERE_$1 := $$(wordlist 3,99,$$(MANIFEST_$1))
$$(eval $$(call $$(UNINST_HOW_$1),$1,$$(UNINST_WHO_$1),$$(UNINST_WHERE_$1)))
Expand Down
93 changes: 93 additions & 0 deletions doc/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,98 @@ function generate_agent_skill_docs()
end
AgentSkillDocs = generate_agent_skill_docs()

# Shared machinery for the generated tab-completion tables in
# `manual/unicode-input.md` and `manual/emoji-input.md`. The LaTeX and emoji
# tables are each large enough that rendering both on one page takes the
# generated HTML past Documenter's `size_threshold`, so they live on separate
# pages and both call into this module.
module UnicodeTables

import Markdown

const NBSP = '\u00A0'

# Invert the completion tables: map each completed string to every tab
# completion sequence that produces it.
function tab_completions(symbols...)
completions = Dict{String, Vector{String}}()
for each in symbols, (k, v) in each
completions[v] = push!(get!(completions, v, String[]), k)
end
return completions
end

# `UnicodeData.txt` is downloaded into the build root by `doc/Makefile`, which
# is not the directory this file lives in for out-of-tree builds.
unicode_data_file() = joinpath(Main.buildrootdoc, "UnicodeData.txt")

# Parsed once and shared by every page that renders a table.
const UNICODE_NAMES = Dict{UInt32, String}()

function unicode_data()
isempty(UNICODE_NAMES) || return UNICODE_NAMES
open(unicode_data_file()) do unidata
for line in readlines(unidata)
id, name, desc = split(line, ";")[[0, 1, 10]]
codepoint = parse(UInt32, "0x$id")
UNICODE_NAMES[codepoint] = titlecase(lowercase(
name == "" ? desc : desc == "" ? name : "$name / $desc"))
end
end
return UNICODE_NAMES
end

# Surround combining characters with no-break spaces (i.e '\u00A0'). Follows the same format
# for how unicode is displayed on the unicode.org website:
# https://util.unicode.org/UnicodeJsps/character.jsp?a=0300
function fix_combining_chars(char)
cat = Base.Unicode.category_code(char)
return cat == 6 || cat == 8 ? "$NBSP$char$NBSP" : "$char"
end

function table_entries(completions, unicode_dict)
entries = Any[Any[
["Code point(s)"],
["Character(s)"],
["Tab completion sequence(s)"],
["Unicode name(s)"],
]]
for (chars, inputs) in sort!(collect(completions), by = first)
code_points, unicode_names, characters = String[], String[], String[]
for char in chars
push!(code_points, "U+$(uppercase(string(UInt32(char), base = 16, pad = 5)))")
push!(unicode_names, get(unicode_dict, UInt32(char), "(No Unicode name)"))
push!(characters, isempty(characters) ? fix_combining_chars(char) : "$char")
end
inputs_md = []
for (i, input) in enumerate(inputs)
i > 0 && push!(inputs_md, ", ")
push!(inputs_md, Markdown.Code("", input))
end
push!(entries, [
[join(code_points, " + ")],
[join(characters)],
inputs_md,
[join(unicode_names, " + ")],
])
end
table = Markdown.Table(entries, [:l, :c, :l, :l])
# We also need to wrap the Table in a Markdown.MD "document"
return Markdown.MD([table])
end

"""
symbol_table(symbols...)

Render the tab completions in `symbols` (dictionaries mapping a completion
sequence to the string it expands to, such as `REPL.REPLCompletions.latex_symbols`)
as a Markdown table, annotated with the code points and Unicode names of each
completed character.
"""
symbol_table(symbols...) = table_entries(tab_completions(symbols...), unicode_data())

end # module UnicodeTables

Manual = [
"manual/getting-started.md",
"manual/installation.md",
Expand Down Expand Up @@ -280,6 +372,7 @@ Manual = [
"manual/faq.md",
"manual/noteworthy-differences.md",
"manual/unicode-input.md",
"manual/emoji-input.md",
"manual/command-line-interface.md",
"manual/worldage.md",
]
Expand Down
23 changes: 23 additions & 0 deletions doc/src/manual/emoji-input.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Emoji Input

The following table lists the emoji that can be entered via tab completion of
their `\:name:` abbreviations in the Julia REPL (and in various other
editing environments). You can also get information on how to type an emoji by
entering it in the REPL help, i.e. by typing `?` and then entering the emoji in
the REPL (e.g., by copy-paste from somewhere you saw the emoji).

For the LaTeX-like abbreviations that complete to mathematical symbols and
other non-emoji characters, see [Unicode Input](@ref).

!!! warning

This table may appear to contain missing characters in the second column, or even
show characters that are inconsistent with the characters as they are rendered in
the Julia REPL. In these cases, users are strongly advised to check their choice
of fonts in their browser and REPL environment, as there are known issues with
glyphs in many fonts.

```@eval
import REPL
Main.UnicodeTables.symbol_table(REPL.REPLCompletions.emoji_symbols)
```
79 changes: 5 additions & 74 deletions doc/src/manual/unicode-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ type a symbol by entering it in the REPL help, i.e. by typing `?` and then
entering the symbol in the REPL (e.g., by copy-paste from somewhere you saw
the symbol).

Emoji are completed from their own set of abbreviations and are listed
separately in [Emoji Input](@ref).

!!! warning

This table may appear to contain missing characters in the second column, or even
Expand All @@ -16,78 +19,6 @@ the symbol).
glyphs in many fonts.

```@eval
#
# Generate a table containing all LaTeX and Emoji tab completions available in the REPL.
#
import REPL, Markdown
const NBSP = '\u00A0'

function tab_completions(symbols...)
completions = Dict{String, Vector{String}}()
for each in symbols, (k, v) in each
completions[v] = push!(get!(completions, v, String[]), k)
end
return completions
end

function unicode_data()
file = normpath(@__DIR__, "..", "..", "..", "..", "..", "doc", "UnicodeData.txt")
names = Dict{UInt32, String}()
open(file) do unidata
for line in readlines(unidata)
id, name, desc = split(line, ";")[[1, 2, 11]]
codepoint = parse(UInt32, "0x$id")
names[codepoint] = titlecase(lowercase(
name == "" ? desc : desc == "" ? name : "$name / $desc"))
end
end
return names
end

# Surround combining characters with no-break spaces (i.e '\u00A0'). Follows the same format
# for how unicode is displayed on the unicode.org website:
# https://util.unicode.org/UnicodeJsps/character.jsp?a=0300
function fix_combining_chars(char)
cat = Base.Unicode.category_code(char)
return cat == 6 || cat == 8 ? "$NBSP$char$NBSP" : "$char"
end

function table_entries(completions, unicode_dict)
entries = Any[Any[
["Code point(s)"],
["Character(s)"],
["Tab completion sequence(s)"],
["Unicode name(s)"],
]]
for (chars, inputs) in sort!(collect(completions), by = first)
code_points, unicode_names, characters = String[], String[], String[]
for char in chars
push!(code_points, "U+$(uppercase(string(UInt32(char), base = 16, pad = 5)))")
push!(unicode_names, get(unicode_dict, UInt32(char), "(No Unicode name)"))
push!(characters, isempty(characters) ? fix_combining_chars(char) : "$char")
end
inputs_md = []
for (i, input) in enumerate(inputs)
i > 1 && push!(inputs_md, ", ")
push!(inputs_md, Markdown.Code("", input))
end
push!(entries, [
[join(code_points, " + ")],
[join(characters)],
inputs_md,
[join(unicode_names, " + ")],
])
end
table = Markdown.Table(entries, [:l, :c, :l, :l])
# We also need to wrap the Table in a Markdown.MD "document"
return Markdown.MD([table])
end

table_entries(
tab_completions(
REPL.REPLCompletions.latex_symbols,
REPL.REPLCompletions.emoji_symbols
),
unicode_data()
)
import REPL
Main.UnicodeTables.symbol_table(REPL.REPLCompletions.latex_symbols)
```
Loading
Loading