Index: m3-sys/m3cc/gcc/gcc/m3cg/parse.c =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3cc/gcc/gcc/m3cg/parse.c,v retrieving revision 1.219 diff -u -r1.219 parse.c --- m3-sys/m3cc/gcc/gcc/m3cg/parse.c 6 Jul 2010 19:36:56 -0000 1.219 +++ m3-sys/m3cc/gcc/gcc/m3cg/parse.c 6 Jul 2010 20:57:04 -0000 @@ -2471,7 +2471,7 @@ current_function_decl = NULL_TREE; } -/* FIXME: jdp says 0x0f and 4; cm3 may need more */ +/* see M3CG.RuntimeError, RuntimeError.T */ #define FAULT_MASK 0x1f #define LINE_SHIFT 5 @@ -2480,6 +2480,12 @@ { tree arg; + /* Losing bits of the code seems bad: wrong error reported. + * Losing bits of the line number is "ok". + * Line numbers up to around 100 million are preserved. + */ + gcc_assert (code <= FAULT_MASK); + /* gcc_assert (LOCATION_LINE(input_location) <= (long)((~0UL) >> LINE_SHIFT)); */ if (fault_proc == 0) declare_fault_proc (); arg = build_int_cst (t_int, (LOCATION_LINE(input_location) << LINE_SHIFT) + (code & FAULT_MASK)); #if GCC45 Index: m3-sys/m3back/src/M3x86.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3back/src/M3x86.m3,v retrieving revision 1.181 diff -u -r1.181 M3x86.m3 --- m3-sys/m3back/src/M3x86.m3 1 Jun 2010 18:23:03 -0000 1.181 +++ m3-sys/m3back/src/M3x86.m3 6 Jul 2010 20:57:04 -0000 @@ -3592,8 +3592,11 @@ END check_eq; PROCEDURE reportfault (u: U; code: RuntimeError) = + (* 32: see M3CG.RuntimeError, RuntimeError.T *) VAR info := ORD (code) + u.lineno * 32; BEGIN + <* ASSERT ORD (code) < 32 *> (* lose fault code not ok *) + (* ASSERT u.lineno <= (LAST(INTEGER) DIV 32) *) (* losing line number ok *) u.cg.movImmI(u.cg.reg[EAX], info); u.cg.intCall(u.reportlabel); u.usedfault := TRUE; Index: m3-libs/m3core/src/runtime/common/RTHooks.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-libs/m3core/src/runtime/common/RTHooks.i3,v retrieving revision 1.11 diff -u -r1.11 RTHooks.i3 --- m3-libs/m3core/src/runtime/common/RTHooks.i3 21 Apr 2009 06:34:54 -0000 1.11 +++ m3-libs/m3core/src/runtime/common/RTHooks.i3 6 Jul 2010 20:57:04 -0000 @@ -111,7 +111,8 @@ PROCEDURE ReportFault (module: ADDRESS(*RT0.ModulePtr*); info: INTEGER) RAISES ANY; (* report the runtime fault in the specified module. "info" encodes - the source line number and fault code [info = line*16 + ORD(RuntimeError.T)]. + the source line number and fault code [info = line*32 + ORD(RuntimeError.T)]. + 32: see M3CG.RuntimeError, RuntimeError.T *) PROCEDURE AssertFailed (module: ADDRESS(*RT0.ModulePtr*); line: INTEGER; Index: m3-libs/m3core/src/runtime/common/RTHooks.m3 =================================================================== RCS file: /usr/cvs/cm3/m3-libs/m3core/src/runtime/common/RTHooks.m3,v retrieving revision 1.2 diff -u -r1.2 RTHooks.m3 --- m3-libs/m3core/src/runtime/common/RTHooks.m3 31 May 2005 03:43:22 -0000 1.2 +++ m3-libs/m3core/src/runtime/common/RTHooks.m3 6 Jul 2010 20:57:04 -0000 @@ -92,12 +92,13 @@ PROCEDURE ReportFault (module: ADDRESS(*RT0.ModulePtr*); info: INTEGER) RAISES ANY = + (* 1F: see M3CG.RuntimeError, RuntimeError.T *) VAR a: RT0.RaiseActivation; code := Word.And (info, 16_1f); BEGIN a.exception := RuntimeError.Self (); a.arg := LOOPHOLE (code, RT0.ExceptionArg); a.module := module; - a.line := Word.RightShift (info, 5); + a.line := Word.RightShift (info, 5); (* 5: due to 1F *) a.pc := NIL; a.info0 := NIL; a.info1 := NIL; Index: m3-libs/m3core/src/runtime/common/RuntimeError.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-libs/m3core/src/runtime/common/RuntimeError.i3,v retrieving revision 1.3 diff -u -r1.3 RuntimeError.i3 --- m3-libs/m3core/src/runtime/common/RuntimeError.i3 5 May 2009 04:55:06 -0000 1.3 +++ m3-libs/m3core/src/runtime/common/RuntimeError.i3 6 Jul 2010 20:57:04 -0000 @@ -20,39 +20,40 @@ TYPE T = { - AssertFailed, (* <*ASSERT*> condition was FALSE. *) - ValueOutOfRange, (* An enumeration or subrange value was out of range. *) - SubscriptOutOfRange, (* An array subscript was out of range. *) - IncompatibleArrayShape, (* open array had the wrong shape *) - BadMemoryReference, (* attempted to reference a bad location in memory. *) - NarrowFailed, (* An explicit or implicit NARROW() operation failed. *) - NoReturnValue, (* A function failed to return a value. *) - UnhandledCase, (* no handler for the current CASE value. *) - UnhandledTypecase, (* no handler for the given type in a TYPECASE stmt. *) - StackOverflow, (* A thread stack overflowed *) - OutOfMemory, (* NEW() was unable to allocate more memory. *) - UnalignedAddress, (* attempted to get the address of an unaligned value *) - UnhandledException, (* An exception was raised, but not handled. *) - BlockedException, (* An exception was blocked by a RAISES clause. *) - IntegerOverflow, (* integer result too large to represent *) - IntegerDivideByZero, (* Attempt to DIV or MOD by zero. *) - FloatDivideByZero, (* Attempted floating-point division by zero. *) - FloatOverflow, (* floating-point result too large to represent *) - FloatUnderflow, (* floating-point result too small to represent *) - FloatInexact, (* floating-point result is inexact *) - FloatInvalid, (* invalid floating-point argument *) - DuplicateBrand, (* two types with the same brand exist *) - MissingType, (* a compile-time type is missing at link time *) - SupertypeCycle, (* supertypes of an object form a cycle *) - OpaqueTypeRedefined, (* multiple full revelations of an opaque type *) - InconsistentRevelation, (* partial revelations don't match type declarations *) - UndefinedMethod, (* a NIL-valued method was invoked *) - PrivilegedInstruction, (* a privileged machine instruction was attempted *) - SystemError, (* a low-level OS or machine error occurred *) - Unknown - }; + AssertFailed, (* 0 <*ASSERT*> condition was FALSE. *) + ValueOutOfRange, (* 1 An enumeration or subrange value was out of range. *) + SubscriptOutOfRange, (* 2 An array subscript was out of range. *) + IncompatibleArrayShape, (* 3 open array had the wrong shape *) + BadMemoryReference, (* 4 attempted to reference a bad location in memory. *) + NarrowFailed, (* 5 An explicit or implicit NARROW() operation failed. *) + NoReturnValue, (* 6 A function failed to return a value. *) + UnhandledCase, (* 7 no handler for the current CASE value. *) + UnhandledTypecase, (* 8 no handler for the given type in a TYPECASE stmt. *) + StackOverflow, (* 9 A thread stack overflowed *) + OutOfMemory, (* 10 NEW() was unable to allocate more memory. *) + UnalignedAddress, (* 11 attempted to get the address of an unaligned value *) + UnhandledException, (* 12 An exception was raised, but not handled. *) + BlockedException, (* 13 An exception was blocked by a RAISES clause. *) + IntegerOverflow, (* 14 integer result too large to represent *) + IntegerDivideByZero, (* 15 Attempt to DIV or MOD by zero. *) + FloatDivideByZero, (* 16 Attempted floating-point division by zero. *) + FloatOverflow, (* 17 floating-point result too large to represent *) + FloatUnderflow, (* 18 floating-point result too small to represent *) + FloatInexact, (* 19 floating-point result is inexact *) + FloatInvalid, (* 20 invalid floating-point argument *) + DuplicateBrand, (* 21 two types with the same brand exist *) + MissingType, (* 22 a compile-time type is missing at link time *) + SupertypeCycle, (* 23 supertypes of an object form a cycle *) + OpaqueTypeRedefined, (* 24 multiple full revelations of an opaque type *) + InconsistentRevelation, (* 25 partial revelations don't match type declarations *) + UndefinedMethod, (* 26 a NIL-valued method was invoked *) + PrivilegedInstruction, (* 27 a privileged machine instruction was attempted *) + SystemError, (* 28 a low-level OS or machine error occurred *) + Unknown (* 29 *) + (* NOTE: going past 31 requires backend and runtime change *) (* NOTE: This enumeration must be kept in synch with the version of M3CG.RuntimeError used by the compiler. *) + }; PROCEDURE Self (): RT0.ExceptionPtr; (* Returns the runtime representation of "E" *) Index: m3-sys/m3middle/src/M3CG.i3 =================================================================== RCS file: /usr/cvs/cm3/m3-sys/m3middle/src/M3CG.i3,v retrieving revision 1.6 diff -u -r1.6 M3CG.i3 --- m3-sys/m3middle/src/M3CG.i3 14 Mar 2010 18:49:31 -0000 1.6 +++ m3-sys/m3middle/src/M3CG.i3 6 Jul 2010 20:57:04 -0000 @@ -114,38 +114,39 @@ TYPE RuntimeError = { - AssertFailed, (* <*ASSERT*> condition was FALSE. *) - ValueOutOfRange, (* An enumeration or subrange value was out of range. *) - SubscriptOutOfRange, (* An array subscript was out of range. *) - IncompatibleArrayShape, (* open array had the wrong shape *) - BadMemoryReference, (* attempted to reference a bad location in memory. *) - NarrowFailed, (* An explicit or implicit NARROW() operation failed. *) - NoReturnValue, (* A function failed to return a value. *) - UnhandledCase, (* no handler for the current CASE value. *) - UnhandledTypecase, (* no handler for the given type in a TYPECASE stmt. *) - StackOverflow, (* A thread stack overflowed *) - OutOfMemory, (* NEW() was unable to allocate more memory. *) - UnalignedAddress, (* attempted to get the address of an unaligned value *) - UnhandledException, (* An exception was raised, but not handled. *) - BlockedException, (* An exception was blocked by a RAISES clause. *) - IntegerOverflow, (* integer result too large to represent *) - IntegerDivideByZero, (* Attempt to DIV or MOD by zero. *) - FloatDivideByZero, (* Attempted floating-point division by zero. *) - FloatOverflow, (* floating-point result too large to represent *) - FloatUnderflow, (* floating-point result too small to represent *) - FloatInexact, (* floating-point result is inexact *) - FloatInvalid, (* invalid floating-point argument *) - DuplicateBrand, (* two types with the same brand exist *) - MissingType, (* a compile-time type is missing at link time *) - SupertypeCycle, (* supertypes of an object form a cycle *) - OpaqueTypeRedefined, (* multiple full revelations of an opaque type *) - InconsistentRevelation, (* partial revelations don't match type declarations *) - UndefinedMethod, (* a NIL-valued method was invoked *) - PrivilegedInstruction, (* a privileged machine instruction was attempted *) - SystemError, (* a low-level OS or machine error occurred *) - Unknown - }; + AssertFailed, (* 0 <*ASSERT*> condition was FALSE. *) + ValueOutOfRange, (* 1 An enumeration or subrange value was out of range. *) + SubscriptOutOfRange, (* 2 An array subscript was out of range. *) + IncompatibleArrayShape, (* 3 open array had the wrong shape *) + BadMemoryReference, (* 4 attempted to reference a bad location in memory. *) + NarrowFailed, (* 5 An explicit or implicit NARROW() operation failed. *) + NoReturnValue, (* 6 A function failed to return a value. *) + UnhandledCase, (* 7 no handler for the current CASE value. *) + UnhandledTypecase, (* 8 no handler for the given type in a TYPECASE stmt. *) + StackOverflow, (* 9 A thread stack overflowed *) + OutOfMemory, (* 10 NEW() was unable to allocate more memory. *) + UnalignedAddress, (* 11 attempted to get the address of an unaligned value *) + UnhandledException, (* 12 An exception was raised, but not handled. *) + BlockedException, (* 13 An exception was blocked by a RAISES clause. *) + IntegerOverflow, (* 14 integer result too large to represent *) + IntegerDivideByZero, (* 15 Attempt to DIV or MOD by zero. *) + FloatDivideByZero, (* 16 Attempted floating-point division by zero. *) + FloatOverflow, (* 17 floating-point result too large to represent *) + FloatUnderflow, (* 18 floating-point result too small to represent *) + FloatInexact, (* 19 floating-point result is inexact *) + FloatInvalid, (* 20 invalid floating-point argument *) + DuplicateBrand, (* 21 two types with the same brand exist *) + MissingType, (* 22 a compile-time type is missing at link time *) + SupertypeCycle, (* 23 supertypes of an object form a cycle *) + OpaqueTypeRedefined, (* 24 multiple full revelations of an opaque type *) + InconsistentRevelation, (* 25 partial revelations don't match type declarations *) + UndefinedMethod, (* 26 a NIL-valued method was invoked *) + PrivilegedInstruction, (* 27 a privileged machine instruction was attempted *) + SystemError, (* 28 a low-level OS or machine error occurred *) + Unknown (* 29 *) + (* NOTE: going past 31 requires backend and runtime change *) (* NOTE: This enumeration must be kept in synch with the version of RuntimeError.T used by the runtime system. *) + }; END M3CG.