Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: 84e37117b6c4ecbc085d905c5b247c34378ff4f7
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/84e37117b6c4ecbc08…
Author: Eliot Miranda <eliot.miranda(a)gmail.com>
Date: 2018-10-22 (Mon, 22 Oct 2018)
Changed paths:
M src/plugins/B2DPlugin/B2DPlugin.c
M src/plugins/DESPlugin/DESPlugin.c
M src/plugins/FloatArrayPlugin/FloatArrayPlugin.c
M src/plugins/LargeIntegers/LargeIntegers.c
M src/plugins/Matrix2x3Plugin/Matrix2x3Plugin.c
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.2469
Plugins:
Clean up BalloonEngine>>primitiveInitializeBuffer.
Fix a bug in FloatArrayPlugin>>primitiveDivFloatArray; the old code didn't check
for -0.0. Eliminate several unnecessary stackObjectValue:'s in Matrix2x3Plugin;
isWords: checks for immediates anyway. Fix several comments in FloatArrayPlugin.
**NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/
Functionality will be removed from GitHub.com on January 31st, 2019.
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2468.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.2468
Author: eem
Time: 22 October 2018, 12:37:58.940543 pm
UUID: cd788ac3-2314-48ce-a656-f4cd6c2935ae
Ancestors: VMMaker.oscog-eem.2467
Plugins:
BalloonEngine & simulation. Clean up primitiveInitializeBuffer. Make some initial fixes to BalloonArray (the simulation of the engine's work buffer). I have other fish to fry right now but this is a stab in the right direction.
=============== Diff against VMMaker.oscog-eem.2467 ===============
Item was changed:
CArray subclass: #BalloonArray
+ instanceVariableNames: 'simArray simOffset'
- instanceVariableNames: 'simArray'
classVariableNames: ''
poolDictionaries: ''
category: 'VMMaker-InterpreterSimulation'!
!BalloonArray commentStamp: '<historical>' prior: 0!
BalloonArray keeps a shadow copy of its raw memory data in a Smalltalk array. This allows support for C's inhomogeneous access, returning floats where Floats were stored, and negative ints where they were stored. This ruse only works, of course where we have control over all the access.!
Item was added:
+ ----- Method: BalloonArray>>+= (in category 'pointer arithmetic') -----
+ += increment
+
+ super += increment.
+ simOffset := simOffset + (increment / unitSize)!
Item was added:
+ ----- Method: BalloonArray>>-= (in category 'pointer arithmetic') -----
+ -= increment
+
+ super -= increment.
+ simOffset := simOffset - (increment / unitSize)!
Item was changed:
----- Method: BalloonArray>>at: (in category 'memory access') -----
at: index
| value |
+ value := simArray at: index + simOffset.
- value := simArray at: index+1.
"Debug only..."
value ifNil:
[self error: 'attempt to read an uninitialized field'.
^ super at: index "Maybe it was set in Squeak. Return the raw value"].
(self bitsOf: value) ~= (super at: index) ifTrue:
[self error: 'inconsistent values: ', (self bitsOf: value) printString, ' vs ', (super at: index) printString].
^value!
Item was changed:
----- Method: BalloonArray>>at:put: (in category 'memory access') -----
at: index put: value
super at: index put: (self bitsOf: value).
+ ^ simArray at: index + simOffset put: value.
- ^ simArray at: index + 1 put: value.
!
Item was changed:
----- Method: BalloonArray>>setSimArray: (in category 'memory access') -----
setSimArray: anArray
+ simArray := anArray.
+ "Now sync the contents of the simArray with the actual work buffer.
+ The issue here is that whether an element is an in teger or a float depends
+ on how the BalloonArrayPlugin accesses the workBuffer; hence we look at
+ the existing values in simArray to find that interpretation."
+ simOffset ifNil:
+ [simOffset := 1].
+ 0 to: anArray size - 1 do:
+ [:i|
+ anArray
+ at: i + simOffset
+ put: ((anArray at: i + simOffset) isFloat
+ ifTrue: [(Float fromIEEE32Bit: (super at: i))]
+ ifFalse: [super at: i])]!
-
- simArray := anArray!
Item was changed:
----- Method: BalloonEngineBase>>primitiveInitializeBuffer (in category 'primitives-other') -----
primitiveInitializeBuffer
- | wbOop size |
<export: true>
+ | wbOop size |
+ (interpreterProxy methodArgumentCount = 1
+ and: [(interpreterProxy isWords: (wbOop := interpreterProxy stackValue: 0))
+ and: [(size := interpreterProxy slotSizeOf: wbOop) < GWMinimalSize]]) ifTrue:
+ [^interpreterProxy primitiveFail].
- <inline: false>
- interpreterProxy methodArgumentCount = 1
- ifFalse:[^interpreterProxy primitiveFail].
- wbOop := interpreterProxy stackObjectValue: 0.
- interpreterProxy failed ifTrue:[^nil].
- (interpreterProxy isWords: wbOop)
- ifFalse:[^interpreterProxy primitiveFail].
- (size := interpreterProxy slotSizeOf: wbOop) < GWMinimalSize
- ifTrue:[^interpreterProxy primitiveFail].
self workBufferPut: wbOop.
objBuffer := workBuffer + GWHeaderSize.
self magicNumberPut: GWMagicNumber.
self wbSizePut: size.
self wbTopPut: size.
self statePut: GEStateUnlocked.
self objStartPut: GWHeaderSize.
self objUsedPut: 4. "Dummy fill object"
self objectTypeOf: 0 put: GEPrimitiveFill.
self objectLengthOf: 0 put: 4.
self objectIndexOf: 0 put: 0.
self getStartPut: 0.
self getUsedPut: 0.
self aetStartPut: 0.
self aetUsedPut: 0.
self stopReasonPut: 0.
self needsFlushPut: 0.
self clipMinXPut: 0.
self clipMaxXPut: 0.
self clipMinYPut: 0.
self clipMaxYPut: 0.
self currentZPut: 0.
self resetGraphicsEngineStats.
self initEdgeTransform.
self initColorTransform.
+ interpreterProxy pop: 2 thenPush: wbOop!
- interpreterProxy pop: 2.
- interpreterProxy push: wbOop.!
Hi,
I came into a weird behavior that I think is an error.
In pharo/squeak/cuis if you evaluate this:
(String>>#romanNumber) numTemps
It returns 1, but that method has 3 temps. The same happens with other
methods like "(SmallInteger>>#printOn:base:length:padded:) numTemps", that
return 9 but the method has 8 temps.
With an interpreter simulator I ran an image, look for
String>>#romanNumber and send the #tempCountOf: to the simulator with the
romanNumber method as parameter and I got 1, as in the image, instead of 3.
So at least #tempCountOf: behavior is consistent with the #numTemps of the
image.
My question is: is that the right behavior? or is it an error?
It looks like an error to me but I may not know something about how
#numTemps work.
Thanks
Hernan.
--
*Hernán WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina