From: rhoover@watson.ibm.com (Roger Hoover)
Newsgroups: comp.lang.modula3
Subject: m3 changes for IBMR2/SPARC
Date: 8 Oct 92 21:48:50 GMT
Article-I.D.: trek.9210082148.AA25613
To: m3
Cc: Eric Muller <muller>, rhoover@watson.ibm.com
X-External-Networks: yes


I've been hacking on the m3 2.08 test release on gatekeeper.  I
have the IBMR2 version so it will compile out of the box, and
have added shared library code for both IBMR2 and SPARC.

Below is a textual description of the changes.  Complete context
diffs follow that.  The IBMR2 version still has bugs---I think they
are color related.

roger hoover
rhoover@watson.ibm.com

./m3make/src/Makefile
Added confige file #define:
IMAKEFLAGS to allow args such as -DREDUCED_TO_ASCII_SPACE to be
defined while compiling imake.

./m3make/src/mklist.awk
Minor changes to avoid redirection to string expression.  Caused
AIX 3.2 awk to barf.

./m3make/src/toplevel.tmpl
Shared library support.  Added second arg to Library() function,
the second arg specifies which other libraries are referenced by
the library being built.
Two config file #defines are used:
SHLIBARGS    is included with the m3 command to build the lib
MKSHLIB(l,d) builds a shared library l (with dependent libs d)
             from m3 output
The install part of library is hacked to install a SunOS .so.1.1
shared lib.

./m3make/model-configs/SPARC
./m3make/model-configs/IBMR2
defined SHLIBARGS, MKSHLIB, IMAKEFLAGS.  These should be added
with blank defs to all of the other model-configs.  I also fixed
a couple of bugs in IBMR2.

./m3make/src/Makefile
Added confige file #define:
IMAKEFLAGS to allow args such as -DREDUCED_TO_ASCII_SPACE to be
defined while compiling imake.

./m3make/src/mklist.awk
Minor changes to avoid redirection to string expression.  Caused
AIX 3.2 awk to barf.

./m3make/src/toplevel.tmpl
Shared library support.  Added second arg to Library() function,
the second arg specifies which other libraries are referenced by
the library being built.
Two config file #defines are used:
SHLIBARGS    is included with the m3 command to build the lib
MKSHLIB(l,d) builds a shared library l (with dependent libs d)
             from m3 output
The install part of library is hacked to install a SunOS .so.1.1
shared lib.

./m3make/model-configs/SPARC
./m3make/model-configs/IBMR2
defined SHLIBARGS, MKSHLIB, IMAKEFLAGS.  These should be added
with blank defs to all of the other model-configs.  I also fixed
a couple of bugs in IBMR2.

./driver/src/Main.m3
The driver assumes that the pass 3 command takes a "cru" or "cruv"
option.  This does not work for SunOS shared libraries, where you
need to do a load.  I hacked the driver to put in the "cru" or
"cruv" option only if the last two letters of pass_3 are "ar".
Not pretty, but any other reasonable way would have axed the
automatic "v" archive option.

./compiler/src/exprs/ArrayExpr.m3
./compiler/src/exprs/ReelExpr.m3
./compiler/src/exprs/TextExpr.m3
./compiler/src/misc/Coverage.m3
./compiler/src/misc/ESet.m3
./compiler/src/misc/Fault.m3
./compiler/src/stmts/TryFinStmt.m3
./compiler/src/stmts/TryStmt.m3
./compiler/src/types/ObjectType.m3
./compiler/src/types/OpaqueType.m3
./compiler/src/types/RefType.m3
./compiler/src/types/Type.m3
./compiler/src/values/Constant.m3
./compiler/src/values/Module.m3
./compiler/src/values/Procedure.m3
./compiler/src/values/Revelation.m3
./compiler/src/values/Value.i3
./compiler/src/values/Value.m3
./compiler/src/values/Variable.m3
The IBMR2 M3Machine.h config file had volatile in the definitions
of _PRIVATE, _IMPORT, and _EXPORT.  It isn't that easy.  The
RS6000 xlc compiler is rigerous at inforcing the ansi c standard
with respect to volatile.  The compiler now generates _VOLATILE
at the appropriate places.  _VOLATILE should be defined to be
"volatile" if the compiler supports it, or "" if not.  Note that
xlc compilers before Version 01.02.0000.0009 has bugs with
volatile type defs.

./libm3/Csupport/src/IBMR2/M3Machine.h
./libm3/Csupport/src/SPARC/M3Machine.h
_VOLATILE is now defined.  This needs to be done for the other
machines.

./libm3/src/m3makefile
./X11R4/src/m3makefile
./trestle/src/m3makefile
Library() now has a second arg.

./trestle/src/xvbtm3/XClient.m3
M3 compilation error.  Fixed in the obvious way.

-----Context Diffs follow -----
*** m3-2.08/./m3make/src/Makefile	Thu Aug  6 01:27:07 1992
--- improved/./m3make/src/Makefile	Thu Oct  8 13:41:47 1992
***************
*** 9,16 ****
  imake: ../src/imake.c config
  	n=`sed -n -e 's/^CPP[ \t]*=[ \t]*//p' -e 'd' < config`; \
   	m=`sed -n -e 's/^CC[ \t]*=[ \t]*//p' -e 'd' < config`; \
  	sed -e 's+M3_CPP+'$$n'+' ../src/imake.c > imake.c; \
! 	$$m -o imake imake.c

  all install scratch::
  	@t=`sed -n -e 's/^TEMPLATE[ \t]*=[ \t*]//p' -e 'd' < config`; \
--- 9,17 ----
  imake: ../src/imake.c config
  	n=`sed -n -e 's/^CPP[ \t]*=[ \t]*//p' -e 'd' < config`; \
   	m=`sed -n -e 's/^CC[ \t]*=[ \t]*//p' -e 'd' < config`; \
+ 	z=`sed -n -e 's/^IMAKEFLAGS[ \t]*=[ \t]*//p' -e 'd' < config`; \
  	sed -e 's+M3_CPP+'$$n'+' ../src/imake.c > imake.c; \
! 	$$m $$z -o imake imake.c

  all install scratch::
  	@t=`sed -n -e 's/^TEMPLATE[ \t]*=[ \t*]//p' -e 'd' < config`; \
*** m3-2.08/./m3make/src/mklist.awk	Fri Mar 20 21:46:40 1992
--- improved/./m3make/src/mklist.awk	Mon Sep 28 15:42:19 1992
***************
*** 40,46 ****
          print " ", file_data[name "," (n-1)]
        } else {
          print name, "= -F." name
!         for (i = 0; i < n; i++) { print file_data[name "," i] > "." name }
        }
      }
    }
--- 40,46 ----
          print " ", file_data[name "," (n-1)]
        } else {
          print name, "= -F." name
!         for (i = 0; i < n; i++) {filename = "." name; print
file_data[name "," i] > filename }
        }
      }
    }
***************
*** 47,53 ****
    if (any_always != 0) {
      for (name in always_count) {
        n = always_count[name];
!       for (i = 0; i < n; i++) { print always_data[name "," i] > "." name }
      }
    }
  }
--- 47,53 ----
    if (any_always != 0) {
      for (name in always_count) {
        n = always_count[name];
!       for (i = 0; i < n; i++) {filename = "." name; print
always_data[name "," i] > filename }
      }
    }
  }
*** m3-2.08/./m3make/src/toplevel.tmpl	Thu Sep  3 04:05:38 1992
--- improved/./m3make/src/toplevel.tmpl	Wed Oct  7 18:24:02 1992
***************
*** 160,176 ****

  /*------------------------------------------------------ library building ---*/

! #define library(name)                                                       @@\
  all:: lib##name.a                                                           @@\
  clean:: ; rm -f lib##name.a lib##name.ax                                    @@\
! lib##name.a: FRC; $(DO_M3) -a lib##name.a $(PGM_SOURCES) $(IMPORT_LIBS)

! #define Library(name)                                                       @@\
  install::                                                                   @@\
! 	INSTALL (lib##name.a, $(LIB_INSTALL), 644)                          @@\
  	INSTALL (lib##name.ax, $(LIB_INSTALL), 644)                         @@\
! 	ranlib  $(LIB_INSTALL)/lib##name.a                                  @@\
! library(name)

  #define LibExport(name)                                                     @@\
  install::                                                                   @@\
--- 160,185 ----

  /*------------------------------------------------------ library building ---*/

! #define library(name, deplibs)                                              @@\
  all:: lib##name.a                                                           @@\
  clean:: ; rm -f lib##name.a lib##name.ax                                    @@\
! lib##name.a: FRC;                                                           @@\
! 	$(DO_M3) -a lib##name.a SHLIBARGS $(PGM_SOURCES) $(IMPORT_LIBS)  @@\
! 	MKSHLIB (lib##name, deplibs)

! #define Library(name, deplibs)                                              @@\
  install::                                                                   @@\
! 	if [ -f lib##name.a ]; then \                                       @@\
! 	  INSTALL (lib##name.a, $(LIB_INSTALL), 644);\                      @@\
! 	fi                                                                  @@\
! 	if [ -f lib##name.so.1.1 ]; then \                                  @@\
! 	  INSTALL (lib##name.so.1.1, $(LIB_INSTALL), 644);\                 @@\
! 	fi                                                                  @@\
  	INSTALL (lib##name.ax, $(LIB_INSTALL), 644)                         @@\
! 	if [ -f $(LIB_INSTALL)/lib##name.a ]; then \                        @@\
! 	  ranlib  $(LIB_INSTALL)/lib##name.a;\                              @@\
! 	fi                                                                  @@\
! library(name, deplibs)

  #define LibExport(name)                                                     @@\
  install::                                                                   @@\
*** m3-2.08/./m3make/model-configs/SPARC	Mon May  4 16:52:02 1992
--- improved/./m3make/model-configs/SPARC	Thu Oct  8 13:56:55 1992
***************
*** 109,115 ****

  /* When m3(1) receives the -O option, it really does this */
  CC_O = @-O@
!
  /* Give the value 0 if you want the m3 driver to pass -L/-l arguments to
     LD for libraries; otherwise (value = 1), the m3 driver will pass
     the full path name of the librairies it located */
--- 109,118 ----

  /* When m3(1) receives the -O option, it really does this */
  CC_O = @-O@
!
! #define SHLIBARGS -X1@-PIC@ -Y3@$/bin/ld@-assert@pure-text@-o@ -Y4@/bin/true@
! #define MKSHLIB(libname,deplibs) mv libname.a libname.so.1.1
!
  /* Give the value 0 if you want the m3 driver to pass -L/-l arguments to
     LD for libraries; otherwise (value = 1), the m3 driver will pass
     the full path name of the librairies it located */
***************
*** 132,137 ****
--- 135,143 ----

     Note: the value of this symbol must not use the values of other symbols. */
  CPP = /lib/cpp
+
+ /* Flags needed to make imake */
+ IMAKEFLAGS =

  /* What about MAKE ?

*** m3-2.08/./m3make/model-configs/IBMR2	Mon May  4 16:52:04 1992
--- improved/./m3make/model-configs/IBMR2	Thu Oct  8 13:49:57 1992
***************
*** 1,4 ****
! /* Copyright (C) 1989, 1992 Digital Equipment Corporation                    */
  /* All rights reserved.                                                      */
  /* See the file COPYRIGHT for a full description.                            */

--- 1,4 ----
!  /* Copyright (C) 1989, 1992 Digital Equipment Corporation                    */
  /* All rights reserved.                                                      */
  /* See the file COPYRIGHT for a full description.                            */

***************
*** 149,158 ****
  /* When m3(1) receives the -O option, it really does this */
  CC_O = @-O@

  /* Give the value 0 if you want the m3 driver to pass -L/-l arguments to
     LD for libraries; otherwise (value = 1), the m3 driver will pass
     the full path name of the librairies it located */
! KEEP_LIBRARIES_RESOLVED = 1

  /* We don't want to use the predefined CFLAGS */
  CFLAGS =
--- 149,161 ----
  /* When m3(1) receives the -O option, it really does this */
  CC_O = @-O@

+ #define SHLIBARGS
+ #define MKSHLIB(libname,deplibs) /bin/dump -g libname.a | sed -n -e
's/^[ 	]*[0-9][0-9]*[	 ]*\([^	 .][^	 ]*\)$$/\1/p' > _expnames;
/bin/bsdcc -bE:_expnames -bM:SRE -o _shar.o libname.a -L$(LIB_USE)
deplibs -e _nostart; rm libname.a; /bin/ar cru libname.a _shar.o;
/bin/rm -f _expnames _shar.o
+
  /* Give the value 0 if you want the m3 driver to pass -L/-l arguments to
     LD for libraries; otherwise (value = 1), the m3 driver will pass
     the full path name of the librairies it located */
! KEEP_LIBRARIES_RESOLVED = 0 /* we need -L/-l for shared libraries */

  /* We don't want to use the predefined CFLAGS */
  CFLAGS =
***************
*** 170,181 ****
  /* What about CPP ?

     Note: the value of this symbol must not use the values of other symbols. */
! CPP = /usr/local/lib/cpp

  /* What about MAKE ?

     Note: the value of this symbol must not use the values of other symbols. */
! MAKE = make

  /* And install */
  #define INSTALL(f,d,p) install -c -m p f d
--- 173,187 ----
  /* What about CPP ?

     Note: the value of this symbol must not use the values of other symbols. */
! CPP = /usr/lpp/X11/Xamples/util/cpp/cpp
!
! /* Flags needed to make imake */
! IMAKEFLAGS = -DREDUCED_TO_ASCII_SPACE

  /* What about MAKE ?

     Note: the value of this symbol must not use the values of other symbols. */
! MAKE = /usr/bin/make

  /* And install */
  #define INSTALL(f,d,p) install -c -m p f d
***************
*** 211,216 ****
--- 217,223 ----
  OVERLAY_0 = @-g@
  OVERLAY_1 = @-lc@
  BASE_ARGS = @-N@
+ PASS1_LIBRARY =

  /* The maximum size (in megabytes) that Pass0 is allowed to reach as
     a persistent server before the driver kills it.  Setting SERVER_LIMIT
***************
*** 237,244 ****
  LINKBFILES = @-lm@
  LINKFILES = @-lm3@-lm@

! /* These files are linked with Modula-3 programs when -Z is specified. *.
! LINKCOVER  = $(LIB_USE)/report_coverage.o

  /* The C code generated by the Modula-3 to C translator #include's some
     basic files, to be found in this directory. */
--- 244,251 ----
  LINKBFILES = @-lm@
  LINKFILES = @-lm3@-lm@

! /* These files are linked with Modula-3 programs when -Z is specified. */
! LINKCOVER = $(LIB_USE)/report_coverage.o

  /* The C code generated by the Modula-3 to C translator #include's some
     basic files, to be found in this directory. */
*** m3-2.08/./driver/src/Main.m3	Mon Aug 10 11:02:08 1992
--- improved/./driver/src/Main.m3	Wed Oct  7 16:09:37 1992
***************
*** 1746,1752 ****
        ETimer.Push (pass3_timer);
        Append  (args, pass_3);
        AppendL (args, pass_3_args);
!       Append  (args, ArOptions [msg_level >= MsgLevel.Debug]);
        Append  (args, lib);
        Append  (args, Main_O);
        a := objects.head;
--- 1746,1754 ----
        ETimer.Push (pass3_timer);
        Append  (args, pass_3);
        AppendL (args, pass_3_args);
!       IF Text.Equal(Text.Sub(pass_3, Text.Length(pass_3)-2, 2), "ar") THEN
!         Append  (args, ArOptions [msg_level >= MsgLevel.Debug]);
!       END;
        Append  (args, lib);
        Append  (args, Main_O);
        a := objects.head;
*** m3-2.08/./compiler/src/exprs/ArrayExpr.m3	Tue Jun 30 11:25:14 1992
--- improved/./compiler/src/exprs/ArrayExpr.m3	Mon Oct  5 14:25:46 1992
***************
*** 379,385 ****
      TYPECASE array OF
      | NULL => RETURN;
      | P(p) => IF (p.uid # 0) AND NUMBER (p.args^) # 0 THEN
!                 Emit.OpF ("_PRIVATE @ ", OpenArrayType.OpenType (p.tipe));
                  Emit.OpI ("_openConst@ [] = {", p.uid);
                  GenOpenLiteral (p);
                  Emit.Op ("};\n");
--- 379,385 ----
      TYPECASE array OF
      | NULL => RETURN;
      | P(p) => IF (p.uid # 0) AND NUMBER (p.args^) # 0 THEN
!                 Emit.OpF ("_PRIVATE _VOLATILE @ ",
OpenArrayType.OpenType (p.tipe));
                  Emit.OpI ("_openConst@ [] = {", p.uid);
                  GenOpenLiteral (p);
                  Emit.Op ("};\n");
*** m3-2.08/./compiler/src/exprs/ReelExpr.m3	Tue Jun 30 11:25:23 1992
--- improved/./compiler/src/exprs/ReelExpr.m3	Mon Oct  5 14:26:25 1992
***************
*** 128,134 ****
      (* make sure the literal pool is started *)
      IF (newUID = 0) THEN
        Emit.RegisterShutDown (LitStream[p.pre], FinishLiteralPool);
!       Emit.Op ("_PRIVATE ");
        Emit.Op (PoolType[p.pre]);
        Emit.Op (Tag[p.pre]);
        Emit.Op ("[] = {\n");
--- 128,134 ----
      (* make sure the literal pool is started *)
      IF (newUID = 0) THEN
        Emit.RegisterShutDown (LitStream[p.pre], FinishLiteralPool);
!       Emit.Op ("_PRIVATE _VOLATILE ");
        Emit.Op (PoolType[p.pre]);
        Emit.Op (Tag[p.pre]);
        Emit.Op ("[] = {\n");
*** m3-2.08/./compiler/src/exprs/TextExpr.m3	Tue Jun 30 11:25:24 1992
--- improved/./compiler/src/exprs/TextExpr.m3	Mon Oct  5 14:27:12 1992
***************
*** 66,72 ****
        save := Emit.Switch (Emit.Stream.TextLiterals);
        uid := nextID;  INC (nextID);
        String.SetUID (p.value, uid);
!       Emit.OpI ("_PRIVATE _TXT _txt@ = ", uid);
        EmitRep (p.value);
        Emit.Op (";\n");
        EVAL Emit.Switch (save);
--- 66,72 ----
        save := Emit.Switch (Emit.Stream.TextLiterals);
        uid := nextID;  INC (nextID);
        String.SetUID (p.value, uid);
!       Emit.OpI ("_PRIVATE _VOLATILE _TXT _txt@ = ", uid);
        EmitRep (p.value);
        Emit.Op (";\n");
        EVAL Emit.Switch (save);
*** m3-2.08/./compiler/src/misc/Coverage.m3	Mon Apr 27 19:57:04 1992
--- improved/./compiler/src/misc/Coverage.m3	Mon Oct  5 14:28:30 1992
***************
*** 82,88 ****
      fname := String.FileTail (Host.filename);

      (* generate the coverage tables *)
!     Emit.Op  ("_PRIVATE struct {\001\n");
      Emit.OpI ("char header [@];\n", SLen (header));
      Emit.Op  ("int timestamp;\n");
      Emit.Op  ("int fileLen;\n");
--- 82,88 ----
      fname := String.FileTail (Host.filename);

      (* generate the coverage tables *)
!     Emit.Op  ("_PRIVATE _VOLATILE struct {\001\n");
      Emit.OpI ("char header [@];\n", SLen (header));
      Emit.Op  ("int timestamp;\n");
      Emit.Op  ("int fileLen;\n");
*** m3-2.08/./compiler/src/misc/ESet.m3	Wed May  6 11:13:49 1992
--- improved/./compiler/src/misc/ESet.m3	Mon Oct  5 14:28:57 1992
***************
*** 152,158 ****
      IF (t.age >= thisAge) THEN RETURN END;
      e := t.elts;
      WHILE (e # NIL) DO Value.Declare0 (e.except); e := e.next; END;
!     Emit.OpI ("_PRIVATE _EXCEPTION _raises_@ [] = {\n\001", t.uid);
      e := t.elts;
      WHILE (e # NIL) DO
        IF (e.except # NIL) THEN Emit.OpN ("& @, ", e.except)  END;
--- 152,158 ----
      IF (t.age >= thisAge) THEN RETURN END;
      e := t.elts;
      WHILE (e # NIL) DO Value.Declare0 (e.except); e := e.next; END;
!     Emit.OpI ("_PRIVATE _VOLATILE _EXCEPTION _raises_@ [] = {\n\001", t.uid);
      e := t.elts;
      WHILE (e # NIL) DO
        IF (e.except # NIL) THEN Emit.OpN ("& @, ", e.except)  END;
*** m3-2.08/./compiler/src/misc/Fault.m3	Thu Feb 27 19:46:21 1992
--- improved/./compiler/src/misc/Fault.m3	Mon Oct  5 14:29:34 1992
***************
*** 22,28 ****
      IF (NOT file_declared) THEN
        file_declared := TRUE;
        save := Emit.Switch (Emit.Stream.TextLiterals);
!         Emit.Op ("_PRIVATE _TXT __file = ");
          TextExpr.EmitRep (file);
          Emit.Op (";\n");
        EVAL Emit.Switch (save);
--- 22,28 ----
      IF (NOT file_declared) THEN
        file_declared := TRUE;
        save := Emit.Switch (Emit.Stream.TextLiterals);
!         Emit.Op ("_PRIVATE _VOLATILE _TXT __file = ");
          TextExpr.EmitRep (file);
          Emit.Op (";\n");
        EVAL Emit.Switch (save);
*** m3-2.08/./compiler/src/stmts/TryStmt.m3	Wed Jul 22 12:10:23 1992
--- improved/./compiler/src/stmts/TryStmt.m3	Mon Oct  5 14:30:38 1992
***************
*** 283,289 ****
    VAR h: Handler;  e: Except;  save: Emit.Stream;
    BEGIN
      save := Emit.Switch (Emit.Stream.Constants);
!     Emit.OpI ("_PRIVATE _EXCEPTION _try_labels_@ [] = {\n\001", label);
      h := p.handles;
      WHILE (h # NIL) DO
        e := h.tags;
--- 283,289 ----
    VAR h: Handler;  e: Except;  save: Emit.Stream;
    BEGIN
      save := Emit.Switch (Emit.Stream.Constants);
!     Emit.OpI ("_PRIVATE _VOLATILE _EXCEPTION _try_labels_@ [] = {\n\001", label);
      h := p.handles;
      WHILE (h # NIL) DO
        e := h.tags;
*** m3-2.08/./compiler/src/types/ObjectType.m3	Mon Jun  8 11:30:12 1992
--- improved/./compiler/src/types/ObjectType.m3	Mon Oct  5 14:40:11 1992
***************
*** 450,456 ****
      GenFields (p, fields, nFields);

      (* import my type cell *)
!     Emit.OpF ("_IMPORT _TYPE* @_TC;\n", p);

      IF TypeRep.StartLinkInfo (p) THEN RETURN END;

--- 450,456 ----
      GenFields (p, fields, nFields);

      (* import my type cell *)
!     Emit.OpF ("_IMPORT _VOLATILE _TYPE* @_TC;\n", p);

      IF TypeRep.StartLinkInfo (p) THEN RETURN END;

***************
*** 491,497 ****
      GenMapProc (p, fields, nFields);

      (* generate my Type cell info *)
!     Emit.OpF  ("_PRIVATE _TYPE @_tc = {\n", p);
      Emit.Op   ("  0, 0,\n");      (* typecode, lastSubTypeTC *)
      Emit.OpH  ("  0x@,\n",        (* selfID *)
                         Type.Name (p));
--- 491,497 ----
      GenMapProc (p, fields, nFields);

      (* generate my Type cell info *)
!     Emit.OpF  ("_PRIVATE _VOLATILE _TYPE @_tc = {\n", p);
      Emit.Op   ("  0, 0,\n");      (* typecode, lastSubTypeTC *)
      Emit.OpH  ("  0x@,\n",        (* selfID *)
                         Type.Name (p));
*** m3-2.08/./compiler/src/types/OpaqueType.m3	Mon Mar  2 14:18:10 1992
--- improved/./compiler/src/types/OpaqueType.m3	Mon Oct  5 14:40:34 1992
***************
*** 103,109 ****
      Emit.OpF ("typedef _ADDRESS @;\n", p);

      (* import my type cell *)
!     Emit.OpF ("_IMPORT _TYPE* @_TC;\n", p);

      IF TypeRep.StartLinkInfo (p) THEN RETURN END;
      Emit.OpF ("S@\n", p.super);
--- 103,109 ----
      Emit.OpF ("typedef _ADDRESS @;\n", p);

      (* import my type cell *)
!     Emit.OpF ("_IMPORT _VOLATILE _TYPE* @_TC;\n", p);

      IF TypeRep.StartLinkInfo (p) THEN RETURN END;
      Emit.OpF ("S@\n", p.super);
*** m3-2.08/./compiler/src/types/RefType.m3	Mon Mar  2 14:20:14 1992
--- improved/./compiler/src/types/RefType.m3	Mon Oct  5 14:40:53 1992
***************
*** 237,243 ****
      Type.Compile (p.target);

      (* import my type cell *)
!     Emit.OpF ("_IMPORT _TYPE* @_TC;\n", p);

      IF TypeRep.StartLinkInfo (p) THEN RETURN END;
      Emit.OpF ("d@\n", p.target);
--- 237,243 ----
      Type.Compile (p.target);

      (* import my type cell *)
!     Emit.OpF ("_IMPORT _VOLATILE _TYPE* @_TC;\n", p);

      IF TypeRep.StartLinkInfo (p) THEN RETURN END;
      Emit.OpF ("d@\n", p.target);
***************
*** 296,302 ****
      END;

      (* generate my Type cell info *)
!     Emit.OpF  ("\n_PRIVATE _TYPE @_tc = {\n", p);
      Emit.Op   ("  0, 0,\n");      (* typecode, lastSubTypeTC *)
      Emit.OpH  ("  0x@,\n",        (* selfID *)
                         Type.Name (p));
--- 296,302 ----
      END;

      (* generate my Type cell info *)
!     Emit.OpF  ("\n_PRIVATE _VOLATILE _TYPE @_tc = {\n", p);
      Emit.Op   ("  0, 0,\n");      (* typecode, lastSubTypeTC *)
      Emit.OpH  ("  0x@,\n",        (* selfID *)
                         Type.Name (p));
*** m3-2.08/./compiler/src/types/Type.m3	Thu Jul  2 14:24:46 1992
--- improved/./compiler/src/types/Type.m3	Mon Oct  5 14:32:21 1992
***************
*** 504,510 ****
        IF NOT OpaqueType.Is (t) THEN
          EVAL Emit.Switch (Emit.Stream.TypeFPs);
          IF (next_fp_data = 0) THEN
!           Emit.Op ("_PRIVATE int _fp_data[] = {\n");
          END;
          wr := MBuf.New ();
          map := NEW (FPMap, deep := FALSE, cnt := 0, list := NEW (TypeVec, 20));
--- 504,510 ----
        IF NOT OpaqueType.Is (t) THEN
          EVAL Emit.Switch (Emit.Stream.TypeFPs);
          IF (next_fp_data = 0) THEN
!           Emit.Op ("_PRIVATE _VOLATILE int _fp_data[] = {\n");
          END;
          wr := MBuf.New ();
          map := NEW (FPMap, deep := FALSE, cnt := 0, list := NEW (TypeVec, 20));
***************
*** 552,558 ****
      IF (first_header = NIL) THEN
        Emit.Op ("\003#define _type_info 0\n");
      ELSE
!       Emit.Op ("_PRIVATE _TYPE_INFO _type_info [] = {\n");
        x := first_header;
        WHILE (x # NIL) DO
          t := x.type;
--- 552,558 ----
      IF (first_header = NIL) THEN
        Emit.Op ("\003#define _type_info 0\n");
      ELSE
!       Emit.Op ("_PRIVATE _VOLATILE _TYPE_INFO _type_info [] = {\n");
        x := first_header;
        WHILE (x # NIL) DO
          t := x.type;
***************
*** 576,582 ****
        t := x.type;
        c := t.class ();
        IF (c = Class.Ref) OR (c = Class.Object) THEN
!         IF (n = 0) THEN Emit.Op ("_PRIVATE _TYPE* _type_cells [] = {\n") END;
          Emit.OpF ("  &@_tc,", t);
          EndLine (t);
          INC (n);
--- 576,582 ----
        t := x.type;
        c := t.class ();
        IF (c = Class.Ref) OR (c = Class.Object) THEN
!         IF (n = 0) THEN Emit.Op ("_PRIVATE _VOLATILE _TYPE*
_type_cells [] = {\n") END;
          Emit.OpF ("  &@_tc,", t);
          EndLine (t);
          INC (n);
*** m3-2.08/./compiler/src/values/Constant.m3	Wed Apr 15 12:56:29 1992
--- improved/./compiler/src/values/Constant.m3	Mon Oct  5 14:44:39 1992
***************
*** 164,170 ****
        Type.Compile (t.tipe);
        IF (t.exported) THEN
          ArrayExpr.PreGenLiteral (t.value);
!         Emit.OpF ("_EXPORT @ ", t.tipe);
  	Emit.OpN ("@ = ", t);
  	Expr.GenLiteral (t.value);
  	Emit.Op (";\n");
--- 164,170 ----
        Type.Compile (t.tipe);
        IF (t.exported) THEN
          ArrayExpr.PreGenLiteral (t.value);
!         Emit.OpF ("_EXPORT _VOLATILE @ ", t.tipe);
  	Emit.OpN ("@ = ", t);
  	Expr.GenLiteral (t.value);
  	Emit.Op (";\n");
***************
*** 171,182 ****
          t.written := TRUE;
        ELSIF (t.imported) AND (t.loaded) THEN
          ArrayExpr.PreGenLiteral (t.value);
!         Emit.OpF ("_IMPORT @ ", t.tipe);
  	Emit.OpN ("@;\n", t);
          t.written := TRUE;
        ELSIF (t.loaded) THEN
          ArrayExpr.PreGenLiteral (t.value);
!         Emit.OpF ("_PRIVATE @ ", t.tipe);
  	Emit.OpN ("@ = ", t);
          Expr.GenLiteral (t.value);
  	Emit.Op (";\n");
--- 171,182 ----
          t.written := TRUE;
        ELSIF (t.imported) AND (t.loaded) THEN
          ArrayExpr.PreGenLiteral (t.value);
!         Emit.OpF ("_IMPORT _VOLATILE @ ", t.tipe);
  	Emit.OpN ("@;\n", t);
          t.written := TRUE;
        ELSIF (t.loaded) THEN
          ArrayExpr.PreGenLiteral (t.value);
!         Emit.OpF ("_PRIVATE _VOLATILE @ ", t.tipe);
  	Emit.OpN ("@ = ", t);
          Expr.GenLiteral (t.value);
  	Emit.Op (";\n");
*** m3-2.08/./compiler/src/values/Module.m3	Mon Jun 29 14:56:38 1992
--- improved/./compiler/src/values/Module.m3	Mon Oct  5 14:45:32 1992
***************
*** 764,770 ****
      save := Emit.Switch (Emit.Stream.LinkTables);
      Scanner.offset := t.origin;
      Scanner.Here (file, line);
!     Emit.OpX ("_EXPORT _LINK_INFO @", tag [t.interface]);
      Emit.OpS ("@ = {\n", t.name);
      Emit.OpS ("  \"@\",\n", file);
      Emit.Op  ("  _type_info,\n");
--- 764,770 ----
      save := Emit.Switch (Emit.Stream.LinkTables);
      Scanner.offset := t.origin;
      Scanner.Here (file, line);
!     Emit.OpX ("_EXPORT _VOLATILE _LINK_INFO @", tag [t.interface]);
      Emit.OpS ("@ = {\n", t.name);
      Emit.OpS ("  \"@\",\n", file);
      Emit.Op  ("  _type_info,\n");
*** m3-2.08/./compiler/src/values/Procedure.m3	Tue Jun 30 13:56:49 1992
--- improved/./compiler/src/values/Procedure.m3	Tue Oct  6 11:35:44 1992
***************
*** 323,329 ****
      (* try to compile the imported type first... *)

      save := Emit.Switch (Emit.Stream.ProcHeads);
!       Value.GenStorageClass (p);
        Emit.OpF ("@ ", ProcType.CResult (p.signature));
        WriteName (p);
        Emit.Op (" ();\n");
--- 323,329 ----
      (* try to compile the imported type first... *)

      save := Emit.Switch (Emit.Stream.ProcHeads);
!       Value.GenNovolStorageClass (p);
        Emit.OpF ("@ ", ProcType.CResult (p.signature));
        WriteName (p);
        Emit.Op (" ();\n");
***************
*** 380,386 ****
      WHILE (p # NIL) DO	
        IF (p.hasBody) AND (NOT p.builtin) AND (NOT IsNested (p)) THEN
          IF (n = 0) THEN
!           Emit.Op ("\n_PRIVATE _PROC_INFO _proc_info [] = {\n");
          END;
          GenRegistration (p);
          INC (n);
--- 380,386 ----
      WHILE (p # NIL) DO	
        IF (p.hasBody) AND (NOT p.builtin) AND (NOT IsNested (p)) THEN
          IF (n = 0) THEN
!           Emit.Op ("\n_PRIVATE _VOLATILE _PROC_INFO _proc_info [] = {\n");
          END;
          GenRegistration (p);
          INC (n);
***************
*** 456,462 ****

      Frame.Push (frame, 0, TRUE);

!     Value.GenStorageClass (p);
      IF ProcType.LargeResult (tresult)
        THEN Emit.Op  ("_VOID ");
        ELSE Emit.OpF ("@ ", tresult);
--- 456,462 ----

      Frame.Push (frame, 0, TRUE);

!     Value.GenNovolStorageClass (p);
      IF ProcType.LargeResult (tresult)
        THEN Emit.Op  ("_VOID ");
        ELSE Emit.OpF ("@ ", tresult);
*** m3-2.08/./compiler/src/values/Revelation.m3	Wed Jul 22 11:34:12 1992
--- improved/./compiler/src/values/Revelation.m3	Mon Oct  5 14:33:28 1992
***************
*** 576,582 ****
              t := l.ident;
              IF (l.local= local) AND (t.equal = full) AND (local OR l.used) THEN
                IF (cnt = 0) THEN
!                 Emit.OpX("_PRIVATE _TYPE_PAIR @[] = {\n",name);
                END;
                Emit.OpFF ("  { &@_TC, &@_TC, ", t.lhs, t.rhs);
                Emit.OpHH ("0x@, 0x@ },\n", Type.Name (t.lhs), Type.Name(t.rhs));
--- 576,582 ----
              t := l.ident;
              IF (l.local= local) AND (t.equal = full) AND (local OR l.used) THEN
                IF (cnt = 0) THEN
!                 Emit.OpX("_PRIVATE _VOLATILE _TYPE_PAIR @[] = {\n",name);
                END;
                Emit.OpFF ("  { &@_TC, &@_TC, ", t.lhs, t.rhs);
                Emit.OpHH ("0x@, 0x@ },\n", Type.Name (t.lhs), Type.Name(t.rhs));
*** m3-2.08/./compiler/src/values/Value.i3	Mon Feb 10 18:10:29 1992
--- improved/./compiler/src/values/Value.i3	Tue Oct  6 11:36:02 1992
***************
*** 36,41 ****
--- 36,42 ----
  PROCEDURE ClassOf          (t: T): Class;
  PROCEDURE Fingerprint      (t: T;  map: Type.FPMap;  wr: MBuf.T);
  PROCEDURE GenStorageClass  (t: T);
+ PROCEDURE GenNovolStorageClass  (t: T);
  PROCEDURE IsExternal       (t: T): BOOLEAN;
  PROCEDURE IsImported       (t: T): BOOLEAN;
  PROCEDURE IsWritable       (t: T): BOOLEAN;
*** m3-2.08/./compiler/src/values/Value.m3	Wed Jul 22 12:44:20 1992
--- improved/./compiler/src/values/Value.m3	Tue Oct  6 11:36:32 1992
***************
*** 126,131 ****
--- 126,146 ----
  PROCEDURE GenStorageClass (t: T) =
    BEGIN
      IF t.external THEN
+       Emit.Op ("_IMPORT _VOLATILE ");
+     ELSE
+       CASE StorageClass (t) OF
+       | SC.Exported  => Emit.Op ("_EXPORT _VOLATILE ");
+       | SC.Imported  => Emit.Op ("_IMPORT _VOLATILE ");
+       | SC.Global    => Emit.Op ("_PRIVATE _VOLATILE ");
+       | SC.LocalProc => Emit.Op ("_LOCAL_PROC ");
+       | SC.Local     => Emit.Op ("_LOCAL ");
+       END;
+     END;
+   END GenStorageClass;
+
+ PROCEDURE GenNovolStorageClass (t: T) =
+   BEGIN
+     IF t.external THEN
        Emit.Op ("_IMPORT ");
      ELSE
        CASE StorageClass (t) OF
***************
*** 136,142 ****
        | SC.Local     => Emit.Op ("_LOCAL ");
        END;
      END;
!   END GenStorageClass;

  PROCEDURE GenVSClass (t: T;  sc: SC) =
    BEGIN
--- 151,157 ----
        | SC.Local     => Emit.Op ("_LOCAL ");
        END;
      END;
!   END GenNovolStorageClass;

  PROCEDURE GenVSClass (t: T;  sc: SC) =
    BEGIN
*** m3-2.08/./compiler/src/values/Variable.m3	Thu Jul  2 10:43:40 1992
--- improved/./compiler/src/values/Variable.m3	Tue Oct  6 11:30:04 1992
***************
*** 313,325 ****
      Frame.NoteDeclaration (t.tipe);

      IF t.initID # -1 THEN
!       Emit.OpF ("_PRIVATE @ ", t.tipe);
        Emit.OpI ("_init@ = ", t.initID);
        Expr.GenLiteral (Expr.ConstValue (t.init));
        Emit.Op   (";\n");
      END;

!     Value.GenStorageClass (t);
      DeclareType (t);
      Emit.OpN ("@", t);
      IF (t.init = NIL) OR (t.imported) OR (NOT Scope.OuterMost (t.scope)) THEN
--- 313,325 ----
      Frame.NoteDeclaration (t.tipe);

      IF t.initID # -1 THEN
!       Emit.OpF ("_PRIVATE _VOLATILE @ ", t.tipe);
        Emit.OpI ("_init@ = ", t.initID);
        Expr.GenLiteral (Expr.ConstValue (t.init));
        Emit.Op   (";\n");
      END;

!     Value.GenNovolStorageClass (t);
      DeclareType (t);
      Emit.OpN ("@", t);
      IF (t.init = NIL) OR (t.imported) OR (NOT Scope.OuterMost (t.scope)) THEN
*** m3-2.08/./libm3/Csupport/src/IBMR2/M3Machine.h	Fri Feb 28 14:15:12 1992
--- improved/./libm3/Csupport/src/IBMR2/M3Machine.h	Tue Oct  6 11:46:44 1992
***************
*** 14,23 ****
  #pragma alloca

  /* These are the storage classes and type qualifiers */

! #define _PRIVATE static volatile
! #define _IMPORT  extern volatile
! #define _EXPORT         volatile

  #define _LOCAL_PROC  static
  #define _LOCAL       auto
--- 14,24 ----
  #pragma alloca

  /* These are the storage classes and type qualifiers */
+ #define _VOLATILE volatile

! #define _PRIVATE static
! #define _IMPORT  extern
! #define _EXPORT

  #define _LOCAL_PROC  static
  #define _LOCAL       auto
***************
*** 65,71 ****

  /* NILCHECKB must evaluate its argument 'e' (a char*) and
     generate a trap if it is NIL (0). */
! extern volatile char _M3__nil_check_char;
  #define _NILCHECKB(e) _M3__nil_check_char = ((char*)(e))[-1];


--- 66,72 ----

  /* NILCHECKB must evaluate its argument 'e' (a char*) and
     generate a trap if it is NIL (0). */
! extern _VOLATILE char _M3__nil_check_char;
  #define _NILCHECKB(e) _M3__nil_check_char = ((char*)(e))[-1];


***************
*** 75,79 ****
  typedef signed int  signed_int;

  /* builtin types */
! #define _ADDRESS volatile char*

--- 76,80 ----
  typedef signed int  signed_int;

  /* builtin types */
! #define _ADDRESS _VOLATILE char*

*** m3-2.08/./libm3/Csupport/src/SPARC/M3Machine.h	Fri Feb 28 14:23:56 1992
--- improved/./libm3/Csupport/src/SPARC/M3Machine.h	Tue Oct  6 11:44:35 1992
***************
*** 9,14 ****
--- 9,16 ----

  /* These are the storage classes and type qualifiers */

+ #define _VOLATILE
+
  #define _PRIVATE static
  #define _IMPORT  extern
  #define _EXPORT
*** m3-2.08/./libm3/src/m3makefile	Thu Sep  3 04:32:16 1992
--- improved/./libm3/src/m3makefile	Tue Oct  6 14:14:03 1992
***************
*** 180,183 ****

  M3FLAGS = -w1 -make -why -nostd -times

! Library (m3)
--- 180,183 ----

  M3FLAGS = -w1 -make -why -nostd -times

! Library (m3,-lm)
*** m3-2.08/./X11R4/src/m3makefile	Thu Sep  3 04:35:54 1992
--- improved/./X11R4/src/m3makefile	Mon Oct  5 11:43:08 1992
***************
*** 9,12 ****
  source_dir (../src/Xt)
  source_dir (../src/Xaw)

! Library (m3X11R4)
--- 9,12 ----
  source_dir (../src/Xt)
  source_dir (../src/Xaw)

! Library (m3X11R4,-lm3)
*** m3-2.08/./trestle/src/m3makefile	Thu Sep  3 04:36:30 1992
--- improved/./trestle/src/m3makefile	Mon Oct  5 13:02:54 1992
***************
*** 12,15 ****

  import_lib (m3X11R4)

! Library (m3ui)
--- 12,15 ----

  import_lib (m3X11R4)

! Library (m3ui,-lm3 -lm3X11R4 -lX11)
*** m3-2.08/./trestle/src/xvbtm3/XClient.m3	Wed Sep  2 20:33:00 1992
--- improved/./trestle/src/xvbtm3/XClient.m3	Mon Oct  5 12:55:58 1992
***************
*** 4295,4301 ****
  VAR
    ehandler := X.XSetErrorHandler(Error);
    iohandler := X.XSetIOErrorHandler(LOOPHOLE(IOError, X.XIOErrorHandler));
!   vec := Usignal.struct_sigvec{Usignal.SIG_IGN, Usignal.empty_sigset_t, 0};
    ovec: Usignal.struct_sigvec;

  BEGIN
--- 4295,4301 ----
  VAR
    ehandler := X.XSetErrorHandler(Error);
    iohandler := X.XSetIOErrorHandler(LOOPHOLE(IOError, X.XIOErrorHandler));
!   vec := Usignal.struct_sigvec{Usignal.SIG_IGN, Usignal.empty_sv_mask, 0};
    ovec: Usignal.struct_sigvec;

  BEGIN