From 453d2abed5ef14524f4981657d5ba5d8eefc20ee Mon Sep 17 00:00:00 2001 From: Unbit Date: Sun, 19 May 2013 06:52:01 +0200 Subject: [PATCH] another micro optimization for pypy --- plugins/pypy/pypy_plugin.c | 3 +-- plugins/pypy/pypy_setup.py | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/pypy/pypy_plugin.c b/plugins/pypy/pypy_plugin.c index caea88df..141e481a 100644 --- a/plugins/pypy/pypy_plugin.c +++ b/plugins/pypy/pypy_plugin.c @@ -52,8 +52,7 @@ int uwsgi_pypy_helper_register_rpc(char *name, int argc, void *func) { return uwsgi_register_rpc(name, &pypy_plugin, argc, func); } -struct iovec *uwsgi_pypy_helper_environ(int core, uint16_t *len) { - struct wsgi_request *wsgi_req = &uwsgi.workers[uwsgi.mywid].cores[core].req; +struct iovec *uwsgi_pypy_helper_environ(struct wsgi_request *wsgi_req, uint16_t *len) { *len = wsgi_req->var_cnt; return wsgi_req->hvec; } diff --git a/plugins/pypy/pypy_setup.py b/plugins/pypy/pypy_setup.py index 1ce69e4f..5c79f96d 100644 --- a/plugins/pypy/pypy_setup.py +++ b/plugins/pypy/pypy_setup.py @@ -30,7 +30,7 @@ int uwsgi_response_add_header(void *, char *, uint16_t, char *, uint16_t); char *uwsgi_request_body_read(void *, uint64_t, int64_t *); char *uwsgi_request_body_readline(void *, uint64_t, int64_t *); -struct iovec *uwsgi_pypy_helper_environ(int, uint16_t *); +struct iovec *uwsgi_pypy_helper_environ(void *, uint16_t *); char *uwsgi_pypy_helper_version(); int uwsgi_pypy_helper_register_signal(int, char *, void *); @@ -134,7 +134,7 @@ def uwsgi_pypy_wsgi_handler(wsgi_req, core): environ = {} nv = ffi.new("uint16_t *") - iov = lib.uwsgi_pypy_helper_environ(core, nv) + iov = lib.uwsgi_pypy_helper_environ(wsgi_req, nv) for i in range(0, nv[0], 2): environ[ffi.string(iov[i].iov_base, iov[i].iov_len)] = ffi.string(iov[i+1].iov_base, iov[i+1].iov_len)