472,328 Members | 1,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

Issues in compiling Python to machine code

I've been thinking about what the issues would be in compiling
Python into native machine code, and since type information is
important in Python, it seems possible that Python code can
be compiled into native machine code (albeit with a lot of
extra effort).

For instance, type information is discovered when something is
assigned to a variable or an anonymous piece of data is used
in a program. Compiling Python bytecode into native machine
code could involve a pass over the bytecode to look at all the
uses of a variable or anonymous variable, call some Python
function to discover its variable, then record it in the symbol

Another issue is what to do with objects. Finding the offset
to a pointer which is the object's constructor, for instance,
if that's the way it's done internally in Python.

And then freeing the memory used by an object when it's no
longer needed. Perhaps freeing memory for an object can be
done by inserting machine code to return memory back to the
heap after the first pass over the bytecode and recording the
place a variable is last used (hopefully then it won't be
used in some other way later of course... perhaps it can
record all cases where that variable is referred to by another
name and track them, too.)

Seems like compiled Python would need a lot of support code,
in any case, that gets run at certain times: before the program
starts, whenever a variable is accessed, before an object is
used (to allocate memory), whenever something happens to data
within an object (allocate/reallocate/destroy), and so on...

Are there any reasons why Python would be *impossible* to compile?

Thanks :)

Jul 18 '05 #1
0 1563

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Pierre Rouleau | last post by:
Hi all! I am using Python 2.3.1 on Win32 (NT, 2000). Whenever a file imports the standard tempfile module, Python 2.3.1 issues the following...
by: Maurice LING | last post by:
Hi, I remembered reading a MSc thesis about compiling Perl to Java bytecodes (as in java class files). At least, it seems that someone had...
by: Martin Bless | last post by:
The good news: Along with Python-2.4 comes really good news to Windows users. Yes, you now CAN build extension modules yourself using the SAME...
by: pruebauno | last post by:
Hello all, I am having issues compiling Python with large file support. I tried forcing the configure script to add it but then it bombs in the...
by: Martin | last post by:
I am using graphics as backgrounds for forms,buttons,labels etc. The question is: is it faster to load all graphics from files on app start or to...
by: Holger Joukl | last post by:
Hi, I encountered some build issues when compiling Python 2.4.4 on a Solaris 8 box using gcc 3.4.4: 1. Running configure detects that a...
by: metaperl | last post by:
I've tried both Python 2.4.4 and Python 2.5. I'm trying to build from source and install under a local directory Swarm since OpenSwarm requires...
by: Han-Wen Nienhuys | last post by:
Hello, I have a small patch for Python SVN that makes it possible to cross-compile python on Unix to various other Unix targets. I have...
by: grbgooglefan | last post by:
I am compiling CPP program which uses CPython API functions from Python 2.5.1 source code First I compiled with this commanline, that time I got...
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.