[pypy-commit] pypy jvm-improvements: Native Java version of thread_get_ident -- just enough to compile ll_thread.

benol noreply at buildbot.pypy.org
Tue Jul 31 21:23:44 CEST 2012


Author: Michal Bendowski <michal at bendowski.pl>
Branch: jvm-improvements
Changeset: r56515:053913e841c7
Date: 2012-07-31 17:50 +0200
http://bitbucket.org/pypy/pypy/changeset/053913e841c7/

Log:	Native Java version of thread_get_ident -- just enough to compile
	ll_thread.

diff --git a/pypy/module/thread/ll_thread.py b/pypy/module/thread/ll_thread.py
--- a/pypy/module/thread/ll_thread.py
+++ b/pypy/module/thread/ll_thread.py
@@ -46,7 +46,8 @@
                                               # importantly, reacquire it
                                               # around the callback
 c_thread_get_ident = llexternal('RPyThreadGetIdent', [], rffi.LONG,
-                                _nowrapper=True)    # always call directly
+                                _nowrapper=True,    # always call directly
+                                oo_primitive="pypy__thread_get_ident")
 
 TLOCKP = rffi.COpaquePtr('struct RPyOpaque_ThreadLock',
                           compilation_info=eci)
diff --git a/pypy/translator/jvm/src/pypy/PyPy.java b/pypy/translator/jvm/src/pypy/PyPy.java
--- a/pypy/translator/jvm/src/pypy/PyPy.java
+++ b/pypy/translator/jvm/src/pypy/PyPy.java
@@ -287,6 +287,10 @@
         return Double.longBitsToDouble(l);
     }
 
+    public long pypy__thread_get_ident() {
+        return Thread.currentThread().getId();
+    }
+
     public long pypy__float2longlong(double d) {
         return Double.doubleToRawLongBits(d);
     }


More information about the pypy-commit mailing list