-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Solved] [cm3 AMD64_NT] Modula-3 for Windows x64 ( m3devel 2019-January ) #47
Comments
Looks like good work. Are there still unsolved problems? Sorry I can''t help, for lack of a
windows machine.
Jay?
…On 03/21/2019 08:34 AM, VictorMiasnikov wrote:
I think that need a disscussion
It's possible duplicate of
<https://m3lists.elegosoft.com/pipermail/m3devel/2019-January.txt>
Subject: [M3devel] It's time to AMD_64. Modula-3 for Windows x64
Hi!
It's time to AMD_64
I started from
https://modula3.elegosoft.com/cm3/uploaded-archives/
cm3-min-AMD64_NT-d5.9.0-VC110-20131012.msi
cm3-all-AMD64_NT-d5.9.0-VC110-20131012.zip
I have worked Modula-3 for Windows x64
There some must important patches:
==
--- RTExFrame.m3 cm3-4e08861fd36f23dcfac6e50e157b36eddf3989b7 Fri Jul 01 10:29:12 2016
+++ RTExFrame.m3 Tue Jun 21 11:59:05 2016
@@ -10,17 +10,17 @@
(/----------------------------------------- compiler generated descriptors --/)
(* This defines the low-level routines and data structures
used by the exception runtime.
See also m3middle/src/M3RT, which also describes these structures.
*)
(* RTExFrame.Alloca_jmpbuf and Target.Alloca_jmpbuf must match. *)
-CONST Alloca_jmpbuf = TRUE;
+CONST Alloca_jmpbuf = FALSE;
TYPE
ScopeKind = { Except, ExceptElse,
Finally, FinallyProc,
Raises, RaisesNone,
Lock };
TYPE
==
==
--- Target.m3 cm3-4e08861fd36f23dcfac6e50e157b36eddf3989b7 Fri Jul 01 10:29:12 2016
+++ Target.m3 Tue Jun 21 11:59:05 2016
@@ -59,37 +59,37 @@
System_name := SystemNames[sys];
|OS_name := in_OS_name; (* common values *) Atomic_lock_free := ARRAY [CGType.Word8..CGType.Addr] OF BOOLEAN { TRUE, .. }; (* this is overly optimistic... *) Allow_packed_byte_aligned := FALSE; All_floats_legal := TRUE; PCC_bitfield_type_matters := TRUE; Structure_size_boundary := 8; Little_endian := TRUE; Setjmp := "_setjmp"; (* RTExFrame.Alloca_jmpbuf and Target.Alloca_jmpbuf must match. *) |
* Alloca_jmpbuf := TRUE;
*
Alloca_jmpbuf := FALSE;
(* There is no portable stack walker, and therefore few systems have one.
Having a stack walker theoretically speeds up everything nicely. If
you are familiar with NT exception handling, all but x86 have a stack
walker. Not having a stack walker means that functions that have
try/except/finally/raise incur a codegen cost even if there is never a
raise -- for having the try. Having a stack walker means "zero cost"
for exception handling code that does not actually raise an exception.
If there is NOT a stack walker, prologues/epilogues for functions that
try/except/finally/raise call PushEFrame / PopEFrame, essentially to
build a walkable parallel stack.
If there is a stack walker, then raise can discover what PushEFrame /
PopEFrame effectively recorded.
NT/x86 has a highly optimized equivalent of PushEFrame / PopEFrame, not
currently used by Modula-3. *)
==
==
--- LazyConsole.i3 000 Thu Nov 01 00:26:16 2018
+++ LazyConsole.i3 Thu Jan 17 13:19:20 2019
@@ -5,7 +5,7 @@
IMPORT File, FileWin32, WinDef;
-PROCEDURE New (hd: WinDef.DWORD; ds: FileWin32.DirectionSet): File.T;
+PROCEDURE New (hd: WinDef.INT32; ds: FileWin32.DirectionSet): File.T;
(* Returns a file that if ever written to or read from will allocate
a fresh Windows console for the I/O. *)
==
==
--- LazyConsole.m3 000 Thu Nov 01 00:26:16 2018
+++ LazyConsole.m3 Thu Jan 17 13:20:54 2019
@@ -7,7 +7,7 @@
TYPE
T = Terminal.T OBJECT
* hd : WinDef.DWORD;
* hd : WinDef.INT32;
setup : BOOLEAN := FALSE;
OVERRIDES
read := Read;
@@ -16,7 +16,7 @@
status := Status;
END;
-PROCEDURE New (hd: WinDef.DWORD; ds: FileWin32.DirectionSet): File.T =
+PROCEDURE New (hd: WinDef.INT32; ds: FileWin32.DirectionSet): File.T =
BEGIN
RETURN NEW (T, ds := ds, hd := hd);
END New;
==
--- m3makefile 000 Thu Nov 01 00:26:16 2018
+++ m3makefile Thu Jan 17 14:09:22 2019
@@ -15,7 +15,7 @@
cp_if(Name & ".i3.tmp", Name & ".i3")
end
-if equal(TARGET, "NT386")
+if equal(TARGET, "AMD64_NT")
MakeGrisuDisable("GrisuDisable", "TRUE")
else
MakeGrisuDisable("GrisuDisable", "FALSE")
Best regards, Victor Miasnikov
P.S.
For best working with debugger:
--- RTOS.m3 000 Sun Jan 03 11:17:00 2016
+++ RTOS.m3 Fri Jan 04 13:15:50 2019
@@ -23,10 +23,12 @@
IF WinBase.IsDebuggerPresent () # 0 THEN
WinBase.DebugBreak ();
END;
* RTThread.SuspendOthers ();
* RTMachInfo.DumpStack (LOOPHOLE (Crash, ADDRESS), fp);
* (* RTThread.SuspendOthers ();
* RTMachInfo.DumpStack (LOOPHOLE (Crash, ADDRESS), fp); *)
* (** RTThread.ResumeOthers ();
RTSignal.RestoreHandlers (); (* so we really do crash... *)
* Exit (-1);
* ***)
* Exit (4000); (*** 0 not -1 ***)
END Crash;
(*********************
Some trivial patches to .cmd:
--- cm3CommandShell.CMD-000 Sun Jan 03 11:17:00 2016
+++ cm3CommandShell.CMD Wed Jan 02 15:24:30 2019
@@ -96,2 +96,3 @@
echo %_cm3_ThisOS_Long% | (find /I "Windows 7" >NUL:) && ((set _cm3_ThisOS=Win7) & goto ver_7)
+echo %_cm3_ThisOS_Long% | (find /I "Windows 10" >NUL:) && ((set _cm3_ThisOS=Win7) & goto ver_7)
echo %_cm3_ThisOS_Long% | (find /I "Windows Server 2008" >NUL:) && ((set _cm3_ThisOS=2008) & goto ver_2008)
[/code]
--- do-cm3.cmd 000 Sun Jan 03 11:17:00 2016
+++ do-cm3.cmd Sat Dec 29 11:46:06 2018
@@ -85,6 +85,7 @@
if NOT exist %SystemRoot%\system32\systeminfo.exe goto ver_NoSysInfo
FOR /F "usebackq tokens=3* delims=: " %%i IN (|systeminfo ^| find /I "OS Name"|) DO set _cm3_ThisOS_Long=%%i %%j
echo %_cm3_ThisOS_Long% | (find /I "Windows Vista" >NUL:) && ((set _cm3_ThisOS=Vista) & goto ver_Vista)
+echo %_cm3_ThisOS_Long% | (find /I "Windows 10" >NUL:) && ((set _cm3_ThisOS=Win7) & goto ver_7)
echo %_cm3_ThisOS_Long% | (find /I "Windows 7" >NUL:) && ((set _cm3_ThisOS=Win7) & goto ver_7)
echo %_cm3_ThisOS_Long% | (find /I "Windows Server 2008" >NUL:) && ((set _cm3_ThisOS=2008) & goto ver_2008)
--- RCC_upgradeCM3.cmd 000 Sun Jan 03 11:17:00 2016
+++ RCC_upgradeCM3.cmd Wed Jan 02 16:45:50 2019
@@ -48,7 +48,7 @@
set _cm3_Repeat=1
set _cm3_DO=
set _z_ctrlArgs=
-set _z_Stage3=min
+set _z_Stage3=all
@@ -113,7 +113,7 @@
if exist "bin\cm3.exe" if exist "pkg" set CM3_ROOT=%CD%& popd & goto FoundRoot
cd ..
if exist "bin\cm3.exe" if exist "pkg" set CM3_ROOT=%CD%& popd & goto FoundRoot
-if exist "C:\cm3\bin\cm3.exe" if exist "C:\cm3\pkg" set CM3_ROOT=C:\cm3& popd & goto FoundRoot
+if exist "D:\cm3\bin\cm3.exe" if exist "D:\cm3\pkg" set CM3_ROOT=D:\cm3& popd & goto FoundRoot
popd
rem otherwise, search the existing PATH environment variable to try and find the root of the cm3 installation
for %%F in (cm3.exe) do set CM3_ROOT=%%~dp$PATH:F..
@@ -138,7 +138,7 @@
if /I "%_cm3_CommandReady%"=="TRUE" goto FindPkgInfo
echo Setting up environment variables for CM3 ...
echo.
-call c:\cm3\bin\cm3CommandShell.CMD SameWindow
+call d:\cm3\bin\cm3CommandShell.CMD SameWindow
@echo <https://github.com/echo> off
if /I not "%_cm3_CommandReady%"=="TRUE" goto FatalSetupCM3
@@ -237,7 +237,7 @@
echo Creating "%CM3_ROOT%\bin\cm3.cfg" ...
if exist "%CM3_ROOT%\bin\cm3.cfg" del /f %CM3_ROOT%\bin\cm3.cfg
REM OLD: echo INSTALL_ROOT = path() ^& "/..">%CM3_ROOT%\bin\cm3.cfg
-REM OLD: echo include(path() ^& "/config/NT386")>>%CM3_ROOT%\bin\cm3.cfg
+REM OLD: echo include(path() ^& "/config/AMD64_NT")>>%CM3_ROOT%\bin\cm3.cfg
copy /y %_cm3_PkgTree%m3-sys\cminstall\src\config-no-install\cm3.cfg %CM3_ROOT%\bin\cm3.cfg
if errorlevel 1 echo ERROR: Problem copying files.� & (set _cm3_ExitCode=5) & goto END
if not exist "%CM3_ROOT%\bin\cm3.cfg" echo ERROR: Problem copying files.� & (set _cm3_ExitCode=5) & goto END
@@ -287,12 +287,12 @@
:FN_FinishStage
:--------------
if "%_cm3_CM3Failure%"=="TRUE" echo ...skipping installation of cm3.exe due to errors.�.�.� & goto :EOF
-if not exist "%_cm3_PkgTree%m3-sys\cm3\NT386\cm3.exe" goto StageFailure
+if not exist "%_cm3_PkgTree%m3-sys\cm3\AMD64_NT\cm3.exe" goto StageFailure
echo ...installing new cm3.exe as "%CM3_ROOT%\bin\cm3.exe" ...
if exist "%CM3_ROOT%\bin\cm3.exe" del /f "%CM3_ROOT%\bin\cm3.exe"
if exist "%CM3_ROOT%\bin\cm3.pdb" del /f "%CM3_ROOT%\bin\cm3.pdb"
-copy "%_cm3_PkgTree%m3-sys\cm3\NT386\cm3.exe" "%CM3_ROOT%\bin\cm3.exe"
-if exist "%_cm3_PkgTree%m3-sys\cm3\NT386\cm3.pdb" copy "%_cm3_PkgTree%m3-sys\cm3\NT386\cm3.pdb" "%CM3_ROOT%\bin\cm3.pdb"
+copy "%_cm3_PkgTree%m3-sys\cm3\AMD64_NT\cm3.exe" "%CM3_ROOT%\bin\cm3.exe"
+if exist "%_cm3_PkgTree%m3-sys\cm3\AMD64_NT\cm3.pdb" copy "%_cm3_PkgTree%m3-sys\cm3\AMD64_NT\cm3.pdb" "%CM3_ROOT%\bin\cm3.pdb"
if not exist "%CM3_ROOT%\bin\cm3.exe" goto StageFailure
goto :EOF
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#47>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AGVctIQg2Lmj_Q6yXVZj9DcFywcxv8aHks5vY4pugaJpZM4cBcTE>.
|
Thanks! In fact, it's result of Modula-3 project source code quality: it's good for reading, optimal amount of ASSERTs is very useful for development, etc.
Yes, I think patches need some refactoring. ==
== need to rewrite for it would be usefull in both case ( 32/64 bits )
|
I had it working long ago with the C backend. :)
- Jay
…________________________________
From: Rodney M. Bates <rbatesjk@lcwb.coop>
Sent: Monday, March 25, 2019 8:25 AM
To: modula3/cm3; VictorMiasnikov; modula3/cm3; m3devel; Jay
Subject: Re: [modula3/cm3] Modula-3 for Windows x64 ( m3devel 2019-January ) (#47)
Looks like good work. Are there still unsolved problems? Sorry I can''t help, for lack of a
windows machine.
Jay?
On 03/21/2019 08:34 AM, VictorMiasnikov wrote:
I think that need a disscussion
It's possible duplicate of
<https://m3lists.elegosoft.com/pipermail/m3devel/2019-January.txt>
Subject: [M3devel] It's time to AMD_64. Modula-3 for Windows x64
Hi!
It's time to AMD_64
I started from
https://modula3.elegosoft.com/cm3/uploaded-archives/
cm3-min-AMD64_NT-d5.9.0-VC110-20131012.msi
cm3-all-AMD64_NT-d5.9.0-VC110-20131012.zip
I have worked Modula-3 for Windows x64
There some must important patches:
==
--- RTExFrame.m3 cm3-4e08861fd36f23dcfac6e50e157b36eddf3989b7 Fri Jul 01 10:29:12 2016
+++ RTExFrame.m3 Tue Jun 21 11:59:05 2016
@@ -10,17 +10,17 @@
(/----------------------------------------- compiler generated descriptors --/)
(* This defines the low-level routines and data structures
used by the exception runtime.
See also m3middle/src/M3RT, which also describes these structures.
*)
(* RTExFrame.Alloca_jmpbuf and Target.Alloca_jmpbuf must match. *)
-CONST Alloca_jmpbuf = TRUE;
+CONST Alloca_jmpbuf = FALSE;
TYPE
ScopeKind = { Except, ExceptElse,
Finally, FinallyProc,
Raises, RaisesNone,
Lock };
TYPE
==
==
--- Target.m3 cm3-4e08861fd36f23dcfac6e50e157b36eddf3989b7 Fri Jul 01 10:29:12 2016
+++ Target.m3 Tue Jun 21 11:59:05 2016
@@ -59,37 +59,37 @@
System_name := SystemNames[sys];
|OS_name := in_OS_name; (* common values *) Atomic_lock_free := ARRAY [CGType.Word8..CGType.Addr] OF BOOLEAN { TRUE, .. }; (* this is overly optimistic... *) Allow_packed_byte_aligned := FALSE; All_floats_legal := TRUE; PCC_bitfield_type_matters := TRUE; Structure_size_boundary := 8; Little_endian := TRUE; Setjmp := "_setjmp"; (* RTExFrame.Alloca_jmpbuf and Target.Alloca_jmpbuf must match. *) |
* Alloca_jmpbuf := TRUE;
*
Alloca_jmpbuf := FALSE;
(* There is no portable stack walker, and therefore few systems have one.
Having a stack walker theoretically speeds up everything nicely. If
you are familiar with NT exception handling, all but x86 have a stack
walker. Not having a stack walker means that functions that have
try/except/finally/raise incur a codegen cost even if there is never a
raise -- for having the try. Having a stack walker means "zero cost"
for exception handling code that does not actually raise an exception.
If there is NOT a stack walker, prologues/epilogues for functions that
try/except/finally/raise call PushEFrame / PopEFrame, essentially to
build a walkable parallel stack.
If there is a stack walker, then raise can discover what PushEFrame /
PopEFrame effectively recorded.
NT/x86 has a highly optimized equivalent of PushEFrame / PopEFrame, not
currently used by Modula-3. *)
==
==
--- LazyConsole.i3 000 Thu Nov 01 00:26:16 2018
+++ LazyConsole.i3 Thu Jan 17 13:19:20 2019
@@ -5,7 +5,7 @@
IMPORT File, FileWin32, WinDef;
-PROCEDURE New (hd: WinDef.DWORD; ds: FileWin32.DirectionSet): File.T;
+PROCEDURE New (hd: WinDef.INT32; ds: FileWin32.DirectionSet): File.T;
(* Returns a file that if ever written to or read from will allocate
a fresh Windows console for the I/O. *)
==
==
--- LazyConsole.m3 000 Thu Nov 01 00:26:16 2018
+++ LazyConsole.m3 Thu Jan 17 13:20:54 2019
@@ -7,7 +7,7 @@
TYPE
T = Terminal.T OBJECT
* hd : WinDef.DWORD;
* hd : WinDef.INT32;
setup : BOOLEAN := FALSE;
OVERRIDES
read := Read;
@@ -16,7 +16,7 @@
status := Status;
END;
-PROCEDURE New (hd: WinDef.DWORD; ds: FileWin32.DirectionSet): File.T =
+PROCEDURE New (hd: WinDef.INT32; ds: FileWin32.DirectionSet): File.T =
BEGIN
RETURN NEW (T, ds := ds, hd := hd);
END New;
==
--- m3makefile 000 Thu Nov 01 00:26:16 2018
+++ m3makefile Thu Jan 17 14:09:22 2019
@@ -15,7 +15,7 @@
cp_if(Name & ".i3.tmp", Name & ".i3")
end
-if equal(TARGET, "NT386")
+if equal(TARGET, "AMD64_NT")
MakeGrisuDisable("GrisuDisable", "TRUE")
else
MakeGrisuDisable("GrisuDisable", "FALSE")
Best regards, Victor Miasnikov
P.S.
For best working with debugger:
--- RTOS.m3 000 Sun Jan 03 11:17:00 2016
+++ RTOS.m3 Fri Jan 04 13:15:50 2019
@@ -23,10 +23,12 @@
IF WinBase.IsDebuggerPresent () # 0 THEN
WinBase.DebugBreak ();
END;
* RTThread.SuspendOthers ();
* RTMachInfo.DumpStack (LOOPHOLE (Crash, ADDRESS), fp);
* (* RTThread.SuspendOthers ();
* RTMachInfo.DumpStack (LOOPHOLE (Crash, ADDRESS), fp); *)
* (** RTThread.ResumeOthers ();
RTSignal.RestoreHandlers (); (* so we really do crash... *)
* Exit (-1);
* ***)
* Exit (4000); (*** 0 not -1 ***)
END Crash;
(*********************
Some trivial patches to .cmd:
--- cm3CommandShell.CMD-000 Sun Jan 03 11:17:00 2016
+++ cm3CommandShell.CMD Wed Jan 02 15:24:30 2019
@@ -96,2 +96,3 @@
echo %_cm3_ThisOS_Long% | (find /I "Windows 7" >NUL:) && ((set _cm3_ThisOS=Win7) & goto ver_7)
+echo %_cm3_ThisOS_Long% | (find /I "Windows 10" >NUL:) && ((set _cm3_ThisOS=Win7) & goto ver_7)
echo %_cm3_ThisOS_Long% | (find /I "Windows Server 2008" >NUL:) && ((set _cm3_ThisOS=2008) & goto ver_2008)
[/code]
--- do-cm3.cmd 000 Sun Jan 03 11:17:00 2016
+++ do-cm3.cmd Sat Dec 29 11:46:06 2018
@@ -85,6 +85,7 @@
if NOT exist %SystemRoot%\system32\systeminfo.exe goto ver_NoSysInfo
FOR /F "usebackq tokens=3* delims=: " %%i IN (|systeminfo ^| find /I "OS Name"|) DO set _cm3_ThisOS_Long=%%i %%j
echo %_cm3_ThisOS_Long% | (find /I "Windows Vista" >NUL:) && ((set _cm3_ThisOS=Vista) & goto ver_Vista)
+echo %_cm3_ThisOS_Long% | (find /I "Windows 10" >NUL:) && ((set _cm3_ThisOS=Win7) & goto ver_7)
echo %_cm3_ThisOS_Long% | (find /I "Windows 7" >NUL:) && ((set _cm3_ThisOS=Win7) & goto ver_7)
echo %_cm3_ThisOS_Long% | (find /I "Windows Server 2008" >NUL:) && ((set _cm3_ThisOS=2008) & goto ver_2008)
--- RCC_upgradeCM3.cmd 000 Sun Jan 03 11:17:00 2016
+++ RCC_upgradeCM3.cmd Wed Jan 02 16:45:50 2019
@@ -48,7 +48,7 @@
set _cm3_Repeat=1
set _cm3_DO=
set _z_ctrlArgs=
-set _z_Stage3=min
+set _z_Stage3=all
@@ -113,7 +113,7 @@
if exist "bin\cm3.exe" if exist "pkg" set CM3_ROOT=%CD%& popd & goto FoundRoot
cd ..
if exist "bin\cm3.exe" if exist "pkg" set CM3_ROOT=%CD%& popd & goto FoundRoot
-if exist "C:\cm3\bin\cm3.exe" if exist "C:\cm3\pkg" set CM3_ROOT=C:\cm3& popd & goto FoundRoot
+if exist "D:\cm3\bin\cm3.exe" if exist "D:\cm3\pkg" set CM3_ROOT=D:\cm3& popd & goto FoundRoot
popd
rem otherwise, search the existing PATH environment variable to try and find the root of the cm3 installation
for %%F in (cm3.exe) do set CM3_ROOT=%%~dp$PATH:F..
@@ -138,7 +138,7 @@
if /I "%_cm3_CommandReady%"=="TRUE" goto FindPkgInfo
echo Setting up environment variables for CM3 ...
echo.
-call c:\cm3\bin\cm3CommandShell.CMD SameWindow
+call d:\cm3\bin\cm3CommandShell.CMD SameWindow
@echo <https://github.com/echo> off
if /I not "%_cm3_CommandReady%"=="TRUE" goto FatalSetupCM3
@@ -237,7 +237,7 @@
echo Creating "%CM3_ROOT%\bin\cm3.cfg" ...
if exist "%CM3_ROOT%\bin\cm3.cfg" del /f %CM3_ROOT%\bin\cm3.cfg
REM OLD: echo INSTALL_ROOT = path() ^& "/..">%CM3_ROOT%\bin\cm3.cfg
-REM OLD: echo include(path() ^& "/config/NT386")>>%CM3_ROOT%\bin\cm3.cfg
+REM OLD: echo include(path() ^& "/config/AMD64_NT")>>%CM3_ROOT%\bin\cm3.cfg
copy /y %_cm3_PkgTree%m3-sys\cminstall\src\config-no-install\cm3.cfg %CM3_ROOT%\bin\cm3.cfg
if errorlevel 1 echo ERROR: Problem copying files.� & (set _cm3_ExitCode=5) & goto END
if not exist "%CM3_ROOT%\bin\cm3.cfg" echo ERROR: Problem copying files.� & (set _cm3_ExitCode=5) & goto END
@@ -287,12 +287,12 @@
:FN_FinishStage
:--------------
if "%_cm3_CM3Failure%"=="TRUE" echo ...skipping installation of cm3.exe due to errors.�.�.� & goto :EOF
-if not exist "%_cm3_PkgTree%m3-sys\cm3\NT386\cm3.exe" goto StageFailure
+if not exist "%_cm3_PkgTree%m3-sys\cm3\AMD64_NT\cm3.exe" goto StageFailure
echo ...installing new cm3.exe as "%CM3_ROOT%\bin\cm3.exe" ...
if exist "%CM3_ROOT%\bin\cm3.exe" del /f "%CM3_ROOT%\bin\cm3.exe"
if exist "%CM3_ROOT%\bin\cm3.pdb" del /f "%CM3_ROOT%\bin\cm3.pdb"
-copy "%_cm3_PkgTree%m3-sys\cm3\NT386\cm3.exe" "%CM3_ROOT%\bin\cm3.exe"
-if exist "%_cm3_PkgTree%m3-sys\cm3\NT386\cm3.pdb" copy "%_cm3_PkgTree%m3-sys\cm3\NT386\cm3.pdb" "%CM3_ROOT%\bin\cm3.pdb"
+copy "%_cm3_PkgTree%m3-sys\cm3\AMD64_NT\cm3.exe" "%CM3_ROOT%\bin\cm3.exe"
+if exist "%_cm3_PkgTree%m3-sys\cm3\AMD64_NT\cm3.pdb" copy "%_cm3_PkgTree%m3-sys\cm3\AMD64_NT\cm3.pdb" "%CM3_ROOT%\bin\cm3.pdb"
if not exist "%CM3_ROOT%\bin\cm3.exe" goto StageFailure
goto :EOF
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#47>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AGVctIQg2Lmj_Q6yXVZj9DcFywcxv8aHks5vY4pugaJpZM4cBcTE>.
|
Jay K> I had it working long ago with the C backend. :) a) + b) See list of candidates: "cm3 2016-06-01 Or cm3-56c60ddf3a0027f5fb837cb0e9bd8e089bcbce47 -Ok!- Old" " ... cm3-5a874253f5f5a82d6553c7ac46cd881841a45f23" "cm3 cm3-all-AMD64_NT-d5.10.0-VC110-20170824 AMD_64 Target + cm3-master 2017-08-24" "cm3 2018-08-25 tree--packedVars + Unicode" c) With
it doesn't work: ==
== h) We are need ( as temporary solution) code a-la this:
because in: didn't implement "right fix":
y) What means "nonexistent AMD64_NT"?
z) "with the C backend" -- in fact "only with C backend" :-( |
Agreed, only with C backend. jmpbuf, hm. It is supposed to generally be true:
and then we call alloca at runtime, and there is a just a pointer here in the frame. This is slower, but it is more "portabe" because the compiler and runtime do not need per-target information. It can get the size from the target C compiler, here:
I agree |
Ok, thank You! |
Because of part of modula3#47 (comment).
Interesting:
So can you explain your jmpbuf change? |
I found ( by "binary search") build of Modula-3 that has described "strange behavior".
I found some "hacking".
Please, don't "kill" support of VC110 ( "as minimum"). |
Ok I see the problem with jmpbuf. |
NT 6.1 is Windows 7, so at least that is kinda recent. |
I used "VC110" because I has started from cm3-all-AMD64_NT-d5.9.0-VC110-20131012.zip
On "today" .exe and .dll generated by Modula-3 for Win x64 "have sense" on Way that can implement this goal doesn't principal ;-) ( Has You received my e-mail messages? |
I not sure about the email but in general I do nothing with .cmd files. We should delete them, generally. It is horrible language for any purpose. Use the python scripts instead. Just because old release uses old compiler does not mean we have to keep supporting old compiler. Then we’d never “progress”. |
Server 2008R2 is probably Windows 7. The names are confusing. |
Yeah that GetStdHandle change is wierd, or C or Mod3 integers are wierd. |
I.e. "mklib.exe problem" fixed? |
( "May 2019 Archives" looks very strange: https://m3lists.elegosoft.com/pipermail/m3devel/2019-May/date.htm •[M3devel] Impossible to compile to recent Windows versions dirk muysers )
Use modern build:
How sent it to You? About cm3.cfg I should be use this:
|
*** runtime error: There is compiling error: new source -> compiling TCP.m3 ( There is line 310 :
) Related patch:
2020-02-23:
use this correction
P.S. May be FIONREAD is need correction too? ( ADA source code, as example:
) |
Q: RC>> A: I ( V.V.M.) created some distributives: Our friend ( Active Oberon, A2 (Bluebottle) developer and GoLang / C # / Delphi software engineer) Yaroslav Romanchenko helped us publish the necessary files on his website ( sage.com.ua ). cm3 2019-06-02 Unicode AMD_64 Target ( by MS VS 2012) cm3 2019-06-02 Unicode AMD_64 Target ( by MS VS 2017) ( |
Sorry for the huge delay. I commited a fix for setjmp. |
Ok, master is much better now? I and I made a release. Grisu someone should look into more. |
No problem -)
File It's non Ok state for beginner M3 users.
Thanks! P.S. Q: A:
P.P.S. I have some problems with MS VS 2012 ( later version doesn't tested yet). |
As temporary solution, please, implement this patch:
|
Passing -1 to WinBase.ExitProcess doesn't elicit a compiler warning (on the
32-bit machine at least)?
…On Thu, Feb 25, 2021 at 1:36 AM VictorMiasnikov ***@***.***> wrote:
Jay K:
It worked a lot, and then a lot of:
***
*** runtime error:
*** <*ASSERT*> failed.
*** file "..\src\thread\WIN32\ThreadWin32.m3", line 798
***
. . .
any ideas?
This is AMD64_NT.
. . .
Re: [M3devel] win32 <* ASSERT suspend_cnt = 0 *> ? another int32 vs. uint32 on win64 problem
Jay K
Ok it seems like a bug in reporting of assertion failures.
The repro is:
\python27\python boot1.py PA32_HPUX c
or
\bin\amd64\windbg /g /G /o \python27\python boot1.py PA32_HPUX c
which its an assertion failure in the C backend, I will look into.
IF WinBase.IsDebuggerPresent () # 0 THEN
WinBase.DebugBreak ();
END;
3:013> k
# Child-SP RetAddr Call Site
KERNELBASE!DebugBreak
02 000000bc`984fd2c0 00007ff6`4baa2e9f cm3!RTOS__Crash+0x43 [C:\s\cm3\m3-libs\m3core\src\runtime\WIN32\RTOS.m3 @ 26]
. . .
0e 000000bc`984fd720 00007ff6`4b7050f7 cm3!M_M3C_L_166_CRASH+0x1a [C:\s\cm3\m3-sys\m3back\AMD64_NT\M3C.m3.c @ 31094]
C backend assertion failure here:
0f 000000bc`984fd750 00007ff6`4b7038d4 cm3!M3C__TIntLiteral+0x5a7 [C:\s\cm3\m3-sys\m3back\src\M3C.m3 @ 4830]
. . .
37 000000bc`984ffb60 00007ff6`4bb12974 cm3!main+0x38 [C:\s\cm3\m3-sys\cm3\AMD64_NT\_m3main.c @ 23]
38 (Inline Function) --------`-------- cm3!invoke_main+0x22 [d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 78]
which if you go past the breakpoint, which simulates no debugger, it hits the assertion failure
I reported:
3:013> k
. 13 Id: a35c.8d38 Suspend: 1 Teb: 000000bc`982c8000 Unfrozen
# Child-SP RetAddr Call Site
KERNELBASE!DebugBreak
02 000000bc`984fc8f0 00007ff6`4baa2e9f cm3!RTOS__Crash+0x43 [C:\s\cm3\m3-libs\m3core\src\runtime\WIN32\RTOS.m3 @ 26]
. . .
0d 000000bc`984fccb0 00007ff6`4bac003a cm3!RTHooks__ReportFault+0xfe [C:\s\cm3\m3-libs\m3core\src\runtime\common\RTHooks.m3 @ 112]
The ThreadWin32 assertion failure.
0e 000000bc`984fcd50 00007ff6`4babbf09 cm3!M_ThreadWin32_L_137_CRASH+0x1a [C:\s\cm3\m3-libs\m3core\AMD64_NT\ThreadWin32.m3.c @ 4356]
. . .
2b 000000bc`984fd750 00007ff6`4b7038d4 cm3!M3C__TIntLiteral+0x5a7 [C:\s\cm3\m3-sys\m3back\src\M3C.m3 @ 4830]
The first suspend is here:
3:013> k
# Child-SP RetAddr Call Site
00 000000d3`6839d2d8 00007ff6`4bae8e28 cm3!RTThread__SuspendOthers [C:\s\cm3\m3-libs\m3core\src\thread\WIN32\ThreadWin32.m3 @ 793]
. . .
0e 000000d3`6839d770 00007ff6`4b7038d4 cm3!M3C__TIntLiteral+0x5a7 [C:\s\cm3\m3-sys\m3back\src\M3C.m3 @ 4830]
and then.."funny"..
PROCEDURE Crash () =
CONST Magic = 1 * ADRSIZE (INTEGER); (* == offset of "fp" in this frame *)
VAR fp: ADDRESS := ADR (fp) + Magic; (* == my frame pointer *)
BEGIN
IF WinBase.IsDebuggerPresent () # 0 THEN
WinBase.DebugBreak ();
END;
RTThread.SuspendOthers (); <== probably the first suspend
RTMachInfo.DumpStack (LOOPHOLE (Crash, ADDRESS), fp);
RTSignal.RestoreHandlers (); (* so we really do crash... *)
Exit (-1); <== it gets here
END Crash;
PROCEDURE Exit (n: INTEGER) = <== and then here
BEGIN
WinBase.ExitProcess (n);
END Exit;
and it is our recent friend, a range fault on the exit code.
0f 000000d3`6839d2a0 00007ff6`4bae8e4a cm3!RTOS__Exit(
int64 n_L_17 = 0n-1)+0x44 [C:\s\cm3\m3-libs\m3core\src\runtime\WIN32\RTOS.m3 @ 16]
3:013> u cm3!RTOS__Exit
cm3!RTOS__Exit [C:\s\cm3\m3-libs\m3core\src\runtime\WIN32\RTOS.m3 @ 18]:
. . .
00007ff6`4bae8dc4 8b4c2420 mov ecx,dword ptr [rsp+20h]
C:\s\cm3\m3-libs\m3core\src\win32\WinBase.i3(1231):<*EXTERNAL ExitProcess:WINAPI*>
C:\s\cm3\m3-libs\m3core\src\win32\WinBase.i3(1232):PROCEDURE ExitProcess (uExitCode: UINT32);
Voila.
ExitProcess is declared as taking an unsigned integer but we pass negative.
So again I think we are being somehow overzealous regarding integer ranges.
I mean, I get, that quality is important and this seems correct, based on
some simple principles, but the result seems very unsatifactory.
On the 32bit system this is Word.T and you can pass any INTEGER value, there are
no checks I guess, and it works.
But the extension to a 64bit system adds checks and not all INTEGER values are valid,
not even ones that fit in 32bits like -1.
Would it make sense to declare a type with the "1.5" range -2^31..2^32?
Again, I am tempted to change to plain 64bit INTEGER. But that changes e.g.
the type of taking the address.
Pass any value that fits in a register, with the understanding, perhaps not known,
that the upper 32bits are silently ignored???
I realize is an exit upon an assertion failure, so it doesn't really matter,
in this case, but Exit(-1) imho should be portable between Win32 and Win64.
I know I could say Exit(16_ffffffff) or have a wrapper that does Word.And(Last(UINT32))
but I don't think these should be needed. -1 should be portable between 32bit and 64bit.
Please help me to understand and advise what to do?
The nested suspend should probably be relaxed somehow too?
- Jay
As temporary solution, please inplement this patch:
--- m3-libs\m3core\src\runtime\WIN32\RTOS.m3 000 Sun Jan 03 11:17:00 2016
+++ m3-libs\m3core\src\runtime\WIN32\RTOS.m3 Thu Feb 25 12:31:36 2021
@@ -23,10 +23,11 @@
IF WinBase.IsDebuggerPresent () # 0 THEN
WinBase.DebugBreak ();
END;
- RTThread.SuspendOthers ();
- RTMachInfo.DumpStack (LOOPHOLE (Crash, ADDRESS), fp);
- RTSignal.RestoreHandlers (); (* so we really do crash... *)
- Exit (-1);
+ (*** RTThread.SuspendOthers (); ***)
+ (*** RTMachInfo.DumpStack (LOOPHOLE (Crash, ADDRESS), fp); *) ***)
+ (*** RTThread.ResumeOthers (); ***)
+ (*** RTSignal.RestoreHandlers (); (* so we really do crash... *) ***)
+ Exit (4000);
END Crash;
(*********************
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#47 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKYNJO5BW2SA7UDIA6MJDTTAYK2HANCNFSM4HAFYTCA>
.
|
I don't remember exactly: I implement this path
long time ago. P.S. I think "compiler warning" was generated. |
so what you write:
So again I think we are being somehow overzealous regarding integer ranges.
I heartily disagree! The compiler is being UNDERzealous. Passing -1
to something that's declared as "UINTxxx" is an obvious static error.
The code is simply wrong. It would be better if the compiler could
catch this and reject the program (or at least give you a prominent
warning about it, if you prefer).
I mean, I get, that quality is important and this seems correct, based on
some simple principles, but the result seems very unsatifactory.
On the 32bit system this is Word.T and you can pass any INTEGER value, there are
no checks I guess, and it works.
Yes you clearly understand the technical reason that the code Exit(-1)
is *accepted* on the 32-bit machine, it is because Word.T = INTEGER.
This, unfortunately, makes it impossible for the compiler to check and
complain that you are passing a negative number to a procedure
requiring a non-negative number.
I would do this as follows:
CONST NegOne = LAST(UINT32); (* or use a better name if you don't want
the confusion of "Neg" here *)
...
Exit(NegOne)
...
…On Thu, Feb 25, 2021 at 1:36 AM VictorMiasnikov ***@***.***> wrote:
Jay K:
It worked a lot, and then a lot of:
***
*** runtime error:
*** <*ASSERT*> failed.
*** file "..\src\thread\WIN32\ThreadWin32.m3", line 798
***
. . .
any ideas?
This is AMD64_NT.
. . .
Re: [M3devel] win32 <* ASSERT suspend_cnt = 0 *> ? another int32 vs. uint32 on win64 problem
Jay K
Ok it seems like a bug in reporting of assertion failures.
The repro is:
\python27\python boot1.py PA32_HPUX c
or
\bin\amd64\windbg /g /G /o \python27\python boot1.py PA32_HPUX c
which its an assertion failure in the C backend, I will look into.
IF WinBase.IsDebuggerPresent () # 0 THEN
WinBase.DebugBreak ();
END;
3:013> k
# Child-SP RetAddr Call Site
KERNELBASE!DebugBreak
02 000000bc`984fd2c0 00007ff6`4baa2e9f cm3!RTOS__Crash+0x43 [C:\s\cm3\m3-libs\m3core\src\runtime\WIN32\RTOS.m3 @ 26]
. . .
0e 000000bc`984fd720 00007ff6`4b7050f7 cm3!M_M3C_L_166_CRASH+0x1a [C:\s\cm3\m3-sys\m3back\AMD64_NT\M3C.m3.c @ 31094]
C backend assertion failure here:
0f 000000bc`984fd750 00007ff6`4b7038d4 cm3!M3C__TIntLiteral+0x5a7 [C:\s\cm3\m3-sys\m3back\src\M3C.m3 @ 4830]
. . .
37 000000bc`984ffb60 00007ff6`4bb12974 cm3!main+0x38 [C:\s\cm3\m3-sys\cm3\AMD64_NT\_m3main.c @ 23]
38 (Inline Function) --------`-------- cm3!invoke_main+0x22 [d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 78]
which if you go past the breakpoint, which simulates no debugger, it hits the assertion failure
I reported:
3:013> k
. 13 Id: a35c.8d38 Suspend: 1 Teb: 000000bc`982c8000 Unfrozen
# Child-SP RetAddr Call Site
KERNELBASE!DebugBreak
02 000000bc`984fc8f0 00007ff6`4baa2e9f cm3!RTOS__Crash+0x43 [C:\s\cm3\m3-libs\m3core\src\runtime\WIN32\RTOS.m3 @ 26]
. . .
0d 000000bc`984fccb0 00007ff6`4bac003a cm3!RTHooks__ReportFault+0xfe [C:\s\cm3\m3-libs\m3core\src\runtime\common\RTHooks.m3 @ 112]
The ThreadWin32 assertion failure.
0e 000000bc`984fcd50 00007ff6`4babbf09 cm3!M_ThreadWin32_L_137_CRASH+0x1a [C:\s\cm3\m3-libs\m3core\AMD64_NT\ThreadWin32.m3.c @ 4356]
. . .
2b 000000bc`984fd750 00007ff6`4b7038d4 cm3!M3C__TIntLiteral+0x5a7 [C:\s\cm3\m3-sys\m3back\src\M3C.m3 @ 4830]
The first suspend is here:
3:013> k
# Child-SP RetAddr Call Site
00 000000d3`6839d2d8 00007ff6`4bae8e28 cm3!RTThread__SuspendOthers [C:\s\cm3\m3-libs\m3core\src\thread\WIN32\ThreadWin32.m3 @ 793]
. . .
0e 000000d3`6839d770 00007ff6`4b7038d4 cm3!M3C__TIntLiteral+0x5a7 [C:\s\cm3\m3-sys\m3back\src\M3C.m3 @ 4830]
and then.."funny"..
PROCEDURE Crash () =
CONST Magic = 1 * ADRSIZE (INTEGER); (* == offset of "fp" in this frame *)
VAR fp: ADDRESS := ADR (fp) + Magic; (* == my frame pointer *)
BEGIN
IF WinBase.IsDebuggerPresent () # 0 THEN
WinBase.DebugBreak ();
END;
RTThread.SuspendOthers (); <== probably the first suspend
RTMachInfo.DumpStack (LOOPHOLE (Crash, ADDRESS), fp);
RTSignal.RestoreHandlers (); (* so we really do crash... *)
Exit (-1); <== it gets here
END Crash;
PROCEDURE Exit (n: INTEGER) = <== and then here
BEGIN
WinBase.ExitProcess (n);
END Exit;
and it is our recent friend, a range fault on the exit code.
0f 000000d3`6839d2a0 00007ff6`4bae8e4a cm3!RTOS__Exit(
int64 n_L_17 = 0n-1)+0x44 [C:\s\cm3\m3-libs\m3core\src\runtime\WIN32\RTOS.m3 @ 16]
3:013> u cm3!RTOS__Exit
cm3!RTOS__Exit [C:\s\cm3\m3-libs\m3core\src\runtime\WIN32\RTOS.m3 @ 18]:
. . .
00007ff6`4bae8dc4 8b4c2420 mov ecx,dword ptr [rsp+20h]
C:\s\cm3\m3-libs\m3core\src\win32\WinBase.i3(1231):<*EXTERNAL ExitProcess:WINAPI*>
C:\s\cm3\m3-libs\m3core\src\win32\WinBase.i3(1232):PROCEDURE ExitProcess (uExitCode: UINT32);
Voila.
ExitProcess is declared as taking an unsigned integer but we pass negative.
So again I think we are being somehow overzealous regarding integer ranges.
I mean, I get, that quality is important and this seems correct, based on
some simple principles, but the result seems very unsatifactory.
On the 32bit system this is Word.T and you can pass any INTEGER value, there are
no checks I guess, and it works.
But the extension to a 64bit system adds checks and not all INTEGER values are valid,
not even ones that fit in 32bits like -1.
Would it make sense to declare a type with the "1.5" range -2^31..2^32?
Again, I am tempted to change to plain 64bit INTEGER. But that changes e.g.
the type of taking the address.
Pass any value that fits in a register, with the understanding, perhaps not known,
that the upper 32bits are silently ignored???
I realize is an exit upon an assertion failure, so it doesn't really matter,
in this case, but Exit(-1) imho should be portable between Win32 and Win64.
I know I could say Exit(16_ffffffff) or have a wrapper that does Word.And(Last(UINT32))
but I don't think these should be needed. -1 should be portable between 32bit and 64bit.
Please help me to understand and advise what to do?
The nested suspend should probably be relaxed somehow too?
- Jay
As temporary solution, please inplement this patch:
--- m3-libs\m3core\src\runtime\WIN32\RTOS.m3 000 Sun Jan 03 11:17:00 2016
+++ m3-libs\m3core\src\runtime\WIN32\RTOS.m3 Thu Feb 25 12:31:36 2021
@@ -23,10 +23,11 @@
IF WinBase.IsDebuggerPresent () # 0 THEN
WinBase.DebugBreak ();
END;
- RTThread.SuspendOthers ();
- RTMachInfo.DumpStack (LOOPHOLE (Crash, ADDRESS), fp);
- RTSignal.RestoreHandlers (); (* so we really do crash... *)
- Exit (-1);
+ (*** RTThread.SuspendOthers (); ***)
+ (*** RTMachInfo.DumpStack (LOOPHOLE (Crash, ADDRESS), fp); *) ***)
+ (*** RTThread.ResumeOthers (); ***)
+ (*** RTSignal.RestoreHandlers (); (* so we really do crash... *) ***)
+ Exit (4000);
END Crash;
(*********************
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#47 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKYNJO5BW2SA7UDIA6MJDTTAYK2HANCNFSM4HAFYTCA>
.
|
Why not? See patch:
|
On 2/25/21 4:13 AM, Mika Nyström wrote:
so what you write:
>So again I think we are being somehow overzealous regarding integer ranges.
>
I heartily disagree! The compiler is being UNDERzealous. Passing -1
to something that's declared as "UINTxxx" is an obvious static error.
The code is simply wrong. It would be better if the compiler could
catch this and reject the program (or at least give you a prominent
warning about it, if you prefer).
I heartily agree (with Mika). Either -1 is wrong or UINT32 is wrong.
At least in the packedVars branch, I believe the compiler will give
a warning, but defer the error to runtime, to occur only if/when the
subject code is actually executed, which is not a static certainty.
Some time back, I questioned this behavior, but I have become a convert.
There are many places where it is needed in order to conveniently write
self-adapting code for some purpose or other. I have endeavored to implement
it for all cases where an error can sometimes be statically detected, but
Modula-3 calls it (in general) a checked runtime error. The compiler
was quite inconsistent about this. I may still have missed some,
but there are more than previously.
…
>I mean, I get, that quality is important and this seems correct, based on
>some simple principles, but the result seems very unsatifactory.
>
>
>On the 32bit system this is Word.T and you can pass any INTEGER value, there are
>no checks I guess, and it works.
Yes you clearly understand the technical reason that the code Exit(-1)
is *accepted* on the 32-bit machine, it is because Word.T = INTEGER.
This, unfortunately, makes it impossible for the compiler to check and
complain that you are passing a negative number to a procedure
requiring a non-negative number.
I would do this as follows:
CONST NegOne = LAST(UINT32); (* or use a better name if you don't want
the confusion of "Neg" here *)
...
Exit(NegOne)
...
On Thu, Feb 25, 2021 at 1:36 AM VictorMiasnikov ***@***.***>
wrote:
> Jay K:
> It worked a lot, and then a lot of:
>
>
>
> ***
> *** runtime error:
> *** <*ASSERT*> failed.
> *** file "..\src\thread\WIN32\ThreadWin32.m3", line 798
> ***
>
>
> . . .
>
> any ideas?
>
> This is AMD64_NT.
>
>
> . . .
>
>
> Re: [M3devel] win32 <* ASSERT suspend_cnt = 0 *> ? another int32 vs. uint32 on win64 problem
> Jay K
>
>
> Ok it seems like a bug in reporting of assertion failures.
>
> The repro is:
>
> \python27\python boot1.py PA32_HPUX c
>
> or
>
> \bin\amd64\windbg /g /G /o \python27\python boot1.py PA32_HPUX c
>
> which its an assertion failure in the C backend, I will look into.
>
> IF WinBase.IsDebuggerPresent () # 0 THEN
> WinBase.DebugBreak ();
> END;
>
> 3:013> k
> # Child-SP RetAddr Call Site
> KERNELBASE!DebugBreak
> 02 000000bc`984fd2c0 00007ff6`4baa2e9f cm3!RTOS__Crash+0x43 [C:\s\cm3\m3-libs\m3core\src\runtime\WIN32\RTOS.m3 @ 26]
> . . .
> 0e 000000bc`984fd720 00007ff6`4b7050f7 cm3!M_M3C_L_166_CRASH+0x1a [C:\s\cm3\m3-sys\m3back\AMD64_NT\M3C.m3.c @ 31094]
>
> C backend assertion failure here:
>
> 0f 000000bc`984fd750 00007ff6`4b7038d4 cm3!M3C__TIntLiteral+0x5a7 [C:\s\cm3\m3-sys\m3back\src\M3C.m3 @ 4830]
> . . .
> 37 000000bc`984ffb60 00007ff6`4bb12974 cm3!main+0x38 [C:\s\cm3\m3-sys\cm3\AMD64_NT\_m3main.c @ 23]
> 38 (Inline Function) --------`-------- cm3!invoke_main+0x22 [d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 78]
>
>
> which if you go past the breakpoint, which simulates no debugger, it hits the assertion failure
> I reported:
>
> 3:013> k
>
> . 13 Id: a35c.8d38 Suspend: 1 Teb: 000000bc`982c8000 Unfrozen
> # Child-SP RetAddr Call Site
> KERNELBASE!DebugBreak
> 02 000000bc`984fc8f0 00007ff6`4baa2e9f cm3!RTOS__Crash+0x43 [C:\s\cm3\m3-libs\m3core\src\runtime\WIN32\RTOS.m3 @ 26]
> . . .
> 0d 000000bc`984fccb0 00007ff6`4bac003a cm3!RTHooks__ReportFault+0xfe [C:\s\cm3\m3-libs\m3core\src\runtime\common\RTHooks.m3 @ 112]
>
> The ThreadWin32 assertion failure.
>
> 0e 000000bc`984fcd50 00007ff6`4babbf09 cm3!M_ThreadWin32_L_137_CRASH+0x1a [C:\s\cm3\m3-libs\m3core\AMD64_NT\ThreadWin32.m3.c @ 4356]
> . . .
> 2b 000000bc`984fd750 00007ff6`4b7038d4 cm3!M3C__TIntLiteral+0x5a7 [C:\s\cm3\m3-sys\m3back\src\M3C.m3 @ 4830]
>
>
> The first suspend is here:
> 3:013> k
> # Child-SP RetAddr Call Site
> 00 000000d3`6839d2d8 00007ff6`4bae8e28 cm3!RTThread__SuspendOthers [C:\s\cm3\m3-libs\m3core\src\thread\WIN32\ThreadWin32.m3 @ 793]
> . . .
> 0e 000000d3`6839d770 00007ff6`4b7038d4 cm3!M3C__TIntLiteral+0x5a7 [C:\s\cm3\m3-sys\m3back\src\M3C.m3 @ 4830]
>
>
> and then.."funny"..
>
> PROCEDURE Crash () =
> CONST Magic = 1 * ADRSIZE (INTEGER); (* == offset of "fp" in this frame *)
> VAR fp: ADDRESS := ADR (fp) + Magic; (* == my frame pointer *)
> BEGIN
> IF WinBase.IsDebuggerPresent () # 0 THEN
> WinBase.DebugBreak ();
> END;
> RTThread.SuspendOthers (); <== probably the first suspend
> RTMachInfo.DumpStack (LOOPHOLE (Crash, ADDRESS), fp);
> RTSignal.RestoreHandlers (); (* so we really do crash... *)
> Exit (-1); <== it gets here
> END Crash;
>
> PROCEDURE Exit (n: INTEGER) = <== and then here
> BEGIN
> WinBase.ExitProcess (n);
> END Exit;
>
>
> and it is our recent friend, a range fault on the exit code.
>
> 0f 000000d3`6839d2a0 00007ff6`4bae8e4a cm3!RTOS__Exit(
> int64 n_L_17 = 0n-1)+0x44 [C:\s\cm3\m3-libs\m3core\src\runtime\WIN32\RTOS.m3 @ 16]
>
>
> 3:013> u cm3!RTOS__Exit
> cm3!RTOS__Exit [C:\s\cm3\m3-libs\m3core\src\runtime\WIN32\RTOS.m3 @ 18]:
> . . .
> 00007ff6`4bae8dc4 8b4c2420 mov ecx,dword ptr [rsp+20h]
>
>
> C:\s\cm3\m3-libs\m3core\src\win32\WinBase.i3(1231):<*EXTERNAL ExitProcess:WINAPI*>
> C:\s\cm3\m3-libs\m3core\src\win32\WinBase.i3(1232):PROCEDURE ExitProcess (uExitCode: UINT32);
>
> Voila.
>
> ExitProcess is declared as taking an unsigned integer but we pass negative.
>
> So again I think we are being somehow overzealous regarding integer ranges.
>
> I mean, I get, that quality is important and this seems correct, based on
> some simple principles, but the result seems very unsatifactory.
>
>
> On the 32bit system this is Word.T and you can pass any INTEGER value, there are
> no checks I guess, and it works.
>
>
> But the extension to a 64bit system adds checks and not all INTEGER values are valid,
> not even ones that fit in 32bits like -1.
>
>
> Would it make sense to declare a type with the "1.5" range -2^31..2^32?
>
> Again, I am tempted to change to plain 64bit INTEGER. But that changes e.g.
> the type of taking the address.
> Pass any value that fits in a register, with the understanding, perhaps not known,
> that the upper 32bits are silently ignored???
>
> I realize is an exit upon an assertion failure, so it doesn't really matter,
> in this case, but Exit(-1) imho should be portable between Win32 and Win64.
>
> I know I could say Exit(16_ffffffff) or have a wrapper that does Word.And(Last(UINT32))
> but I don't think these should be needed. -1 should be portable between 32bit and 64bit.
>
> Please help me to understand and advise what to do?
>
> The nested suspend should probably be relaxed somehow too?
>
> - Jay
>
> As temporary solution, please inplement this patch:
>
> --- m3-libs\m3core\src\runtime\WIN32\RTOS.m3 000 Sun Jan 03 11:17:00 2016
> +++ m3-libs\m3core\src\runtime\WIN32\RTOS.m3 Thu Feb 25 12:31:36 2021
> @@ -23,10 +23,11 @@
> IF WinBase.IsDebuggerPresent () # 0 THEN
> WinBase.DebugBreak ();
> END;
> - RTThread.SuspendOthers ();
> - RTMachInfo.DumpStack (LOOPHOLE (Crash, ADDRESS), fp);
> - RTSignal.RestoreHandlers (); (* so we really do crash... *)
> - Exit (-1);
> + (*** RTThread.SuspendOthers (); ***)
> + (*** RTMachInfo.DumpStack (LOOPHOLE (Crash, ADDRESS), fp); *) ***)
> + (*** RTThread.ResumeOthers (); ***)
> + (*** RTSignal.RestoreHandlers (); (* so we really do crash... *) ***)
> + Exit (4000);
> END Crash;
>
> (*********************
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#47 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABKYNJO5BW2SA7UDIA6MJDTTAYK2HANCNFSM4HAFYTCA>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#47 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABSVZNB3W2XNXS35ST6RN2TTAYPFPANCNFSM4HAFYTCA>.
|
GetStdHandle, SetStdHandle, ioctlsocket that cause fatal runtime conditions.
There are one good news and one bad news: A) Problems with m3-libs\m3core\src\runtime\WIN32\RTOS.m3 are fixed Z) obliqsrv-std.exe run with error: *** runtime error: |
I didn't check it on NT386 ( yet).
obliqsrv-std.exe
There is not only this file affected.
I'll look
Thanks!
26.02.2021, 12:53, "Jay Krell" <notifications@github.com>:
I admit I had not run obliqsrv-std.exe.
I will try it.
The error looks different..and I wonder. Is it broken on NT386 also?
Anyway I'll look.
- Jay
…________________________________
From: VictorMiasnikov <notifications@github.com>
Sent: Friday, February 26, 2021 9:45 AM
To: modula3/cm3 <cm3@noreply.github.com>
Cc: Jay Krell <jay.krell@cornell.edu>; Comment <comment@noreply.github.com>
Subject: Re: [modula3/cm3] Modula-3 for Windows x64 ( m3devel 2019-January ) (#47)
} Win64: Widen some UINT32 parameters to INTEGER. by jaykrell · Pull Request #93<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmodula3%2Fcm3%2Fpull%2F93&data=04%7C01%7C%7C34d5f7b63c4147e2fcd608d8da3b4835%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637499295434881552%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=COMnj7qogurOYYYfo3sEmTKyMc4jPiNytsCQni6lsGo%3D&reserved=0>
There are one good new and one bad new:
1. Problems with
m3-libs\m3core\src\runtime\WIN32\RTOS.m3
are fixed
Z)
obliqsrv-std.exe run with error:
________________________________
*** runtime error:
*** Exception "IPError.FatalError" not in RAISES list
*** file "..\src\common\IPError.m3", line 27
________________________________
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmodula3%2Fcm3%2Fissues%2F47%23issuecomment-786533999&data=04%7C01%7C%7C34d5f7b63c4147e2fcd608d8da3b4835%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637499295434891543%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=oxvZPowP2lsupBj1NyaX9SzSwhTsQTK7a0LTOowMk0A%3D&reserved=0>, or unsubscribe<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAMPLEBADOTZRQADJ3KJPA3TA5UUDANCNFSM4HAFYTCA&data=04%7C01%7C%7C34d5f7b63c4147e2fcd608d8da3b4835%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637499295434891543%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=XYhQ40h6STRZE8KOLF1CK29XxIXRk2ikvjARUF8YlCo%3D&reserved=0>.
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.
|
( see later) |
This patch, as always , take good results:
P.S. Better variant:
|
And see new pull request #398 "RCC_upgradeCM3.cmd and Co fixed. Win 10". P.S. 2021-05-18: integrated to "master", thanks! |
In case compiling by clang-cl.exe from LLVM 9.0.1 and run Calculator.exe :
|
There are some related binary and boot files on |
All have been fixed, except sub-issue:
I will create another issue ( after re-testing) |
I think that this need a discussion . . .
It's possible duplicate of
https://m3lists.elegosoft.com/pipermail/m3devel/2019-January.txt
Subject: [M3devel] It's time to AMD_64. Modula-3 for Windows x64
The text was updated successfully, but these errors were encountered: