[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-capi-sig
Subject:    [capi-sig]tagged pointer fixed integer experiment
From:       Neil Schemenauer <nas-python () arctrix ! com>
Date:       2018-09-12 0:00:08
Message-ID: 20180912000008.w5tecsx4vlqjpojz () python ! ca
[Download RAW message or body]

This is an experiment to exercise the new C-API we are trying to
design.  I would like it to be able to support tagged pointers.
This requires PyObject* to be treated as an opaque pointer.

Note, I'm not suggesting that we should used tagged pointers in
CPython.  Instead, I just want to see if the API will make it
possible to do it.  The logic is that some Python implementations
might want to use tagged pointers.  They would also like to provide
the same C-API as CPython.  So, it would be real nice if we don't
make things really hard for them.

The patch adding the actual tagged pointer type is quite trivial.
There are a number of git commits preceeding it in order to make it
trivial.  Coccinelle has been useful.  Some of my semantic patches

> @@
> expression E;
> @@
> 
> -E->ob_type
> +Py_TYPE(E)

> @@
> expression E,  F;
> @@
> 
> -Py_TYPE(E) = F
> +Py_SET_TYPE(E, F)

Run like:

spatch --sp-file ob_type.cocci  <C source files>

To speed things up, I used grep to narrow down the set of files to process.

Here is the source code for the fixed int cpython.  There is a new builtin
'fixedint'.  It doesn't do much yet but at least doesn't immediately crash.

https://github.com/nascheme/cpython/tree/tagged_int
_______________________________________________
capi-sig mailing list -- capi-sig@python.org
To unsubscribe send an email to capi-sig-leave@python.org
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic