interpreter vs. compiled

castironpi castironpi at gmail.com
Wed Aug 6 01:35:51 EDT 2008


On Aug 5, 1:54 pm, "Chris Mellon" <arka... at gmail.com> wrote:
> On Tue, Aug 5, 2008 at 12:12 PM, castironpi <castiro... at gmail.com> wrote:
> > On Aug 5, 9:21 am, "paulo.jpi... at gmail.com" <paulo.jpi... at gmail.com>
> > wrote:
> >> On Aug 3, 1:26 am, castironpi <castiro... at gmail.com> 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 program flow control, while it runs its first steps on any
> >> > x86 machine, the yield only succeeds if on Windows 98+, and crashes
> >> > the machine, or otherwise loses control if not.  (That part depends on
> >> > those OSses.)
>
> >> > I can try something similar dynamically.
>
> >> > char* mem= alloc( 48 )
> >> > setpermission( mem, EXECUTE )
> >> > memcpy( mem+ 0, "\x09\x0f\x00\x00", 4 )
> >> > for( int x= 0; x< 10; ++x ) {
> >> >    memcpy( mem+ 4* (x+ 1 ), '\x04\xA0\x00\x00', 4 )
> >> >    mem[ 4* (x+ 1 )+ 3 ]= (char) x
> >> > memcpy( mem+ 44, '\x01\x20\x00\x01', 4 )
> >> > setjump
> >> > goto mem
>
> >> > Which with some imagination produces the contents of 'abinary.exe'
> >> > above (one difference, last word) in a memory block, at address 'mem',
> >> > then jumps to it, which then jumps back, and then exits. </fiction>
>
> >> > I'll compare a C complation to the first example, 'abinary.exe', and a
> >> > JIT compilation to the second example, 'char* mem'.  If the comparison
> >> > isn't accurate, say how, because these are places I can start from...
> >> > (yes, that is, instead of just repeating the claims).
>
> >> > When does a JIT do this, and what does it do in the meantime?
>
> >> The JIT works like an assembler/linker that writes to memory. It will
> >> load the
> >> file(s) containing the bytecode and generate the required assembly
> >> instructions into
> >> memory.
>
> >> In the case there are dependencies to other modules, they will be
> >> loaded as well, and
> >> compiled. Then the linker will take care that cross references between
> >> modules are correct,
> >> like memory addresses and branch targets.
>
> > So far this is the same as any compilation, except the first half is
> > done, and the output location, which is not any bottleneck.
>
> >> A clever JIT might add instrumentation points, so that it can rewrite
> >> the code using profile
> >> guided optimizations, this means generating optimized code using as
> >> input the program behaviour.
>
> >> This makes JIT code usually faster than normal compiled code.
>
> > Here you need an example.  You are suggesting that a compiler can make
> > better optimizations if it knows what functions are going to carry
> > what loads, run how many times, etc., and it can use profile
> > statistics as a partial indicator to do that.
>
> >> Although
> >> normal native code is
> >> able to start executing faster, it only targets a specific set of
> >> processors.
>
> >> JIT code is independent of the processor, and a good JIT
> >> implementation is able to explore the
> >> processor better than a direct native compiler. There is however the
> >> time penalty on program
> >> startup.
>
> > Once again, you are asserting that knowing what the program has done
> > so far, say in the first 5 seconds ( or .5 ), can improve
> > performance.  In this case it can make better use of what instructions
> > to use on the CPU.  I need an example.
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
> Is there a reason why you're expecting c.l.p to be your personal tutor
> for Introduction to Compilers?
>
> It's not that I want to dissuade you in your quest for
> self-betterment, but you're being extremely confrontational as well as
> vastly ignorant about terminology. Defining your own terms that don't
> agree with formal definitions and then demanding (not even politely
> asking, for goodness sake) that people justify to you, in excruciating
> detail, why simple concepts are true is simply an inexcusable way to
> behave.There seems to be something of a rash of this on c.l.p lately.
>
> JIT has been around for decades now, it's well documented, well
> understood, and quite common. You'd learn enough to answer every
> single one of your demands in 20 minutes with Google, and if you're
> seriously going to continue to argue that JIT doesn't exist (and this
> is even granting your own bizarre definition of compile, which may as
> well be called "purplizing") you should be able to argue from a
> position of knowledge instead of stunning, jaw dropping, soul
> shattering ignorance.

Chris,

I looked at your profile on Google Groups.  I found this quote of
yours from May:

"The messiness of the real world is *why* you should use processes,
not
a reason to avoid them."

I like it and I do not hate you.  But we are definitely "off" on the
wrong "foot", for relevant values of "off" and "foot".

> Is there a reason why you're expecting c.l.p to be your personal tutor
> for Introduction to Compilers?

Yes.  There is a reason fueling this expectation.  If people want me
to understand compilers, they are making progress.  If they don't,
they are pretending to.  Are you expecting c.l.p. not to tutor anyone
to any extent at all?  Or have I merely reached my quota of free
tuition?  I could see the latter, and merely would disagree; I know of
nothing that makes either of us the end-all be-all of free tuition
quotas.  I am curious to pursue this knowledge as both an end and a
means, I am willing to put in my share of the time in maintaining the
dialog, and I am not forcing anyone to disclose secret information.
So there.

> It's not that I want to dissuade you in your quest for
> self-betterment, but you're being extremely confrontational as well as
> vastly ignorant about terminology. Defining your own terms that don't
> agree with formal definitions and then demanding (not even politely
> asking, for goodness sake) that people justify to you, in excruciating
> detail, why simple concepts are true is simply an inexcusable way to
> behave.There seems to be something of a rash of this on c.l.p lately.

I am talking like I do not understand because I do not understand.  If
you think I am ignorant, you are right!  The degree of my
confrontationality might be unusually high to you, unusually low to
others, but is just right to me.  I am frustrated that I do not
understand yet, and if it's coming across in my temper that's my
fault.  Furthermore, if I am to question everyone's motives equally,
then there is no reason to expect that everyone out there, or everyone
on this thread, will cooperate to learn; and some reason to expect
that some will detract.

I do not see myself as making demands.  "Why not?" is an inflammatory
question if you're lying, and an exciting one if you're eager to
learn, study, and teach.  If you do not agree with or do not know the
principle of questioning authority, I subscribe to it and will share.

My old hero's fear was to be vested with authority, and then let
people down; thencefore, I will not take any that is *not* subject to
question.  Self-perception is critical to self-awareness; if I have
false beliefs about myself, I can't correct them without others'
help.  Therefore, it's critical for me in pursuing that goal to seek
questions from my peers and friends, and thus common reciprocal
courtesy to offer mine to them.

I am trying to correct my own beliefs in the least harmful way I know
or can conceive.  If I fail, it's never permanent; if it's harmful,
that something I want to know.

Would you rather I recite from rote, "JIT exists, JIT exists", or tell
you what I don't understand until I do?



More information about the Python-list mailing list