[net.micro.mac] PD Modula2 Loader: How it works!

keith@ssc-vax.UUCP (Keith Nemitz) (08/05/85)

This is a quick summary of the Loader application used in the Public
Domain Modula-2 compiler for mac.

After requesting for a code file to load and execute, the Loader
reserves a non-relocatable block in the mac's memory where the
program will execute.  Get this:

The compiler generates object code that includes the use of absolute
memory references.  Apparently the loader 'fixes' the code in memory
and changes any absolute references to reflect the position in
memory.  Woeful tidings to anyone who hopes to generate CODE
segments from the object code files produced by the compiler.

The advantageous side is that compiled programs run pretty snappily.
These are some benchmarks that I came up with.

Benchmark                 Consulair C 1.56       PD Modula-2
---------                 ----------------       -----------
Sieve compile time                30s                 35s
Sieve link time                   40s                 55s
Execution time                   4.7s                7.4s

Integer math test execution time:  4s                5-6s

Array Lookup test execution time:  6s                4-5s

Ackerman's (proc calls) ex time:   5s                  4s

Price                           $375.00    Free/Zip/Zero/Null/None!!

Need I say more?

				      keith

keith@ssc-vax.UUCP (Keith Nemitz) (08/05/85)

> Need I say more?
> 
> 				      keith
> 

Yes. I forgot to mention that the loader will resolve absolute
addressing for overlay calls as well.

Also..  Aside from all that you can make toolbox calls easily.
Use this form:

PROCEDURE ToolBoxProcedureName(arguments)[:ReturnType];
BEGIN CODE(TrapNum in decimal) END ToolBoxProcedureName;

Remember that Modula-2 strings use an end byte (=0C) to mark the end
of a string instead of Pascal's length byte.  Use the conversion
Procedures that were provided with the system.

I could go on, but the aerospace juggernaut summons me...

				      keith

dws@tolerant.UUCP (Dave W. Smith) (08/07/85)

> Benchmark                 Consulair C 1.56       PD Modula-2
> ---------                 ----------------       -----------
... various benchmark times
> Price                           $375.00    Free/Zip/Zero/Null/None!!
> 
> Need I say more?
> 
> 				      keith

You're comparing apples and oranges.  Yes, the PD M-2 is free, but:

1)  It's nowhere near as flexible as Consulair (or Manx, or Megamax, or
    most of the other commercial packages).  I.e. can you build desk
    accessories?  Would you *really* want to try to build a product with
    it?

2)  Support?  A grad student somewhere in Switzerland.  Need I say more?

I'm not knocking the PD M-2.  For hacking around, it seems to be just fine
fine.  But comparing a few benchmark numbers, (especially the seive -- I
*hate* that benchmark!), then waving the flag for the PD M-2 does people a
real disservice.
-- 
  David W. Smith             {ucbvax}!tolerant!dws
  Tolerant Systems, Inc.
  408/946-5667

guido@boring.UUCP (08/08/85)

In article <87@ssc-vax.UUCP> keith@ssc-vax.UUCP (Keith Nemitz) writes:
>The compiler generates object code that includes the use of absolute
>memory references.  Apparently the loader 'fixes' the code in memory
>and changes any absolute references to reflect the position in
>memory.  Woeful tidings to anyone who hopes to generate CODE
>segments from the object code files produced by the compiler.

Well, it's not impossible.  The SUMacC C compiler (a cross-compiler running
on VAXen) also generates absolute memory references, but its run-time
start-up routine relocates the program as it is loaded (with some help from
a table generated by the SUMacC rmaker).

	Guido van Rossum, CWI, Amsterdam (guido@mcvax.UUCP)

keith@ssc-vax.UUCP (Keith Nemitz) (08/10/85)

> 
> I'm not knocking the PD M-2.  For hacking around, it seems to be just fine
> fine.  But comparing a few benchmark numbers, (especially the seive -- I
> *hate* that benchmark!), then waving the flag for the PD M-2 does people a
> real disservice.
> -- 
>   David W. Smith             {ucbvax}!tolerant!dws


Hold it!  I happen to know that at least two companies (Modula Corp, and
Interface technologies) are planning on brining out a native M-2 for Mac,
and having a version that you can do groundwork programming is real nice.
Unless you want to convert C (now, there's real pretty stuff) into modular
software.  The only M-2 other than PD is a intermediate code compiler and it
takes 2 minutes to compile an empty program.  For my money I'll invest in
the time to write an application in the Best language for the job.  Splitting
up the toolbox into logical modules is easier to deal with than having a bunch
of C procedures to fish through.

Still, it is not a well supported compiler (although it hasn't performed other
than every M-2 Compiler I've worked with) but I am not the richest man in 
the world, and, well, uh, you shouldn't have said such nasty things! (sob).

                                              keith




(* This is to notify you that your left hemisphere is at war with your right
hemisphere.  Please do not be unduly alarmed.  You were not using either of
them anyway. *)

dws@tolerant.UUCP (Dave W. Smith) (08/15/85)

> ... For my money I'll invest in
> the time to write an application in the Best language for the job.
				      ^^^^^^^^^^^^^^^^^
O.k.  This discussion is getting a bit religious, and I'm partially to
blame.  Lest this degenerate into a "my favorite language is better than
yours" brouhaha, let me try to close it out as follows:

    o  By all means choose The Best Language for the job.
    o  Don't try to dictate what The Best Language should be for others.
       Languages solve problems.  The problem Modula-2 solves for you may
       not be one that everyone else has.  Ditto for C.
    o  When issuing a comparison of two language products, benchmark
       timings (particalurly the seive, Grrrr....) and price are not
       sufficient.  You *must* consider support.

-- 
  David W. Smith             {ucbvax}!tolerant!dws
  Tolerant Systems, Inc.
  408/946-5667

keith@ssc-vax.UUCP (Keith Nemitz) (08/20/85)

> > ... For my money I'll invest in
> > the time to write an application in the Best language for the job.
> 				      ^^^^^^^^^^^^^^^^^
> 
>        timings (particalurly the seive, Grrrr....) and price are not
>        sufficient.  You *must* consider support.
> 
  This is a formal appology.  I did not mean that Modula 2 is the world's
cure all,  I just cant figure out why you're so hostile to Public Domain
software.  Being a broke hacker, I was delighted that such performance in
a compiler was available free. I didn't realize that in order to write a 
saleable product one always had to purchase the production software.  You
are correct that support is important, and I wish ETHZ was able to provide
more.  Still some support isn't worth the phone call, and others are great.
I don't worry about it, I know in advance that I am the guy that has to 
figure it out one way or another.

                                          keith