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

WIP: Reflection #104

Merged
merged 12 commits into from Feb 5, 2019

Conversation

Projects
None yet
2 participants
@aykevl
Copy link
Member

commented Dec 12, 2018

No description provided.

@aykevl aykevl force-pushed the reflect branch from 60c2060 to 9d70805 Dec 12, 2018

@aykevl aykevl force-pushed the reflect branch 2 times, most recently from d5d4fe3 to 1ed3123 Dec 12, 2018

@aykevl aykevl changed the title Reflection WIP: Reflection Jan 1, 2019

@deadprogram

This comment has been minimized.

Copy link
Member

commented Jan 16, 2019

Seems like this branch is possibly complete enough to merge in. It does have its own tests, and it passes the other tests.

It needs another update to bring it in line with the current master but after that, perhaps it should be landed.

This should also be accompanied with some documentation somewhere about the state of the reflection feature, and what is still missing.

@aykevl what do you think?

@aykevl

This comment has been minimized.

Copy link
Member Author

commented Jan 16, 2019

Yeah I think this could be merged. I've intentionally kept it so that it can be merged at each point.
Of course, it's far from complete, and some parts of it might need to be redesigned. For example, there is no support for structs or named types, which are perhaps the most useful feature of reflection.

EDIT: rebased on top of current master.

aykevl added some commits Dec 12, 2018

reflect: add reflect.TypeOf
This is the beginning of true reflection support in TinyGo.
compiler: sort interface type codes in reverse order
This makes sure the most commonly used types have the lowest type codes.
This was intended to be the case, but apparently I forgot to sort them
the right way.

@aykevl aykevl force-pushed the reflect branch from 1ed3123 to 73d0bef Jan 16, 2019

aykevl added some commits Jan 20, 2019

amd64: align on 16 bytes instead of 8
Some instructions emitted by LLVM (like movaps) expect 16-byte
alignment, while the allocator assumed that 8-byte alignment is good
enough.

TODO: this issue came to light with LLVM optimizing a complex128 store
to the movaps instruction, which must be aligned. It looks like this
means that the <2 x double> IR type is actually 16-byte aligned instead
of 8-byte like a double. If this is the case, the alignment of complex
numbers needs to be updated in the whole compiler.
reflect: add limited support for all type kinds
This commit makes sure all Go types can be encoded in the interface type
code, so that Type.Kind() always returns a proper type kind for any
non-nil interface.

@aykevl aykevl force-pushed the reflect branch 2 times, most recently from d0cb8be to 81ef4c4 Jan 20, 2019

@aykevl aykevl force-pushed the reflect branch from 81ef4c4 to 0a84049 Jan 20, 2019

@deadprogram deadprogram changed the base branch from master to dev Feb 5, 2019

@deadprogram

This comment has been minimized.

Copy link
Member

commented Feb 5, 2019

Now merging into dev branch for integration. Great work on this @aykevl

@deadprogram deadprogram merged commit d7d60af into dev Feb 5, 2019

2 checks passed

Travis CI - Branch Build Passed
Details
Travis CI - Pull Request Build Passed
Details

@deadprogram deadprogram deleted the reflect branch Feb 5, 2019

@deadprogram deadprogram restored the reflect branch Feb 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.