Skip to content

Commit

Permalink
Merge pull request #33724 from JuliaLang/jn/layout-reorg
Browse files Browse the repository at this point in the history
datatype: reorganize layout calculation code
  • Loading branch information
vtjnash authored Nov 18, 2019
2 parents 05a80e1 + 4e0d353 commit 1e39c69
Show file tree
Hide file tree
Showing 10 changed files with 292 additions and 297 deletions.
10 changes: 5 additions & 5 deletions base/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,10 @@ datatype_fieldtypes(x::DataType) = ccall(:jl_get_fieldtypes, Any, (Any,), x)

struct DataTypeLayout
nfields::UInt32
npointers::UInt32
alignment::UInt32
# alignment : 28;
# alignment : 9;
# haspadding : 1;
# pointerfree : 1;
# fielddesc_type : 2;
end

Expand Down Expand Up @@ -380,8 +380,8 @@ Can be called on any `isconcretetype`.
function datatype_pointerfree(dt::DataType)
@_pure_meta
dt.layout == C_NULL && throw(UndefRefError())
alignment = unsafe_load(convert(Ptr{DataTypeLayout}, dt.layout)).alignment
return (alignment >> 10) & 0xFFFFF == 0
npointers = unsafe_load(convert(Ptr{DataTypeLayout}, dt.layout)).npointers
return npointers == 0
end

"""
Expand All @@ -397,7 +397,7 @@ function datatype_fielddesc_type(dt::DataType)
@_pure_meta
dt.layout == C_NULL && throw(UndefRefError())
alignment = unsafe_load(convert(Ptr{DataTypeLayout}, dt.layout)).alignment
return (alignment >> 30) & 3
return (alignment >> 10) & 3
end

"""
Expand Down
Loading

2 comments on commit 1e39c69

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

Please sign in to comment.