Skip to content
This repository has been archived by the owner. It is now read-only.

Parse wordcodes in Python 3.6 #621

Merged
merged 6 commits into from Aug 22, 2017

Conversation

@abonie
Copy link
Contributor

@abonie abonie commented Aug 8, 2017

Python 3.6 uses 2 bytes for each instruction (instead of varying number of bytes as in previous versions). This PR will introduce changes to VM that check for Python version to parse bytecode appropriately.

Single wordcode is 2 bytes wide and consists of an opcode and its
argument (or 0 if no argument is used)

TODO opcodes:
EXTENDED_ARG
???

@abonie abonie changed the title [WIP] Parse wordcodes instead of bytecodes [WIP] Parse wordcodes in Python 3.6 Aug 8, 2017
@abonie abonie force-pushed the wordcode_parsing_for_python_36 branch from fc762b9 to 89269f3 Aug 9, 2017
@cjrh
Copy link

@cjrh cjrh commented Aug 10, 2017

Just a heads-up I've been tinkering with this in #536. I didn't get very far, but I did get the new dict opcode change done. (It's most other things that are still broken in my PR).

@cjrh
Copy link

@cjrh cjrh commented Aug 10, 2017

By all means please feel free to take anything that might be useful from my PR. I have very little time available to work on this.

@abonie
Copy link
Contributor Author

@abonie abonie commented Aug 11, 2017

Thanks cjrh, I have not touched the dict changes yet, so it works out.
For now I got sidetracked by the fact, that argument unpacking operators * and ** do not work under any Python version, but I will definitely checkout your PR when I get to dicts.

@abonie abonie force-pushed the wordcode_parsing_for_python_36 branch from 89269f3 to 80c9d7b Aug 13, 2017
@abonie
Copy link
Contributor Author

@abonie abonie commented Aug 13, 2017

@cjrh if I were to use some of your code from #536 what is the proper way to give you credit? Should I just mention it in commit message?

abonie added 2 commits Aug 15, 2017
Single wordcode is 2 bytes wide and consists of an opcode and its
argument (or 0 if no argument is used)
Prior to 3.6 it was called CALL_FUNCTION_VAR_KW and operated in a
slightly different manner
@abonie abonie force-pushed the wordcode_parsing_for_python_36 branch from 80c9d7b to 046b97c Aug 15, 2017
@cjrh
Copy link

@cjrh cjrh commented Aug 16, 2017

@abonie Sorry for the delay! No credit necessary, just go for it 👍

@abonie abonie force-pushed the wordcode_parsing_for_python_36 branch from 42ab2ef to a65bac8 Aug 20, 2017
@abonie abonie changed the title [WIP] Parse wordcodes in Python 3.6 Parse wordcodes in Python 3.6 Aug 20, 2017
this.push(dict)
return
}

VirtualMachine.prototype.byte_STORE_MAP = function() {
switch (constants.BATAVIA_MAGIC) {
case constants.BATAVIA_MAGIC_35:

@abonie abonie force-pushed the wordcode_parsing_for_python_36 branch from 1dcc649 to 31a441e Aug 20, 2017
this.push(dict)
return
}

VirtualMachine.prototype.byte_STORE_MAP = function() {
switch (constants.BATAVIA_MAGIC) {
case constants.BATAVIA_MAGIC_35:

@abonie abonie force-pushed the wordcode_parsing_for_python_36 branch from 31a441e to 7807adc Aug 20, 2017
@abonie abonie force-pushed the wordcode_parsing_for_python_36 branch from 7807adc to be5024d Aug 20, 2017
@abonie abonie force-pushed the wordcode_parsing_for_python_36 branch from b90385b to 42ab063 Aug 21, 2017
@freakboy3742 freakboy3742 merged commit 3908058 into beeware:master Aug 22, 2017
5 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants