Skip to content

Commit 6e15dad

Browse files
committed
CogVM source as per VMMaker.oscog-eem.3676
Two more eliminations of remappable oops given floatObjectOf: no longer fail.
1 parent 658a3a3 commit 6e15dad

2 files changed

Lines changed: 38 additions & 119 deletions

File tree

src/plugins/CroquetPlugin/CroquetPlugin.c

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* Automatically generated by
2-
VMPluginCodeGenerator VMMaker.oscog-eem.3668 uuid: d0a2c840-707b-457e-9ff3-c455828ac41c
3-
(Compiler-eem.523)
2+
VMPluginCodeGenerator VMMaker.oscog-eem.3676 uuid: ff00f25e-75c0-4e00-b807-0d490f1f338a
3+
(* Compiler-eem.523)
44
from
5-
CroquetPlugin VMMaker.oscog-eem.3668 uuid: d0a2c840-707b-457e-9ff3-c455828ac41c
5+
CroquetPlugin VMMaker.oscog-eem.3676 uuid: ff00f25e-75c0-4e00-b807-0d490f1f338a
66
*/
7-
static char __buildInfo[] = "CroquetPlugin VMMaker.oscog-eem.3668 uuid: d0a2c840-707b-457e-9ff3-c455828ac41c " __DATE__ ;
7+
static char __buildInfo[] = "CroquetPlugin VMMaker.oscog-eem.3676 uuid: ff00f25e-75c0-4e00-b807-0d490f1f338a " __DATE__ ;
88

99

1010
#include "config.h"
@@ -70,11 +70,9 @@ static sqInt (*methodReturnBool)(sqInt boolean);
7070
static sqInt (*methodReturnFloat)(double aFloat);
7171
static sqInt (*methodReturnReceiver)(void);
7272
static sqInt (*methodReturnValue)(sqInt oop);
73-
static sqInt (*popRemappableOop)(void);
7473
static sqInt (*positive32BitIntegerFor)(unsigned int integerValue);
7574
static sqInt (*primitiveFail)(void);
7675
static sqInt (*primitiveFailFor)(sqInt reasonCode);
77-
static sqInt (*pushRemappableOop)(sqInt oop);
7876
static sqInt (*slotSizeOf)(sqInt oop);
7977
static sqInt (*stackIntegerValue)(sqInt offset);
8078
static sqInt (*stackObjectValue)(sqInt offset);
@@ -94,11 +92,9 @@ extern sqInt methodReturnBool(sqInt boolean);
9492
extern sqInt methodReturnFloat(double aFloat);
9593
extern sqInt methodReturnReceiver(void);
9694
extern sqInt methodReturnValue(sqInt oop);
97-
extern sqInt popRemappableOop(void);
9895
extern sqInt positive32BitIntegerFor(unsigned int integerValue);
9996
extern sqInt primitiveFail(void);
10097
extern sqInt primitiveFailFor(sqInt reasonCode);
101-
extern sqInt pushRemappableOop(sqInt oop);
10298
extern sqInt slotSizeOf(sqInt oop);
10399
extern sqInt stackIntegerValue(sqInt offset);
104100
extern sqInt stackObjectValue(sqInt offset);
@@ -107,7 +103,7 @@ extern sqInt storePointerofObjectwithValue(sqInt index, sqInt oop, sqInt valuePo
107103
extern
108104
#endif
109105
struct VirtualMachine* interpreterProxy;
110-
static const char *moduleName = "CroquetPlugin VMMaker.oscog-eem.3668 " INT_EXT;
106+
static const char *moduleName = "CroquetPlugin VMMaker.oscog-eem.3676 " INT_EXT;
111107

112108

113109
/*** Methods ***/
@@ -228,9 +224,7 @@ primitiveARC4Transform(void)
228224
sqInt startIndex;
229225
sqInt stopIndex;
230226
sqInt x;
231-
sqInt xOop;
232227
sqInt y;
233-
sqInt yOop;
234228

235229
bufSize = 0;
236230
if (!((methodArgumentCount()) == 6)) {
@@ -269,27 +263,8 @@ primitiveARC4Transform(void)
269263
buffer[i] = ((buffer[i]) ^ mask);
270264
}
271265
ptOop = instantiateClassindexableSize(classPoint(), 0);
272-
# if SPURVM
273-
xOop = positive32BitIntegerFor(x);
274-
yOop = positive32BitIntegerFor(y);
275-
if ((!ptOop)
276-
|| ((!xOop)
277-
|| (!yOop))) {
278-
return primitiveFailFor(PrimErrNoMemory);
279-
}
280-
storePointerofObjectwithValue(0, ptOop, xOop);
281-
storePointerofObjectwithValue(1, ptOop, yOop);
282-
# else // SPURVM
283-
pushRemappableOop(ptOop);
284-
xOop = positive32BitIntegerFor(x);
285-
pushRemappableOop(xOop);
286-
yOop = positive32BitIntegerFor(y);
287-
xOop = popRemappableOop();
288-
ptOop = popRemappableOop();
289-
storePointerofObjectwithValue(0, ptOop, xOop);
290-
storePointerofObjectwithValue(1, ptOop, yOop);
291-
# endif // SPURVM
292-
266+
storePointerofObjectwithValue(0, ptOop, positive32BitIntegerFor(x));
267+
storePointerofObjectwithValue(1, ptOop, positive32BitIntegerFor(y));
293268
return methodReturnValue(ptOop);
294269
}
295270

@@ -985,11 +960,9 @@ setInterpreter(struct VirtualMachine *anInterpreter)
985960
methodReturnFloat = interpreterProxy->methodReturnFloat;
986961
methodReturnReceiver = interpreterProxy->methodReturnReceiver;
987962
methodReturnValue = interpreterProxy->methodReturnValue;
988-
popRemappableOop = interpreterProxy->popRemappableOop;
989963
positive32BitIntegerFor = interpreterProxy->positive32BitIntegerFor;
990964
primitiveFail = interpreterProxy->primitiveFail;
991965
primitiveFailFor = interpreterProxy->primitiveFailFor;
992-
pushRemappableOop = interpreterProxy->pushRemappableOop;
993966
slotSizeOf = interpreterProxy->slotSizeOf;
994967
stackIntegerValue = interpreterProxy->stackIntegerValue;
995968
stackObjectValue = interpreterProxy->stackObjectValue;

src/plugins/Klatt/Klatt.c

Lines changed: 31 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* Automatically generated by
2-
VMPluginCodeGenerator VMMaker.oscog-eem.3668 uuid: d0a2c840-707b-457e-9ff3-c455828ac41c
3-
(Compiler-eem.523)
2+
VMPluginCodeGenerator VMMaker.oscog-eem.3676 uuid: ff00f25e-75c0-4e00-b807-0d490f1f338a
3+
(* Compiler-eem.523)
44
from
5-
KlattSynthesizerPlugin VMMaker.oscog-eem.3668 uuid: d0a2c840-707b-457e-9ff3-c455828ac41c
5+
KlattSynthesizerPlugin VMMaker.oscog-eem.3676 uuid: ff00f25e-75c0-4e00-b807-0d490f1f338a
66
*/
7-
static char __buildInfo[] = "KlattSynthesizerPlugin VMMaker.oscog-eem.3668 uuid: d0a2c840-707b-457e-9ff3-c455828ac41c " __DATE__ ;
7+
static char __buildInfo[] = "KlattSynthesizerPlugin VMMaker.oscog-eem.3676 uuid: ff00f25e-75c0-4e00-b807-0d490f1f338a " __DATE__ ;
88

99

1010
#include "config.h"
@@ -129,7 +129,6 @@ static float resonatorP1(sqInt index);
129129
static float resonatorP2(sqInt index);
130130
static void resonatorfrequencybandwidth(sqInt index, float freq, float bw);
131131
static float resonatorvalue(sqInt index, float aFloat);
132-
static sqInt saveTo(sqInt origKlattOop);
133132
EXPORT(sqInt) setInterpreter(struct VirtualMachine *anInterpreter);
134133

135134

@@ -145,9 +144,8 @@ static sqInt (*fetchPointerofObject)(sqInt index, sqInt oop);
145144
static void * (*firstIndexableField)(sqInt oop);
146145
static sqInt (*floatObjectOf)(double aFloat);
147146
static sqInt (*isWords)(sqInt oop);
148-
static sqInt (*pop)(sqInt nItems);
149-
static sqInt (*popRemappableOop)(void);
150-
static sqInt (*pushRemappableOop)(sqInt oop);
147+
static sqInt (*methodReturnReceiver)(void);
148+
static sqInt (*primitiveFail)(void);
151149
static sqInt (*slotSizeOf)(sqInt oop);
152150
static sqInt (*stSizeOf)(sqInt oop);
153151
static sqInt (*stackIntegerValue)(sqInt offset);
@@ -164,9 +162,8 @@ extern sqInt fetchPointerofObject(sqInt index, sqInt oop);
164162
extern void * firstIndexableField(sqInt oop);
165163
extern sqInt floatObjectOf(double aFloat);
166164
extern sqInt isWords(sqInt oop);
167-
extern sqInt pop(sqInt nItems);
168-
extern sqInt popRemappableOop(void);
169-
extern sqInt pushRemappableOop(sqInt oop);
165+
extern sqInt methodReturnReceiver(void);
166+
extern sqInt primitiveFail(void);
170167
extern sqInt slotSizeOf(sqInt oop);
171168
extern sqInt stSizeOf(sqInt oop);
172169
extern sqInt stackIntegerValue(sqInt offset);
@@ -178,7 +175,7 @@ extern sqInt success(sqInt aBoolean);
178175
extern
179176
#endif
180177
struct VirtualMachine* interpreterProxy;
181-
static const char *moduleName = "Klatt VMMaker.oscog-eem.3668 " INT_EXT;
178+
static const char *moduleName = "Klatt VMMaker.oscog-eem.3676 " INT_EXT;
182179
static sqInt nmod;
183180
static sqInt nopen;
184181
static sqInt nper;
@@ -437,16 +434,12 @@ primitiveSynthesizeFrameIntoStartingAt(void)
437434
/* end checkedShortPtrOf: */
438435
l2:
439436
startIndex = stackIntegerValue(0);
440-
if (failed()) {
441-
return null;
442-
}
443437
rcvr = stackObjectValue(3);
444438
if (!(loadFrom(rcvr))) {
445439
return null;
446440
}
447-
success(((stSizeOf(bufferOop)) * 2) >= samplesPerFrame);
448-
if (failed()) {
449-
return null;
441+
if (!(((stSizeOf(bufferOop)) * 2) >= samplesPerFrame)) {
442+
return primitiveFail();
450443
}
451444

452445
/* begin synthesizeFrame:into:startingAt: */
@@ -1013,10 +1006,24 @@ primitiveSynthesizeFrameIntoStartingAt(void)
10131006
index += 1;
10141007
samplesCount += 1;
10151008
}
1016-
if (!(saveTo(rcvr))) {
1017-
return null;
1018-
}
1019-
pop(3);
1009+
storePointerofObjectwithValue(2, rcvr, floatObjectOf(pitch));
1010+
storeIntegerofObjectwithValue(3, rcvr, t0);
1011+
storeIntegerofObjectwithValue(4, rcvr, nper);
1012+
storeIntegerofObjectwithValue(5, rcvr, nopen);
1013+
storeIntegerofObjectwithValue(6, rcvr, nmod);
1014+
storePointerofObjectwithValue(7, rcvr, floatObjectOf(a1));
1015+
storePointerofObjectwithValue(8, rcvr, floatObjectOf(a2));
1016+
storePointerofObjectwithValue(9, rcvr, floatObjectOf(x1));
1017+
storePointerofObjectwithValue(10, rcvr, floatObjectOf(x2));
1018+
storePointerofObjectwithValue(11, rcvr, floatObjectOf(b1));
1019+
storePointerofObjectwithValue(12, rcvr, floatObjectOf(c1));
1020+
storePointerofObjectwithValue(13, rcvr, floatObjectOf(glast));
1021+
storePointerofObjectwithValue(14, rcvr, floatObjectOf(vlast));
1022+
storePointerofObjectwithValue(15, rcvr, floatObjectOf(nlast));
1023+
storeIntegerofObjectwithValue(16, rcvr, periodCount);
1024+
storeIntegerofObjectwithValue(17, rcvr, samplesCount);
1025+
storeIntegerofObjectwithValue(18, rcvr, seed);
1026+
methodReturnReceiver();
10201027
return 0;
10211028
}
10221029

@@ -1100,66 +1107,6 @@ resonatorvalue(sqInt index, float aFloat)
11001107
return answer;
11011108
}
11021109

1103-
/* KlattSynthesizerPlugin>>#saveTo: */
1104-
static sqInt
1105-
saveTo(sqInt origKlattOop)
1106-
{
1107-
sqInt a1Oop;
1108-
sqInt a2Oop;
1109-
sqInt b1Oop;
1110-
sqInt c1Oop;
1111-
sqInt glastOop;
1112-
sqInt klattOop;
1113-
sqInt nlastOop;
1114-
sqInt pitchOop;
1115-
sqInt vlastOop;
1116-
sqInt x1Oop;
1117-
sqInt x2Oop;
1118-
1119-
pushRemappableOop(origKlattOop);
1120-
pushRemappableOop(floatObjectOf(pitch));
1121-
pushRemappableOop(floatObjectOf(a1));
1122-
pushRemappableOop(floatObjectOf(a2));
1123-
pushRemappableOop(floatObjectOf(x1));
1124-
pushRemappableOop(floatObjectOf(x2));
1125-
pushRemappableOop(floatObjectOf(b1));
1126-
pushRemappableOop(floatObjectOf(c1));
1127-
pushRemappableOop(floatObjectOf(glast));
1128-
pushRemappableOop(floatObjectOf(vlast));
1129-
nlastOop = floatObjectOf(nlast);
1130-
vlastOop = popRemappableOop();
1131-
glastOop = popRemappableOop();
1132-
c1Oop = popRemappableOop();
1133-
b1Oop = popRemappableOop();
1134-
x2Oop = popRemappableOop();
1135-
x1Oop = popRemappableOop();
1136-
a2Oop = popRemappableOop();
1137-
a1Oop = popRemappableOop();
1138-
pitchOop = popRemappableOop();
1139-
klattOop = popRemappableOop();
1140-
if (failed()) {
1141-
return 0;
1142-
}
1143-
storePointerofObjectwithValue(2, klattOop, pitchOop);
1144-
storeIntegerofObjectwithValue(3, klattOop, t0);
1145-
storeIntegerofObjectwithValue(4, klattOop, nper);
1146-
storeIntegerofObjectwithValue(5, klattOop, nopen);
1147-
storeIntegerofObjectwithValue(6, klattOop, nmod);
1148-
storePointerofObjectwithValue(7, klattOop, a1Oop);
1149-
storePointerofObjectwithValue(8, klattOop, a2Oop);
1150-
storePointerofObjectwithValue(9, klattOop, x1Oop);
1151-
storePointerofObjectwithValue(10, klattOop, x2Oop);
1152-
storePointerofObjectwithValue(11, klattOop, b1Oop);
1153-
storePointerofObjectwithValue(12, klattOop, c1Oop);
1154-
storePointerofObjectwithValue(13, klattOop, glastOop);
1155-
storePointerofObjectwithValue(14, klattOop, vlastOop);
1156-
storePointerofObjectwithValue(15, klattOop, nlastOop);
1157-
storeIntegerofObjectwithValue(16, klattOop, periodCount);
1158-
storeIntegerofObjectwithValue(17, klattOop, samplesCount);
1159-
storeIntegerofObjectwithValue(18, klattOop, seed);
1160-
return (failed()) == 0;
1161-
}
1162-
11631110

11641111
/* Note: This is coded so that it can be run in Squeak. */
11651112

@@ -1185,9 +1132,8 @@ setInterpreter(struct VirtualMachine *anInterpreter)
11851132
firstIndexableField = interpreterProxy->firstIndexableField;
11861133
floatObjectOf = interpreterProxy->floatObjectOf;
11871134
isWords = interpreterProxy->isWords;
1188-
pop = interpreterProxy->pop;
1189-
popRemappableOop = interpreterProxy->popRemappableOop;
1190-
pushRemappableOop = interpreterProxy->pushRemappableOop;
1135+
methodReturnReceiver = interpreterProxy->methodReturnReceiver;
1136+
primitiveFail = interpreterProxy->primitiveFail;
11911137
slotSizeOf = interpreterProxy->slotSizeOf;
11921138
stSizeOf = interpreterProxy->stSizeOf;
11931139
stackIntegerValue = interpreterProxy->stackIntegerValue;

0 commit comments

Comments
 (0)