Skip to content
This repository has been archived by the owner on May 31, 2020. 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 Compare August 9, 2017 07:11
@cjrh
Copy link

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 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 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 Compare August 13, 2017 10:49
@abonie
Copy link
Contributor Author

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?

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 Compare August 15, 2017 12:47
@cjrh
Copy link

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 Compare August 20, 2017 09:07
@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:

Choose a reason for hiding this comment

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

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

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

Choose a reason for hiding this comment

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

@abonie abonie force-pushed the wordcode_parsing_for_python_36 branch from 31a441e to 7807adc Compare August 20, 2017 15:58
@abonie abonie force-pushed the wordcode_parsing_for_python_36 branch from 7807adc to be5024d Compare August 20, 2017 16:22
@abonie abonie force-pushed the wordcode_parsing_for_python_36 branch from b90385b to 42ab063 Compare August 21, 2017 09:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants