Re: interpreter vs. compiled

2008-08-09 Thread castironpi
On Aug 5, 2:09 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Regarding exploring processor instructions. > > Lets say you compile a C program targeting x86 architecture, with > optimizations > turned on for speed, and let the compiler automatic select MMX and SSE > instructions > for numeric

Re: interpreter vs. compiled

2008-08-05 Thread castironpi
On Aug 5, 1:54 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On Tue, Aug 5, 2008 at 12:12 PM, castironpi <[EMAIL PROTECTED]> wrote: > > On Aug 5, 9:21 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > wrote: > >> On Aug 3, 1:26 am, castironpi <[EMAIL PROTECTED]> wrote: > > >> > Which is 12 bytes lo

Re: interpreter vs. compiled

2008-08-05 Thread Paul Boddie
On 5 Aug, 20:54, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > JIT has been around for decades now, it's well documented, well > understood, and quite common. Apart from Psyco, whose status is hopefully that of being revived somewhat [1], not quite common enough to permeate the most popular Python

Re: interpreter vs. compiled

2008-08-05 Thread [EMAIL PROTECTED]
Regarding exploring processor instructions. Lets say you compile a C program targeting x86 architecture, with optimizations turned on for speed, and let the compiler automatic select MMX and SSE instructions for numeric code. I have now a program that executes very fast, and does what I want very

Re: interpreter vs. compiled

2008-08-05 Thread Chris Mellon
On Tue, Aug 5, 2008 at 12:12 PM, castironpi <[EMAIL PROTECTED]> wrote: > On Aug 5, 9:21 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: >> On Aug 3, 1:26 am, castironpi <[EMAIL PROTECTED]> wrote: >> >> >> > Which is 12 bytes long and runs in a millisecond. What it does is set >> > a memory ad

Re: interpreter vs. compiled

2008-08-05 Thread castironpi
On Aug 5, 9:21 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Aug 3, 1:26 am, castironpi <[EMAIL PROTECTED]> wrote: > > > > Which is 12 bytes long and runs in a millisecond.  What it does is set > > a memory address to successive integers 0..9, then yields.  Due to the > > nature of progra

Re: interpreter vs. compiled

2008-08-05 Thread [EMAIL PROTECTED]
On Aug 3, 1:26 am, castironpi <[EMAIL PROTECTED]> wrote: > On Aug 2, 2:02 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > > > castironpi <[EMAIL PROTECTED]> wrote: > > > >And furthermore, I think I'm getting > > >confused about what exactly constitutes an interpreter: it is whether > > >there is a pro

Re: interpreter vs. compiled

2008-08-02 Thread castironpi
On Aug 2, 2:02 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > castironpi <[EMAIL PROTECTED]> wrote: > > >And furthermore, I think I'm getting > >confused about what exactly constitutes an interpreter: it is whether > >there is a process that runs product instructions, or the product > >instructions c

Re: interpreter vs. compiled

2008-08-02 Thread Paul Boddie
On 2 Aug, 08:33, castironpi <[EMAIL PROTECTED]> wrote: > On Aug 1, 5:24 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > > > a + b # in Python > > > > ...is not sufficiently represented by... > > > > ldr r1, a > > ldr r2, b > > add r3, r1, r2 > > > > ...in some assembly language (and the result

Re: interpreter vs. compiled

2008-08-02 Thread Tim Roberts
castironpi <[EMAIL PROTECTED]> wrote: > >And furthermore, I think I'm getting >confused about what exactly constitutes an interpreter: it is whether >there is a process that runs product instructions, or the product >instructions can run standalone. I would take 'compiler' to mean, >something that

Re: interpreter vs. compiled

2008-08-02 Thread Tim Roberts
Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >On Thu, 31 Jul 2008 06:17:59 GMT, Tim Roberts <[EMAIL PROTECTED]> declaimed >the following in comp.lang.python: > >> And again, I never said that it did. CPython is an interpreter. the >> user's code is never translated into machine language. > >

Re: interpreter vs. compiled

2008-08-01 Thread castironpi
On Aug 1, 5:24 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 1 Aug, 07:11, castironpi <[EMAIL PROTECTED]> wrote: > > > > > Given the restrictions (or rather, freedoms) of Python, does there > > exist code that necessarily cannot translate to machine code?  In > > other words, can you translate al

Re: interpreter vs. compiled

2008-08-01 Thread Terry Reedy
castironpi wrote: Similarly, I take it that the decision to make CPython a stack machine + VM was a design decision, not a necessity, favoring internal simplicity over the extra 5%. Years ago, someone once started a project to write a register-based virtual machine for (C)Python. I suspect it

Re: interpreter vs. compiled

2008-08-01 Thread Paul Boddie
On 1 Aug, 07:11, castironpi <[EMAIL PROTECTED]> wrote: > > Given the restrictions (or rather, freedoms) of Python, does there > exist code that necessarily cannot translate to machine code?  In > other words, can you translate all Python code to machine code? Given that all valid Python code can b

Re: interpreter vs. compiled

2008-07-31 Thread castironpi
On Jul 31, 1:17 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > castironpi <[EMAIL PROTECTED]> wrote: > > >In C, we have: > > >int x, y; > >x= 10; > >y= x+ 1; > > >It translates as, roughly: > > >8000 .data > >7996 #x > >7992 #y > >7988 .end data > >7984 loadi reg0 7996 > >7980 loadi

Re: interpreter vs. compiled

2008-07-31 Thread Terry Reedy
Duncan Booth wrote: Terry Reedy <[EMAIL PROTECTED]> wrote: 1. Portability: The Microsoft C# JIT compiler runs under Windows .NET on x86/amd64 and maybe it64 and what else? Just porting .NET to run 0n Linux on the same processors was/is a bit task. Does MONO have a JIT also? Technically t

Re: interpreter vs. compiled

2008-07-31 Thread Duncan Booth
Terry Reedy <[EMAIL PROTECTED]> wrote: > 1. Portability: The Microsoft C# JIT compiler runs under Windows .NET > on x86/amd64 and maybe it64 and what else? Just porting .NET to run > 0n Linux on the same processors was/is a bit task. Does MONO have a > JIT also? Technically there is no such th

Re: interpreter vs. compiled

2008-07-31 Thread Bob Martin
in 76135 20080731 090911 Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >On Thu, 31 Jul 2008 06:17:59 GMT, Tim Roberts <[EMAIL PROTECTED]> declaimed >the following in comp.lang.python: > > >> And again, I never said that it did. CPython is an interpreter. the >> user's code is never translated into

Re: interpreter vs. compiled

2008-07-30 Thread Tim Roberts
castironpi <[EMAIL PROTECTED]> wrote: > >In C, we have: > >int x, y; >x= 10; >y= x+ 1; > >It translates as, roughly: >> >8000 .data >7996 #x >7992 #y >7988 .end data >7984 loadi reg0 7996 >7980 loadi reg1 7992 >7976 loadi reg2 10 >7972 loadi reg3 1 >7968 storv reg2 reg0 >7964 add

Re: interpreter vs. compiled

2008-07-30 Thread Terry Reedy
castironpi wrote: The current CPython VM does not compile code. CPython compiles Python code to bytecode for its CPython *hardware independent* VM using standard compiler methdods and tools (lexer, parser, code generator, and optimizer). That VM (interpreter) is written in portable-as-po

RE: interpreter vs. compiled

2008-07-30 Thread Dino Viehland
ng a general rule instead of a type-specific rule. But for the time being having the DLR automatically handle this has been working good enough for these situations. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of castironpi Sent: Tuesday, July 29, 2008 11:40 PM To

Re: interpreter vs. compiled

2008-07-29 Thread castironpi
I note that IronPython and Python's pickle.dumps do not return the same value. Perhaps this relates to the absence of interpreter loop. >>> p.dumps( { 'a': True, 'b': set( ) } ) IPy: '(dp0\nVb\np1\nc__builtin__\nset\np3\n((lp4\ntp5\nRp2\nsVa \np6\nI01\ns.' CPy: "(dp0\nS'a'\np1\nI01\nsS'b'\np2\nc_

RE: interpreter vs. compiled

2008-07-29 Thread Dino Viehland
- www.codeplex.com/IronPython -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of castironpi Sent: Tuesday, July 29, 2008 9:20 PM To: python-list@python.org Subject: Re: interpreter vs. compiled On Jul 29, 7:39 am, alex23 <[EMAIL PROTECTED]> wrote: >

Re: interpreter vs. compiled

2008-07-29 Thread castironpi
On Jul 29, 1:46 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > castironpi <[EMAIL PROTECTED]> wrote: > > >In CPython yes.  In IronPython yes:  the parts that are compiled into > >machine code are the interpreter, *not user's code*. > > WRONG!  You are WRONG.  At "compile" time, the Python code is com

Re: interpreter vs. compiled

2008-07-29 Thread castironpi
On Jul 29, 7:39 am, alex23 <[EMAIL PROTECTED]> wrote: > On Jul 29, 2:21 pm, castironpi <[EMAIL PROTECTED]> wrote: > > > On Jul 28, 5:58 pm, Fuzzyman <[EMAIL PROTECTED]> wrote: > > > Well - in IronPython user code gets compiled to in memory assemblies > > > which can be JIT'ed. > > > I don't believe

Re: interpreter vs. compiled

2008-07-29 Thread alex23
On Jul 29, 2:21 pm, castironpi <[EMAIL PROTECTED]> wrote: > On Jul 28, 5:58 pm, Fuzzyman <[EMAIL PROTECTED]> wrote: > > Well - in IronPython user code gets compiled to in memory assemblies > > which can be JIT'ed. > > I don't believe so. Uh, you're questioning someone who is not only co-author of

Re: interpreter vs. compiled

2008-07-28 Thread Tim Roberts
castironpi <[EMAIL PROTECTED]> wrote: > >In CPython yes. In IronPython yes: the parts that are compiled into >machine code are the interpreter, *not user's code*. WRONG! You are WRONG. At "compile" time, the Python code is compiled to an intermediate language. At "run" time, the intermediate

Re: interpreter vs. compiled

2008-07-28 Thread castironpi
On Jul 28, 5:58 pm, Fuzzyman <[EMAIL PROTECTED]> wrote: > On Jul 27, 6:02 am, castironpi <[EMAIL PROTECTED]> wrote: > > > > > On Jul 24, 11:04 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > > > > castironpi <[EMAIL PROTECTED]> wrote: > > > > >Compiling a program is different than running it.  A JIT c

Re: interpreter vs. compiled

2008-07-28 Thread Fuzzyman
On Jul 27, 6:02 am, castironpi <[EMAIL PROTECTED]> wrote: > On Jul 24, 11:04 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > > > > > castironpi <[EMAIL PROTECTED]> wrote: > > > >Compiling a program is different than running it.  A JIT compiler is a > > >kind of compiler and it makes a compilation step

Re: interpreter vs. compiled

2008-07-26 Thread castironpi
On Jul 24, 11:04 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > castironpi <[EMAIL PROTECTED]> wrote: > > >Compiling a program is different than running it.  A JIT compiler is a > >kind of compiler and it makes a compilation step.  I am saying that > >Python is not a compiler and in order to implemen

Re: interpreter vs. compiled

2008-07-25 Thread John Nagle
Tim Roberts wrote: And I'm saying you are wrong. There is NOTHING inherent in Python that dictates that it be either compiled or interpreted. That is simply an implementation decision. The CPython implementation happens to interpret. The IronPython implementation compiles the intermediate lang

Re: interpreter vs. compiled

2008-07-25 Thread Bob Martin
in 75186 20080725 050433 Tim Roberts <[EMAIL PROTECTED]> wrote: >castironpi <[EMAIL PROTECTED]> wrote: >> >>Compiling a program is different than running it. A JIT compiler is a >>kind of compiler and it makes a compilation step. I am saying that >>Python is not a compiler and in order to impleme

Re: interpreter vs. compiled

2008-07-24 Thread Tim Roberts
castironpi <[EMAIL PROTECTED]> wrote: > >Compiling a program is different than running it. A JIT compiler is a >kind of compiler and it makes a compilation step. I am saying that >Python is not a compiler and in order to implement JIT, it would have >to change that fact. And I'm saying you are w

Re: interpreter vs. compiled

2008-07-23 Thread castironpi
On Jul 23, 12:08 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > >> Oh.  How is the stack represented? > > > As usual, as successive locations in memory. > > I have the impression that CPython uses the same stack C does. > > Actually, it doesn't (at least not for the evaluation stack). > > In CP

Re: interpreter vs. compiled

2008-07-23 Thread Fredrik Lundh
castironpi wrote: Compiling a program is different than running it. A JIT compiler is a kind of compiler and it makes a compilation step. I am saying that Python is not a compiler and in order to implement JIT, it would have to change that fact. good thing Python don't have to listen to you,

Re: interpreter vs. compiled

2008-07-23 Thread Martin v. Löwis
>> Oh. How is the stack represented? > > As usual, as successive locations in memory. > I have the impression that CPython uses the same stack C does. Actually, it doesn't (at least not for the evaluation stack). In CPython, when a Python function starts, the maximum depth of the evaluation sta

Re: interpreter vs. compiled

2008-07-23 Thread castironpi
On Jul 22, 11:38 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > castironpi <[EMAIL PROTECTED]> wrote: > > >You're saying the VM can't compile code.  That makes sense, it's not a > >compiler. > > I wouldn't say "can't".  The current CPython VM does not compile code.  It > COULD.  The C#/.NET VM does.

Re: interpreter vs. compiled

2008-07-22 Thread Tim Roberts
castironpi <[EMAIL PROTECTED]> wrote: > >You're saying the VM can't compile code. That makes sense, it's not a >compiler. I wouldn't say "can't". The current CPython VM does not compile code. It COULD. The C#/.NET VM does. IronPython, for example, is an implementation of Python that uses .NET

Re: interpreter vs. compiled

2008-07-21 Thread castironpi
On Jul 18, 2:13 pm, Dan <[EMAIL PROTECTED]> wrote: > On Jul 18, 2:17 pm, castironpi <[EMAIL PROTECTED]> wrote: > > > > > On Jul 17, 11:39 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > On 18 Jul., 01:15, castironpi <[EMAIL PROTECTED]> wrote: > > > > > On Jul 17, 5:37 pm, I V <[EMAIL PROTECTED]

Re: interpreter vs. compiled

2008-07-18 Thread Dan
On Jul 18, 2:17 pm, castironpi <[EMAIL PROTECTED]> wrote: > On Jul 17, 11:39 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > > > > > On 18 Jul., 01:15, castironpi <[EMAIL PROTECTED]> wrote: > > > > On Jul 17, 5:37 pm, I V <[EMAIL PROTECTED]> wrote: > > > > > On Thu, 17 Jul 2008 15:08:17 -0700, castir

Re: interpreter vs. compiled

2008-07-18 Thread castironpi
On Jul 17, 11:39 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 18 Jul., 01:15, castironpi <[EMAIL PROTECTED]> wrote: > > > > > On Jul 17, 5:37 pm, I V <[EMAIL PROTECTED]> wrote: > > > > On Thu, 17 Jul 2008 15:08:17 -0700, castironpi wrote: > > > > The Python disassembly is baffling though. > > >

Re: interpreter vs. compiled

2008-07-18 Thread [EMAIL PROTECTED]
On Jul 18, 2:31 pm, castironpi <[EMAIL PROTECTED]> wrote: > Given that, what does that column indicate? Offset. -- http://mail.python.org/mailman/listinfo/python-list

Re: interpreter vs. compiled

2008-07-17 Thread castironpi
On Jul 17, 11:39 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 18 Jul., 01:15, castironpi <[EMAIL PROTECTED]> wrote: > > > > > On Jul 17, 5:37 pm, I V <[EMAIL PROTECTED]> wrote: > > > > On Thu, 17 Jul 2008 15:08:17 -0700, castironpi wrote: > > > > The Python disassembly is baffling though. > > >

Re: interpreter vs. compiled

2008-07-17 Thread Kay Schluehr
On 18 Jul., 01:15, castironpi <[EMAIL PROTECTED]> wrote: > On Jul 17, 5:37 pm, I V <[EMAIL PROTECTED]> wrote: > > > > > On Thu, 17 Jul 2008 15:08:17 -0700, castironpi wrote: > > > The Python disassembly is baffling though. > > > y= 3 > > dis.dis('x=y+1') > > > You can't disassemble string

Re: interpreter vs. compiled

2008-07-17 Thread Terry Reedy
castironpi wrote: On Jul 17, 5:37 pm, I V <[EMAIL PROTECTED]> wrote: Oh. How is the stack represented? As usual, as successive locations in memory. I have the impression that CPython uses the same stack C does. While conceptually, CPython may put objects on the stack, I am pretty sure it

Re: interpreter vs. compiled

2008-07-17 Thread castironpi
On Jul 17, 5:37 pm, I V <[EMAIL PROTECTED]> wrote: > On Thu, 17 Jul 2008 15:08:17 -0700, castironpi wrote: > > The Python disassembly is baffling though. > > y= 3 > dis.dis('x=y+1') > > You can't disassemble strings of python source (well, you can, but, as > you've seen, the results are n

Re: interpreter vs. compiled

2008-07-17 Thread I V
On Thu, 17 Jul 2008 15:08:17 -0700, castironpi wrote: > The Python disassembly is baffling though. > y= 3 dis.dis('x=y+1') You can't disassemble strings of python source (well, you can, but, as you've seen, the results are not meaningful). You need to compile the source first: >>> co