As the compiler tells:
```
OpenSmalltalk/opensmalltalk-vm/src/plugins/Squeak3D/Squeak3D.c:2475:7: warning: variable 'scale' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (!((l2vDistance == 0.0)
^~~~~~~~~~~~~~~~~~~~~~
/media/psf/Home/Smalltalk/OpenSmalltalk/opensmalltalk-vm/src/plugins/Squeak3D/Squeak3D.c:2480:42: note: uninitialized use occurs here
l2vDirection[0] = ((l2vDirection[0]) * scale);
^~~~~
```
That's effectively a bug in Smalltalk source, scale might be used uninitialized:
```
computeDirection
"Compute the direction for the current light and vertex"
| scale |
<inline: true>
<var: #scale type: #double>
(lightFlags anyMask: FlagPositional) ifTrue:[
"Must compute the direction for this vertex"
l2vDirection at: 0 put: (litVertex at: PrimVtxPositionX) - (primLight at: PrimLightPositionX).
l2vDirection at: 1 put: (litVertex at: PrimVtxPositionY) - (primLight at: PrimLightPositionY).
l2vDirection at: 2 put: (litVertex at: PrimVtxPositionZ) - (primLight at: PrimLightPositionZ).
"l2vDistance := self dotProductOf: l2vDirection with: l2vDirection."
l2vDistance := ((l2vDirection at: 0) * (l2vDirection at: 0)) +
((l2vDirection at: 1) * (l2vDirection at: 1)) +
((l2vDirection at: 2) * (l2vDirection at: 2)).
(l2vDistance = 0.0 or:[l2vDistance = 1.0])
ifFalse:[ l2vDistance := l2vDistance sqrt.
scale := -1.0/l2vDistance].
l2vDirection at: 0 put: (l2vDirection at: 0) * scale.
l2vDirection at: 1 put: (l2vDirection at: 1) * scale.
l2vDirection at: 2 put: (l2vDirection at: 2) * scale.
] ifFalse:[
(lightFlags anyMask: FlagDirectional) ifTrue:[
l2vDirection at: 0 put: (primLight at: PrimLightDirectionX).
l2vDirection at: 1 put: (primLight at: PrimLightDirectionY).
l2vDirection at: 2 put: (primLight at: PrimLightDirectionZ).
].
]
```
IMO:
- the scaling is not needed when distance is 0 or 1
- the scaling should be inside the block when distance is neither 0 nor 1
- the scaling should be positive
If I decipher correctly `l2vDirection` means light to vertex direction, that is:
LV vector = OV vector - OL vector
whatever origin O, and that is what we already do in code (PrimVtxPositionX - PrimLightPositionX). So I don't understand the -1.0 here...
If there is a -1.0, then we must also initialize scale to -1.0 when distance is 1.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/434
So I built a new VM with a fix for the input method change. I did not
fully test the other things but Scratch on the VM does not do animations.
It updates screen only when mouse is moved, or some slower interval:
https://photos.app.goo.gl/QHgKCeeP2bnQGESu5
I suspect that there might have been some options I needed to pass in to
specify some timers? Can you think of other reasons why this might happen
and where to look to fix it?
--
-- Yoshiki
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
I've noticed that in the FloatMathPlugin there is fdlibm
(freely distributable libm) :
platforms/Cross/plugins/FloatMathPlugin
This refers to the platforms/Cross/third-party/fdlibm
I wonder whether the VM shouldn't be using the system provided libm (-lm).
Perhaps for Croquet or other software that depends on FLoatMathPlugin,
see https://en.m.wikipedia.org/wiki/Croquet_Project
a special test framework could be ran in Squeak,
or perhaps as part of "./configure" configuration, to check the results,
of the underlying (system) libm, so that it provides results similar to fdlibm ?
Maybe fdlibm and libm "run bit identically" on some platforms.
This is because for Croquet the goal is to have the VM run bit identically.
Using the system provided -lm would possibly result in a smaller executable,
with less duplicated code (no overhead).
I'm no expert on libm, but perhaps the system provided libm is also faster.
Regards,
David Stes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQEcBAEBCAAGBQJfEfHMAAoJEAwpOKXMq1Ma1psH/2yaIMdU6YMV8ZUSRlolvsH8
jlcuxPZV/Oo0FOq+jF2moBV01WquA8vCxZKm40s7ofrac7dWuNaaWwpDg/2xiVGc
p0crmTlv9FtHqTzjT3lrBMDxvOwq9oXAJUX+LaeGhNkYMbLE969m8hoRNSlDPPuk
NsXowTP7PpjyZ5RB5FApRHEnBzzyHjUIksUUhedCDWQRMqebEwxmHWbq6UobcED7
zVDx04crvw2hhzhKN8+AomZXNccMTDEQ6fTVBDeP7t4/iRmxo/6MmxOKMbQJ5dIi
fgYpODPPvXiAYipVx/lRXhgo5xEjQXgPjwBXKYQy8O2vJdH/0q/7r8u8k1MutbI=
=lWqV
-----END PGP SIGNATURE-----
No crash dump. It just closes. Not sure why exactly. Last time, it happened after loading Metacello and Squot in Squeak 5.3. Before it happened in Trunk after playing around with FFI and OpenGL. The VM silently closes on "save" or "save and quot".
VM: 202011120327 (win64x64.squeak.cog.spur)
OS: Windows 10 (2004 Build 19041.630)
Squeak: latest 5.3 or 6.0alpha
Here is the report that Windows generated:
```
Quelle
Squeak Cog Spur Virtual Machine
Zusammenfassung
Nicht mehr funktionsfähig
Datum
14.11.2020 11:25
Status
Der Bericht wurde gesendet.
Beschreibung
Pfad der fehlerhaften Anwendung: C:\Tools\squeak_53_ecoop\Squeak.exe
Problemsignatur
Problemereignisame: APPCRASH
Anwendungsname: Squeak.exe
Anwendungsversion: 2020.11.12.327
Anwendungszeitstempel: 00000000
Fehlermodulname: Squeak.exe
Fehlermodulversion: 2020.11.12.327
Fehlermodulzeitstempel: 00000000
Ausnahmecode: c0000005
Ausnahmeoffset: 0000000000033cd5
Betriebsystemversion: 10.0.19041.2.0.0.768.101
Gebietsschema-ID: 1031
Zusatzinformation 1: e064
Zusatzinformation 2: e0644d1b3ac5fae3d6c60b42d946256e
Zusatzinformation 3: 4588
Zusatzinformation 4: 45886eecb7a8f73a86ab34ad6194fd79
Weitere Informationen über das Problem
Bucket-ID: 5801b02358401c93cbecf9af1e413cb3 (2012257664049953971)
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/535
Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: a783502b249c4a4fedc88b6e07837d405feab144
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/a783502b249c4a4fed…
Author: Eliot Miranda <eliot.miranda(a)gmail.com>
Date: 2020-11-30 (Mon, 30 Nov 2020)
Changed paths:
M spur64src/vm/cointerpmt.c
M spur64src/vm/cointerpmt.h
M spur64src/vm/gcc3x-cointerpmt.c
M spursrc/vm/cointerpmt.c
M spursrc/vm/cointerpmt.h
M spursrc/vm/gcc3x-cointerpmt.c
Log Message:
-----------
VMMaker.oscog-eem.2904
MTVM: fix preemptDisowningThread; marryFrame:SP: expects top-of-stack to be the
Smalltalk top-of-stack, not a pushed instructionPointer.
[ci skip]
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2904.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.2904
Author: eem
Time: 30 November 2020, 12:09:05.818551 pm
UUID: 8569e47f-67b4-4e80-9af6-303a01f7c2c3
Ancestors: VMMaker.oscog-eem.2903
MTVM: fix preemptDisowningThread; marryFrame:SP: expects top-of-stack to be the Smalltalk top-of-stack, not a pushed instructionPointer.
=============== Diff against VMMaker.oscog-eem.2903 ===============
Item was changed:
----- Method: CoInterpreterMT>>preemptDisowningThread (in category 'vm scheduling') -----
preemptDisowningThread
"Set the relevant state for disowningVMThread so that it can resume after
being preempted and set disowningVMThread to nil to indicate preemption.
N.B. This should only be sent from checkPreemptionOfDisowningThread.
There are essentially four things to do.
a) save the VM's notion of the current C stack pointers; these are pointers
into a thread's stack and must be saved and restored in thread switch.
b) save the VM's notion of the current Smalltalk execution point. This is
simply the suspend half of a process switch that saves the current context
in the current process.
c) add the process to the thread's set of AWOL processes so that the scheduler
won't try to run the process while the thread has disowned the VM.
d) save the in-primitive VM state, newMethod and argumentCount
ownVM: will restore the VM context as of disownVM: from the above when it
finds it has been preempted."
| activeProc activeContext preemptedThread |
<var: #preemptedThread type: #'CogVMThread *'>
<inline: false>
self assert: disowningVMThread notNil.
self assert: (disowningVMThread state = CTMUnavailable
or: [disowningVMThread state = CTMWantingOwnership]).
self assertCStackPointersBelongToDisowningThread.
cogit recordEventTrace ifTrue:
[self recordTrace: TracePreemptDisowningThread
thing: (objectMemory integerObjectOf: disowningVMThread index)
source: 0].
disowningVMThread cStackPointer: CStackPointer.
disowningVMThread cFramePointer: CFramePointer.
activeProc := self activeProcess.
self assert: (objectMemory fetchPointer: MyListIndex ofObject: activeProc) = objectMemory nilObject.
objectMemory
storePointer: MyListIndex
ofObject: activeProc
withValue: (objectMemory splObj: ProcessInExternalCodeTag).
+ activeContext := self ensureFrameIsMarried: framePointer SP: stackPointer.
+ objectMemory
+ storePointer: SuspendedContextIndex
+ ofObject: activeProc
+ withValue: activeContext.
"The instructionPointer must be pushed because the convention for inactive stack pages is that the
instructionPointer is top of stack. We need to know if this primitive is called from machine code
because the invariant that the return pc of an interpreter callee calling a machine code caller is
ceReturnToInterpreterPC must be maintained."
self push: instructionPointer.
self externalWriteBackHeadFramePointers.
- activeContext := self ensureFrameIsMarried: framePointer SP: stackPointer.
- objectMemory
- storePointer: SuspendedContextIndex
- ofObject: activeProc
- withValue: activeContext.
"Since pushing the awol process may realloc disowningVMThread we need to reassign.
But since we're going to nil disowningVMThread anyway we can assign to a local."
preemptedThread := cogThreadManager pushAWOLProcess: activeProc on: disowningVMThread.
disowningVMThread := nil.
preemptedThread priority: (self quickFetchInteger: PriorityIndex ofObject: activeProc).
(self ownerIndexOfProcess: activeProc) = 0
ifTrue: [self setOwnerIndexOfProcess: activeProc to: preemptedThread index bind: false]
ifFalse: [self assert: (self ownerIndexOfProcess: activeProc) = preemptedThread index].
preemptedThread
newMethodOrNull: newMethod;
argumentCount: argumentCount;
primitiveFunctionPointer: primitiveFunctionPointer;
inMachineCode: instructionPointer asUnsignedInteger <= objectMemory startOfMemory!
Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: f7aee44b3b3e38e432161cbeec1ea45ef105778b
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/f7aee44b3b3e38e432…
Author: Eliot Miranda <eliot.miranda(a)gmail.com>
Date: 2020-11-30 (Mon, 30 Nov 2020)
Changed paths:
M spur64src/vm/cointerpmt.c
M spur64src/vm/cointerpmt.h
M spur64src/vm/gcc3x-cointerpmt.c
M spursrc/vm/cointerpmt.c
M spursrc/vm/cointerpmt.h
M spursrc/vm/gcc3x-cointerpmt.c
Log Message:
-----------
VMMaker.oscog-eem.2903
fix CogVMThread typedef.
[ci skip]