Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few cleanup/optimizations related to tag handling in codegen #24283

Merged
merged 1 commit into from
Oct 31, 2017

Conversation

yuyichao
Copy link
Contributor

  • Create julia.typeof and julia.write_barrier intrinsics

    So that tag access is easier for the llvm passes to handle.
    This also completely hides the tag access from LLVM before lowering of these intrinsics
    which makes it possible to mark the write barrier as inaccessiblememonly and enable
    store to load forwarding on mutable types.

  • Mark jl_gc_queue_root as inaccessiblemem_or_argmemonly.

    Should also have a positive impact on LLVM memory access optimizations.

  • In non-imaging mode, use the pointer literals directly for union type.

  • Remove old code that check whether the child is NULL before running the write barrier

    This is not needed anymore.

  • Mark functions returning julia object as nonnull return.

    This can avoid NULL check together with the improved store to load forwarding.

  • Remove jlnewbits_func which is not used in codegen anymore.

  • Fix LateLowerGCFrame initialization

    runOnFunction shouldn't modify the Module.

The change should also make it easier to do more allocation optmization in LLVM for objects
with object reference as fields.

@yuyichao yuyichao added the compiler:codegen Generation of LLVM IR and native code label Oct 23, 2017
@maleadt
Copy link
Member

maleadt commented Oct 23, 2017

Fix LateLowerGCFrame initialization

runOnFunction shouldn't modify the Module.

#23621

@yuyichao yuyichao force-pushed the yyc/codegen/tag branch 3 times, most recently from 5dfdf48 to 06002c9 Compare October 23, 2017 13:47
@yuyichao
Copy link
Contributor Author

I can't find LLVM doc for how to deal with this but the solution seems wrong since it is explicitly documented that runFunction shouldn't do this.

@yuyichao
Copy link
Contributor Author

... I should stop adding more stuff to this PR.... This is now ~5 PR's squashed into one....

@yuyichao yuyichao force-pushed the yyc/codegen/tag branch 3 times, most recently from 357827d to 7b8a9b9 Compare October 26, 2017 01:05
@yuyichao
Copy link
Contributor Author

Review? Should I merge this as is or should I split things out a little?

@yuyichao yuyichao force-pushed the yyc/codegen/tag branch 3 times, most recently from c1da47a to aa8adc8 Compare October 30, 2017 04:14
* Create `julia.typeof` and `julia.write_barrier` intrinsics

  So that tag access is easier for the llvm passes to handle.
  This also completely hides the tag access from LLVM before lowering of these intrinsics
  which makes it possible to mark the write barrier as `inaccessiblememonly` and enable
  store to load forwarding on mutable types.

* Mark `jl_gc_queue_root` as `inaccessiblemem_or_argmemonly`.

  Should also have a positive impact on LLVM memory access optimizations.

* In non-imaging mode, use the pointer literals directly for union type.

* Remove old code that check whether the child is NULL before running the write barrier

  This is not needed anymore.

* Mark functions returning julia object as `nonnull` return.

  This can avoid `NULL` check together with the improved store to load forwarding.

* Remove `jlnewbits_func` which is not used in codegen anymore.

* Fix `LateLowerGCFrame` initialization

  `runOnFunction` shouldn't modify the `Module`.

* Add more `dereferencable` attributes and explicitly specify `nonnull` since it is not
  implied by `dereferencable` for non default addrspace.

  Also add range metadata on the tag load.

The change should also make it easier to do more allocation optmization in LLVM for objects
with object reference as fields.
@yuyichao yuyichao merged commit ce1dc9c into master Oct 31, 2017
@yuyichao yuyichao deleted the yyc/codegen/tag branch October 31, 2017 04:56
@vtjnash
Copy link
Member

vtjnash commented Nov 3, 2017

@yuyichao
Copy link
Contributor Author

yuyichao commented Nov 3, 2017

Without corruption that should only cause segfault if the typ is NULL. Can it be NULL?

@vtjnash
Copy link
Member

vtjnash commented Nov 9, 2017

Previously the calls to this function were guarded by jl_is_leaf_type(typ)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:codegen Generation of LLVM IR and native code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants