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] Tk support #1298

Open
wants to merge 4,666 commits into
base: master
Choose a base branch
from
Open

[WIP] Tk support #1298

wants to merge 4,666 commits into from

Conversation

Daetalus
Copy link
Contributor

There have several reasons that I add tk support in Pyston:

  • Matplotlib can use variety backends, such as tk, PyGTK, PyQt, wxPython, kivy. tk is CPython "standard" GUI frame work. It give them the highest priority.
  • Also Scikit-learn and SciPy could work if without matplotlib. However, it will be good if we support it if it not hard to support(I mean, not let me lose the focus).
  • Visualize the achievement we got.

undingen and others added 30 commits May 19, 2016 17:13
Conflicts:
	src/codegen/compvars.cpp
Fix remaining "check refcounting" assertions
Numpy was hitting this a lot

I love optimizing things we haven't approached before.  This small change
improved numpy.test() performance by 20%.
- support CPython
- don't blow away the checkout each time
so that it can be used in more places.  Looking at pyxl_bench2_10x,
most of the calls to PyType_GenericAlloc are from the dict and list
iterator classes, which don't use DEFAULT_CLASS_SIMPLE (or DEFAULT_CLASS)
since they use the same C++ class with multiple Python classes.  So
by extracting out the core of that function, it's now usable by those
other classes.

Also convert some things to DEFAULT_CLASS_SIMPLE while we're at it.
merge the missing merge commits (mostly cosmetic change)
One small change for numpy performance
Extract the logic from DEFAULT_CLASS_SIMPLE
I don't know what the reason is, but it's tripping up cffi's test suite.
I did not trigger this bug (also could not come up with a test) but just by inspecting the code I thought it's very suspicious.

But I did remove the assert(!exc_state.is_reraise) assert because it got hit in a legitimate case,
(c++ exception got rethrowen in the llvm tier, cought in our c++ code and rethrowen because of api mismatch. With no python code in between.)
Some cleanup for the refcounting merge
this speeds up a simple numpy benchmark by about 10x.
tuple: implement tp_as_sequence->sq_contains
this is an advantage for _PyObject_GC_TRACK
which before compiled to something like this:
        cmpq    $-2, -16(%rdi)
        jne     .LBB0_2
        movq    $-3, -16(%rdi)
        movq    _PyGC_generation0(%rip), %rax
        movq    %rax, -32(%rdi)
        movq    _PyGC_generation0(%rip), %rax
        movq    8(%rax), %rax
        movq    %rax, -24(%rdi)
        leaq    -32(%rdi), %rcx
        movq    %rcx, (%rax)
        movq    _PyGC_generation0(%rip), %rax
        movq    %rcx, 8(%rax)

and now compiles to
        cmpq    $-2, -16(%rdi)
        jne     .LBB0_2
        movq    $-3, -16(%rdi)
        movq    _PyGC_generation0(%rip), %rax
        movq    %rax, -32(%rdi)
        movq    8(%rax), %rcx
        movq    %rcx, -24(%rdi)
        leaq    -32(%rdi), %rdx
        movq    %rdx, (%rcx)
        movq    %rdx, 8(%rax)

notice that it had to load _PyGC_generation0 three times because the compiler had to assume that because of aliasing it got motified.
(and this loads actually showed up in profiling as somewhat expensive)
@Daetalus Daetalus force-pushed the tk_support branch 3 times, most recently from 10c59dc to a0367b9 Compare July 18, 2016 15:43
…slots_issue1197

Add sq_slots & mp_slots to instance (issue pyston#1197)
@Daetalus Daetalus force-pushed the tk_support branch 4 times, most recently from c5de126 to 8054c1c Compare July 18, 2016 18:10
Boxiang Sun added 2 commits July 19, 2016 02:47
The source code files of _tkinter and Tkinter already included in
Pyston. But the way of Pyston include submodule in from_cpython/Lib was
different than CPython, so did some hack in getpath.c. And CPython use
some functions to find tk and tcl lib and head files. For now, this
patch just hardcode the path in from_cpython/setup.py, like we did in
cffi extension.
When try to support tk. The Py_None is a wrapper of pyston `None`. It
will conflict with other library's None. So rename the pure pyston
`None` to pyston_None. And use Py_None instead pyston_None when
possible. Just like dropbox#1231 for Py_True and Py_False
@Daetalus Daetalus force-pushed the tk_support branch 4 times, most recently from 2e9d38e to 0483605 Compare July 19, 2016 04:01
Boxiang Sun added 2 commits July 19, 2016 14:51
Tk application need this method to stop main window and to some other
things.
@@ -591,15 +592,20 @@ calculate_path(void)
bufsz += strlen(zip_path) + 1;
bufsz += strlen(exec_prefix) + 1;

// Pyston change: add from_cpython/Lib and lib_pyston
// Pyston change: add from_cpython/Lib, lib_pyston and Lib/lib-tk
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm pretty skeptical of this change -- we shouldn't have to add any libraries here. Can we just see how CPython ends up not needing this, and try to copy it?

@kmod kmod force-pushed the master branch 2 times, most recently from 352fd89 to 6488a3e Compare October 28, 2020 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants