-
Notifications
You must be signed in to change notification settings - Fork 71
/
Matrix2x3PluginSimulator.class.st
32 lines (30 loc) · 1.19 KB
/
Matrix2x3PluginSimulator.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Class {
#name : #Matrix2x3PluginSimulator,
#superclass : #Matrix2x3Plugin,
#category : #'VMMaker-Plugins'
}
{ #category : #primitives }
Matrix2x3PluginSimulator >> primitiveComposeMatrix [
| m1 m2 m3 |
m2 := self stackMatrixValue: 1.
m1 := self stackMatrixValue: 2.
super primitiveComposeMatrix.
interpreterProxy failed ifFalse:
[m3 := self stackMatrixValue: 0.
self assert: m3 = (m1 composedWithLocal: m2)]
]
{ #category : #'simulation support' }
Matrix2x3PluginSimulator >> stackMatrixValue: n [
| maybeMatrixOop |
maybeMatrixOop := interpreterProxy stackValue: n.
^((interpreterProxy isWords: maybeMatrixOop)
and: [(interpreterProxy slotSizeOf: maybeMatrixOop) = 6]) ifTrue:
[MatrixTransform2x3 new
basicAt: 1 put: (interpreterProxy fetchLong32: 0 ofObject: maybeMatrixOop);
basicAt: 2 put: (interpreterProxy fetchLong32: 1 ofObject: maybeMatrixOop);
basicAt: 3 put: (interpreterProxy fetchLong32: 2 ofObject: maybeMatrixOop);
basicAt: 4 put: (interpreterProxy fetchLong32: 3 ofObject: maybeMatrixOop);
basicAt: 5 put: (interpreterProxy fetchLong32: 4 ofObject: maybeMatrixOop);
basicAt: 6 put: (interpreterProxy fetchLong32: 5 ofObject: maybeMatrixOop);
yourself]
]