[Vm-dev] [commit][2656] Update sources as per VMMaker-dtl.294
commits at squeakvm.org
commits at squeakvm.org
Fri Jan 4 04:55:59 UTC 2013
Revision: 2656
Author: lewis
Date: 2013-01-03 20:55:58 -0800 (Thu, 03 Jan 2013)
Log Message:
-----------
Update sources as per VMMaker-dtl.294
Add missing comment generation for TStmtListNode to provide additional embedded comments in generated C source.
Modified Paths:
--------------
trunk/src/ckformat.c
trunk/src/plugins/AioPlugin/AioPlugin.c
trunk/src/plugins/B3DAcceleratorPlugin/B3DAcceleratorPlugin.c
trunk/src/plugins/CameraPlugin/CameraPlugin.c
trunk/src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c
trunk/src/plugins/DBusPlugin/DBusPlugin.c
trunk/src/plugins/FileCopyPlugin/FileCopyPlugin.c
trunk/src/plugins/HostWindowPlugin/HostWindowPlugin.c
trunk/src/plugins/MIDIPlugin/MIDIPlugin.c
trunk/src/plugins/Mpeg3Plugin/Mpeg3Plugin.c
trunk/src/plugins/RomePlugin/RomePlugin.c
trunk/src/plugins/ScratchPlugin/ScratchPlugin.c
trunk/src/plugins/Squeak3D/Squeak3D.c
trunk/src/plugins/SqueakFFIPrims/SqueakFFIPrims.c
trunk/src/plugins/UUIDPlugin/UUIDPlugin.c
trunk/src/plugins/UnicodePlugin/UnicodePlugin.c
trunk/src/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c
trunk/src/plugins/WeDoPlugin/WeDoPlugin.c
trunk/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c
trunk/src/vm/interp.c
trunk/src/vm/interp.h
trunk/src/vm/sqNamedPrims.h
Modified: trunk/src/ckformat.c
===================================================================
--- trunk/src/ckformat.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/ckformat.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -5,7 +5,7 @@
/* Usage: ckformat imageFileName */
/* --- DO NOT EDIT THIS FILE --- */
-/* --- Automatically generated from class ImageFormat 2012-12-29T19:53:02.822-05:00--- */
+/* --- Automatically generated from class ImageFormat 2013-01-03T23:27:08.232-05:00--- */
/* --- Source code is in package ImageFormat in the VMMaker repository --- */
/* --- DO NOT EDIT THIS FILE --- */
Modified: trunk/src/plugins/AioPlugin/AioPlugin.c
===================================================================
--- trunk/src/plugins/AioPlugin/AioPlugin.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/AioPlugin/AioPlugin.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:53:01 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:07 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -81,9 +81,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "AioPlugin 29 December 2012 (i)"
+ "AioPlugin 3 January 2013 (i)"
#else
- "AioPlugin 29 December 2012 (e)"
+ "AioPlugin 3 January 2013 (e)"
#endif
;
Modified: trunk/src/plugins/B3DAcceleratorPlugin/B3DAcceleratorPlugin.c
===================================================================
--- trunk/src/plugins/B3DAcceleratorPlugin/B3DAcceleratorPlugin.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/B3DAcceleratorPlugin/B3DAcceleratorPlugin.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:52:50 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:04 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -90,9 +90,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "B3DAcceleratorPlugin 29 December 2012 (i)"
+ "B3DAcceleratorPlugin 3 January 2013 (i)"
#else
- "B3DAcceleratorPlugin 29 December 2012 (e)"
+ "B3DAcceleratorPlugin 3 January 2013 (e)"
#endif
;
Modified: trunk/src/plugins/CameraPlugin/CameraPlugin.c
===================================================================
--- trunk/src/plugins/CameraPlugin/CameraPlugin.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/CameraPlugin/CameraPlugin.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:52:52 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:05 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -57,9 +57,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "CameraPlugin 29 December 2012 (i)"
+ "CameraPlugin 3 January 2013 (i)"
#else
- "CameraPlugin 29 December 2012 (e)"
+ "CameraPlugin 3 January 2013 (e)"
#endif
;
Modified: trunk/src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c
===================================================================
--- trunk/src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/ClipboardExtendedPlugin/ClipboardExtendedPlugin.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:52:52 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:05 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -54,9 +54,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "ClipboardExtendedPlugin 29 December 2012 (i)"
+ "ClipboardExtendedPlugin 3 January 2013 (i)"
#else
- "ClipboardExtendedPlugin 29 December 2012 (e)"
+ "ClipboardExtendedPlugin 3 January 2013 (e)"
#endif
;
Modified: trunk/src/plugins/DBusPlugin/DBusPlugin.c
===================================================================
--- trunk/src/plugins/DBusPlugin/DBusPlugin.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/DBusPlugin/DBusPlugin.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:52:53 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:05 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -136,9 +136,9 @@
static DBusMessageIter messageIter[DBUS_MAXIMUM_TYPE_RECURSION_DEPTH];
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "DBusPlugin 29 December 2012 (i)"
+ "DBusPlugin 3 January 2013 (i)"
#else
- "DBusPlugin 29 December 2012 (e)"
+ "DBusPlugin 3 January 2013 (e)"
#endif
;
static DBusMessage* writeMessage;
@@ -440,6 +440,9 @@
connections[h] = conn;
data = newDataStructWithConnectionandSemaphore(conn, semaIndex);
if (data != null) {
+
+ /* register watch functions with data */
+
if (!(dbus_connection_set_watch_functions(
conn,
sqDBusPluginAddWatchwithData,
Modified: trunk/src/plugins/FileCopyPlugin/FileCopyPlugin.c
===================================================================
--- trunk/src/plugins/FileCopyPlugin/FileCopyPlugin.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/FileCopyPlugin/FileCopyPlugin.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:52:54 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:05 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -50,9 +50,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "FileCopyPlugin 29 December 2012 (i)"
+ "FileCopyPlugin 3 January 2013 (i)"
#else
- "FileCopyPlugin 29 December 2012 (e)"
+ "FileCopyPlugin 3 January 2013 (e)"
#endif
;
Modified: trunk/src/plugins/HostWindowPlugin/HostWindowPlugin.c
===================================================================
--- trunk/src/plugins/HostWindowPlugin/HostWindowPlugin.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/HostWindowPlugin/HostWindowPlugin.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:52:55 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:06 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -59,9 +59,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "HostWindowPlugin 29 December 2012 (i)"
+ "HostWindowPlugin 3 January 2013 (i)"
#else
- "HostWindowPlugin 29 December 2012 (e)"
+ "HostWindowPlugin 3 January 2013 (e)"
#endif
;
Modified: trunk/src/plugins/MIDIPlugin/MIDIPlugin.c
===================================================================
--- trunk/src/plugins/MIDIPlugin/MIDIPlugin.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/MIDIPlugin/MIDIPlugin.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:52:58 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:06 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -63,9 +63,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "MIDIPlugin 29 December 2012 (i)"
+ "MIDIPlugin 3 January 2013 (i)"
#else
- "MIDIPlugin 29 December 2012 (e)"
+ "MIDIPlugin 3 January 2013 (e)"
#endif
;
Modified: trunk/src/plugins/Mpeg3Plugin/Mpeg3Plugin.c
===================================================================
--- trunk/src/plugins/Mpeg3Plugin/Mpeg3Plugin.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/Mpeg3Plugin/Mpeg3Plugin.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:52:58 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:06 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -94,9 +94,9 @@
static sqInt maximumNumberOfFilesToWatch;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "Mpeg3Plugin 29 December 2012 (i)"
+ "Mpeg3Plugin 3 January 2013 (i)"
#else
- "Mpeg3Plugin 29 December 2012 (e)"
+ "Mpeg3Plugin 3 January 2013 (e)"
#endif
;
static mpeg3_t *mpegFiles[1024+1];
@@ -921,6 +921,18 @@
sqInt aByteNumber;
sqInt _return_value;
+
+ /* int mpeg3_read_frame(mpeg3_t *file,
+ unsigned char **output_rows,
+ int in_x,
+ int in_y,
+ int in_w,
+ int in_h,
+ int out_w,
+ int out_h,
+ int color_model,
+ int stream) */
+
fileHandle = interpreterProxy->stackValue(11);
interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(10)));
aBuffer = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(10))));
@@ -991,6 +1003,18 @@
sqInt aByteNumber;
sqInt _return_value;
+
+ /* int mpeg3_read_frame(mpeg3_t *file,
+ unsigned char **output_rows,
+ int in_x,
+ int in_y,
+ int in_w,
+ int in_h,
+ int out_w,
+ int out_h,
+ int color_model,
+ int stream) */
+
fileHandle = interpreterProxy->stackValue(10);
interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(9)));
aBuffer = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(9))));
Modified: trunk/src/plugins/RomePlugin/RomePlugin.c
===================================================================
--- trunk/src/plugins/RomePlugin/RomePlugin.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/RomePlugin/RomePlugin.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:52:59 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:07 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -192,9 +192,9 @@
static sqInt maxSurfaceID;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "RomePlugin yo.39 29 December 2012 (i)"
+ "RomePlugin yo.39 3 January 2013 (i)"
#else
- "RomePlugin yo.39 29 December 2012 (e)"
+ "RomePlugin yo.39 3 January 2013 (e)"
#endif
;
static fn_ioRegisterSurface registerSurfaceFn;
@@ -232,6 +232,9 @@
pangoAlignment = PANGO_ALIGN_CENTER;
}
if (alignment == 3) {
+
+ /* self pangoLayoutSetJustify */
+
null;
}
}
@@ -490,6 +493,9 @@
if (interpreterProxy->failed()) {
contextIndex = interpreterProxy->fetchPointerofObject(CanvasHandleIndex, canvasOop);
if (!(contextIndex == (interpreterProxy->nilObject()))) {
+
+ /* fail silently */
+
fail("canvas handle not an integer");
}
return null;
@@ -1492,6 +1498,9 @@
if ((xFrom == xVia) && (yFrom == yVia)) {
cairo_line_to(context, xTo, yTo);
} else {
+
+ /* increase degree to cubic: via1 = 1/3 from + 2/3 via, via2 = 2/3 via + 1/3 to */
+
cairo_curve_to(context, (xFrom + (2.0 * xVia)) / 3.0, (yFrom + (2.0 * yVia)) / 3.0, ((2.0 * xVia) + xTo) / 3.0, ((2.0 * yVia) + yTo) / 3.0, xTo, yTo);
}
seg += 6;
@@ -2823,6 +2832,22 @@
if (1) {
pango_cairo_show_layout(context, layout);
} else {
+
+ /* self cairoTranslate: context x: 0 y: (self cCode: 'PANGO_PIXELS(baseline)').
+ 0 to: lineCount - 1 do: [:lineIndex |
+ line := self pangoLayoutIterGetLineReadonly: lineIter.
+
+ self pangoLayoutLineGetExtents: line ink: (self cCode: '&ink') logical: (self cCode: '&logical').
+ self cairoTranslate: context x: (self cCode: '-(PANGO_PIXELS(ink.x))') y: 0.
+ self pangoCairoShowLayoutLine: context line: line.
+ self pangoLayoutIterNextLine: lineIter.
+ prevBaseline := baseline.
+ baseline := self pangoLayoutIterGetBaseline: lineIter.
+ self cairoTranslate: context x: (self cCode: 'PANGO_PIXELS(ink.x)')
+ y: (self cCode: 'PANGO_PIXELS(baseline-prevBaseline)').
+ ].
+ */
+
null;
}
if (selStart == selEnd) {
@@ -3471,18 +3496,33 @@
symbolOop = interpreterProxy->fetchPointerofObject(0, attrArray);
symbol = interpreterProxy->firstIndexableField(symbolOop);
if ((symbol[0]) == 65) {
+
+ /* A */
+
addAlignmentinto(attrArray, pangoAttrList);
}
if ((symbol[0]) == 67) {
+
+ /* C */
+
addColorinto(attrArray, pangoAttrList);
}
if ((symbol[0]) == 69) {
+
+ /* E */
+
addEmphasisinto(attrArray, pangoAttrList);
}
if ((symbol[0]) == 70) {
+
+ /* F */
+
addFontinto(attrArray, pangoAttrList);
}
if ((symbol[0]) == 76) {
+
+ /* L */
+
addLanguageinto(attrArray, pangoAttrList);
}
}
Modified: trunk/src/plugins/ScratchPlugin/ScratchPlugin.c
===================================================================
--- trunk/src/plugins/ScratchPlugin/ScratchPlugin.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/ScratchPlugin/ScratchPlugin.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:53 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:07 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -82,9 +82,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "ScratchPlugin 29 December 2012 (i)"
+ "ScratchPlugin 3 January 2013 (i)"
#else
- "ScratchPlugin 29 December 2012 (e)"
+ "ScratchPlugin 3 January 2013 (e)"
#endif
;
@@ -1534,6 +1534,9 @@
saturation = ((max - min) * 1000) / max;
}
if (saturation > 0) {
+
+ /* do nothing if pixel is unsaturated (gray) */
+
/* begin hueFromR:G:B:min:max: */
span = max - min;
if (span == 0) {
Modified: trunk/src/plugins/Squeak3D/Squeak3D.c
===================================================================
--- trunk/src/plugins/Squeak3D/Squeak3D.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/Squeak3D/Squeak3D.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:52:51 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:05 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -873,11 +873,20 @@
triMask = (vtxArray[(idx1 * PrimVertexSize) + PrimVtxClipFlags]) & ((vtxArray[(idx2 * PrimVertexSize) + PrimVtxClipFlags]) & (vtxArray[(idx3 * PrimVertexSize) + PrimVtxClipFlags]));
if (!((InAllMask & triMask) == InAllMask)) {
+
+ /* Tri is not completely inside -> needs clipping. */
+
if (triMask & OutAllMask) {
+
+ /* tri is completely outside. Store all zeros */
+
idxArray[i] = 0;
idxArray[i + 1] = 0;
idxArray[i + 2] = 0;
} else {
+
+ /* tri must be partially clipped. */
+
interpreterProxy->pop(6);
interpreterProxy->pushInteger(i);
return null;
@@ -950,6 +959,9 @@
lightCount = interpreterProxy->slotSizeOf(lightArray);
for (i = 1; i <= vtxCount; i += 1) {
+
+ /* Load the primitive vertex */
+
/* begin loadPrimitiveVertex */
rgba = (((int*) litVertex))[PrimVtxColor32];
vtxInColor[2] = ((rgba & 255) * (1.0 / 255.0));
@@ -960,6 +972,9 @@
rgba = ((usqInt) rgba) >> 8;
vtxInColor[3] = ((rgba & 255) * (1.0 / 255.0));
if (vbFlags & VBTrackEmission) {
+
+ /* Load color from vertex */
+
vtxOutColor[0] = ((vtxInColor[0]) + (primMaterial[EmissionRed]));
vtxOutColor[1] = ((vtxInColor[1]) + (primMaterial[EmissionGreen]));
vtxOutColor[2] = ((vtxInColor[2]) + (primMaterial[EmissionBlue]));
@@ -971,6 +986,9 @@
vtxOutColor[3] = (primMaterial[EmissionAlpha]);
}
for (j = 0; j <= (lightCount - 1); j += 1) {
+
+ /* Fetch the light source */
+
/* begin fetchLightSource:ofObject: */
lightOop = interpreterProxy->fetchPointerofObject(j, lightArray);
primLight = interpreterProxy->firstIndexableField(lightOop);
@@ -1575,6 +1593,10 @@
}
deltaCos = primLight[SpotLightDeltaCos];
if (deltaCos <= 1.0e-5) {
+
+ /* No delta -- a sharp boundary between on and off.
+ Since off has already been determined above, we are on */
+
return 1.0;
}
cosAngle = (cosAngle - minCos) / deltaCos;
@@ -1819,6 +1841,9 @@
sqInt stateOop;
if ((copyBitsFn == 0) || (loadBBFn == 0)) {
+
+ /* We need loadBitBltFrom/copyBits here so try to load it implicitly */
+
if (!(initialiseModule())) {
return 0;
}
@@ -2148,6 +2173,9 @@
ptr = interpreterProxy->firstIndexableField(pluginName);
needReload = 0;
for (i = 0; i <= (length - 1); i += 1) {
+
+ /* Compare and store the plugin to be used */
+
if (!((bbPluginName[i]) == (ptr[i]))) {
bbPluginName[i] = (ptr[i]);
needReload = 1;
@@ -2328,6 +2356,9 @@
lightScale = lightScale * (computeSpotFactor());
}
if (lightScale > 0.001) {
+
+ /* Compute the ambient part */
+
if (lightFlags & FlagAmbientPart) {
/* begin addPart:from:trackFlag:scale: */
if (vbFlags & VBTrackAmbient) {
@@ -2349,6 +2380,8 @@
if (lightFlags & FlagDiffusePart) {
/* Compute angle from light->vertex to vertex normal */
+
+
/* For one-sided lighting negate cosAngle if necessary */
cosAngle = dotProductOfFloatwithDouble(litVertex + PrimVtxNormal, l2vDirection);
@@ -2376,6 +2409,9 @@
}
}
if ((lightFlags & FlagSpecularPart) && ((primMaterial[MaterialShininess]) > 0.0)) {
+
+ /* Compute specular part */
+
l2vSpecDir[0] = (l2vDirection[0]);
l2vSpecDir[1] = (l2vDirection[1]);
l2vSpecDir[2] = (l2vDirection[2]);
@@ -2388,6 +2424,8 @@
if (cosAngle > 0.0) {
/* Normalize the angle */
+
+
/* cosAngle should be somewhere between 0 and 1.
If not, then the vertex normal was not normalized */
@@ -2776,7 +2814,13 @@
}
}
if ((mvFlags & FlagM44NoPerspective) && (prFlags == 0)) {
+
+ /* Modelview matrix has no perspective part and projection is not optimized */
+
if ((mvFlags == FlagM44NoTranslation) == 0) {
+
+ /* Modelview matrix with translation */
+
for (i = 1; i <= vtxCount; i += 1) {
if (hasNormals) {
transformPrimitiveNormalbyrescale(pVertex, modelViewMatrix, rescale);
@@ -2786,6 +2830,9 @@
pVertex += PrimVertexSize;
}
} else {
+
+ /* Modelview matrix without translation */
+
for (i = 1; i <= vtxCount; i += 1) {
if (hasNormals) {
transformPrimitiveNormalbyrescale(pVertex, modelViewMatrix, rescale);
@@ -2798,6 +2845,9 @@
return null;
}
if ((mvFlags & prFlags) & FlagM44Identity) {
+
+ /* If both are identity matrices just copy entries */
+
for (i = 1; i <= vtxCount; i += 1) {
pVertex[PrimVtxRasterPosX] = (pVertex[PrimVtxPositionX]);
pVertex[PrimVtxRasterPosY] = (pVertex[PrimVtxPositionY]);
@@ -2808,6 +2858,9 @@
return null;
}
if (mvFlags & FlagM44Identity) {
+
+ /* If model view matrix is identity just perform projection */
+
for (i = 1; i <= vtxCount; i += 1) {
transformPrimitiveRasterPositionby(pVertex, projectionMatrix);
pVertex += PrimVertexSize;
@@ -2815,6 +2868,10 @@
return null;
}
if (prFlags & FlagM44Identity) {
+
+ /* If projection matrix is identity just transform and copy.
+ Note: This case is not very likely so it's not been unrolled. */
+
for (i = 1; i <= vtxCount; i += 1) {
if (hasNormals) {
transformPrimitiveNormalbyrescale(pVertex, modelViewMatrix, rescale);
Modified: trunk/src/plugins/SqueakFFIPrims/SqueakFFIPrims.c
===================================================================
--- trunk/src/plugins/SqueakFFIPrims/SqueakFFIPrims.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/SqueakFFIPrims/SqueakFFIPrims.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:52:53 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:05 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -125,9 +125,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "SqueakFFIPrims 29 December 2012 (i)"
+ "SqueakFFIPrims 3 January 2013 (i)"
#else
- "SqueakFFIPrims 29 December 2012 (e)"
+ "SqueakFFIPrims 3 January 2013 (e)"
#endif
;
@@ -205,6 +205,10 @@
nilOop = interpreterProxy->nilObject();
if (!(argClass == nilOop)) {
+
+ /* Type check 1:
+ Is the required class of the argument a subclass of ExternalStructure? */
+
if (!(interpreterProxy->includesBehaviorThatOf(argClass, interpreterProxy->classExternalStructure()))) {
/* begin ffiFail: */
ffiLastError = FFIErrorWrongType;
@@ -218,10 +222,10 @@
}
isStruct = 0;
if (!(((oop & 1)) || (oop == nilOop))) {
- if (interpreterProxy->isPointers(oop)) {
- /* #isPointers: will fail if oop is SmallInteger so don't even attempt to use it */
+ /* #isPointers: will fail if oop is SmallInteger so don't even attempt to use it */
+ if (interpreterProxy->isPointers(oop)) {
isStruct = interpreterProxy->includesBehaviorThatOf(oopClass, interpreterProxy->classExternalStructure());
if (!((argClass == nilOop) || (isStruct))) {
/* begin ffiFail: */
@@ -265,6 +269,9 @@
ffiArgHeader = longAt(ffiArgSpec);
if (ffiArgHeader & FFIFlagStructure) {
+
+ /* argument must be ExternalStructure */
+
if (!(isStruct)) {
/* begin ffiFail: */
ffiLastError = FFIErrorCoercionFailed;
@@ -315,6 +322,9 @@
return interpreterProxy->primitiveFail();
}
if (ffiArgHeader & FFIFlagPointer) {
+
+ /* no integers for pointers please */
+
if ((oop & 1)) {
/* begin ffiFail: */
ffiLastError = FFIErrorIntAsPointer;
@@ -324,6 +334,9 @@
return ffiPushPointer(null);
}
if (ffiArgHeader & FFIFlagAtomic) {
+
+ /* e.g., ExternalData */
+
if (isStruct) {
/* begin ffiAtomicStructByReference:Class: */
if (!(oopClass == (interpreterProxy->classExternalData()))) {
@@ -448,6 +461,9 @@
return ffiPushPointerContentsOf(valueOop);
}
if (ffiArgHeader & FFIFlagAtomic) {
+
+ /* argument is atomic value */
+
/* begin ffiArgByValue: */
atomicType2 = ((usqInt) (ffiArgHeader & FFIAtomicTypeMask)) >> FFIAtomicTypeShift;
if ((atomicType2 < 0) || (atomicType2 > FFITypeDoubleFloat)) {
@@ -583,10 +599,10 @@
sqInt shift;
sqInt value;
- if (ffiRetHeader & FFIFlagPointer) {
- /* Note: Order is important here since FFIFlagPointer + FFIFlagStructure is used to represent 'typedef void* VoidPointer' and VoidPointer must be returned as pointer *not* as struct */
+ /* Note: Order is important here since FFIFlagPointer + FFIFlagStructure is used to represent 'typedef void* VoidPointer' and VoidPointer must be returned as pointer *not* as struct */
+ if (ffiRetHeader & FFIFlagPointer) {
retVal = ffiCallAddressOfWithPointerReturn(address, callType);
return ffiCreateReturnPointer(retVal);
}
@@ -692,6 +708,9 @@
lowWord = ffiLongLongResultLow();
highWord = ffiLongLongResultHigh();
if (isSigned) {
+
+ /* check for 32 bit signed */
+
if ((highWord == 0) && (lowWord >= 0)) {
return interpreterProxy->signed32BitIntegerFor(lowWord);
}
@@ -713,6 +732,9 @@
largeClass = interpreterProxy->classLargePositiveInteger();
}
} else {
+
+ /* check for 32 bit unsigned */
+
if (highWord == 0) {
return interpreterProxy->positive32BitIntegerFor(lowWord);
}
@@ -768,6 +790,9 @@
atomicType = ((usqInt) (ffiRetHeader & FFIAtomicTypeMask)) >> FFIAtomicTypeShift;
if ((((usqInt) atomicType) >> 1) == (((usqInt) FFITypeSignedChar) >> 1)) {
+
+ /* String return */
+
return ffiReturnCStringFrom(retVal);
}
interpreterProxy->pushRemappableOop(ffiRetOop);
@@ -857,6 +882,8 @@
/* Lookup the address */
+
+
/* Make sure it's an external handle */
addressPtr = interpreterProxy->fetchPointerofObject(0, lit);
@@ -885,6 +912,9 @@
return 0;
}
if (address == 0) {
+
+ /* Go look it up in the module */
+
if ((interpreterProxy->slotSizeOf(lit)) < 5) {
/* begin ffiFail: */
ffiLastError = FFIErrorNoModule;
@@ -1771,10 +1801,10 @@
return 0;
}
if (byteSize < 4) {
- if (byteSize == 1) {
- /* short/byte */
+ /* short/byte */
+ if (byteSize == 1) {
value = byteAt(addr);
} else {
value = *((unsigned short int *) addr);
Modified: trunk/src/plugins/UUIDPlugin/UUIDPlugin.c
===================================================================
--- trunk/src/plugins/UUIDPlugin/UUIDPlugin.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/UUIDPlugin/UUIDPlugin.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:53:01 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:07 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -53,9 +53,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "UUIDPlugin 29 December 2012 (i)"
+ "UUIDPlugin 3 January 2013 (i)"
#else
- "UUIDPlugin 29 December 2012 (e)"
+ "UUIDPlugin 3 January 2013 (e)"
#endif
;
Modified: trunk/src/plugins/UnicodePlugin/UnicodePlugin.c
===================================================================
--- trunk/src/plugins/UnicodePlugin/UnicodePlugin.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/UnicodePlugin/UnicodePlugin.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:53:01 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:07 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -62,9 +62,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "UnicodePlugin 29 December 2012 (i)"
+ "UnicodePlugin 3 January 2013 (i)"
#else
- "UnicodePlugin 29 December 2012 (e)"
+ "UnicodePlugin 3 January 2013 (e)"
#endif
;
Modified: trunk/src/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c
===================================================================
--- trunk/src/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/UnixOSProcessPlugin/UnixOSProcessPlugin.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:53:02 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:07 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -218,9 +218,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "UnixOSProcessPlugin 29 December 2012 (i)"
+ "UnixOSProcessPlugin 3 January 2013 (i)"
#else
- "UnixOSProcessPlugin 29 December 2012 (e)"
+ "UnixOSProcessPlugin 3 January 2013 (e)"
#endif
;
static void *originalSigHandlers[NSIG];
@@ -278,6 +278,9 @@
int filedes[2];
if ((pipe(filedes)) == -1) {
+
+ /* Translates to a pipe() system call */
+
return 0;
} else {
*writerIOStreamPtr= (FILE *) fdopen (filedes[1], "a");
@@ -442,6 +445,10 @@
pid_t pid;
struct itimerval saveIntervalTimer;
+
+ /* Turn off the interval timer. If this is not done, then the program which we exec in
+ the child process will receive a timer interrupt, and will not know how to handle it. */
+
intervalTimer.it_interval.tv_sec = 0;
intervalTimer.it_interval.tv_usec = 0;
intervalTimer.it_value.tv_sec = 0;
@@ -473,19 +480,26 @@
return null;
}
if (semaphoreIndex == 0) {
- if ((semaIndices[sigNum]) != 0) {
- /* Disable the handler */
+ /* Disable the handler */
+ if ((semaIndices[sigNum]) != 0) {
oldHandler = originalSigHandlers[sigNum];
oldHandler = setSignalNumberhandler(sigNum, oldHandler);
semaIndices[sigNum] = 0;
return oldHandler;
} else {
+
+ /* either -1 for printAllStacks or a positive integer for semaphore forwarding */
+ /* Signal handler had not been set, answer an error */
+
return sigErrorNumber();
}
}
if ((semaIndices[sigNum]) > 0) {
+
+ /* Handler is already set, answer an error */
+
return sigErrorNumber();
}
oldHandler = setSignalNumberhandler(sigNum, handleSignalFunctionAddress());
@@ -647,6 +661,10 @@
# ifdef SA_ONSTACK // true if platform supports sigaltstack, else meaningless redeclarations of stack_t and sigaction
setSigaltstack();
# else
+
+ /* override stack_t declared in sigstack.h because declarations
+ cannot easily be removed from setSigaltstack */
+
# define stack_t sqInt
@@ -1192,10 +1210,17 @@
sqInt workingDir;
sqInt sigNum;
+
+ /* Do not fork child if running in secure mode */
+
if ((sandboxSecurity()) == 1) {
interpreterProxy->pop(10);
interpreterProxy->pushInteger(-1);
} else {
+
+ /* Turn off the interval timer. If this is not done, then the program which we exec in
+ the child process will receive a timer interrupt, and will not know how to handle it. */
+
intervalTimer.it_interval.tv_sec = 0;
intervalTimer.it_interval.tv_usec = 0;
intervalTimer.it_value.tv_sec = 0;
@@ -1289,6 +1314,10 @@
/* Can't get here from there */;
}
} else {
+
+ /* Normal return to Smalltalk - this is the old parent process. */
+ /* Enable the timer again before resuming Smalltalk. */
+
setitimer (ITIMER_REAL, &saveIntervalTimer, 0L);
interpreterProxy->pop(10);
interpreterProxy->pushInteger(pid);
@@ -1327,6 +1356,9 @@
EXPORT(sqInt) primitiveForkSqueakWithoutSigHandler(void) {
pid_t pid;
+
+ /* Do not fork child if running in secure mode */
+
if ((sandboxSecurity()) == 1) {
interpreterProxy->pop(1);
interpreterProxy->pushInteger(-1);
@@ -1717,6 +1749,9 @@
errno = 0;
result = nice(niceIncrement);
if (result == -1) {
+
+ /* sys call may have failed, test errno to be sure */
+
if (!(errno == 0)) {
return interpreterProxy->primitiveFail();
}
@@ -1768,6 +1803,9 @@
keyValueString = interpreterProxy->stackObjectValue(0);
cStringPtr = cStringFromString(keyValueString);
if ((putenv(cStringPtr)) == 0) {
+
+ /* Set environment variable. */
+
interpreterProxy->pop(2);
interpreterProxy->push(keyValueString);
} else {
@@ -1972,6 +2010,9 @@
int result;
sqInt sig;
+
+ /* Do not allow signal sending if running in secure mode */
+
if ((sandboxSecurity()) == 1) {
interpreterProxy->pop(2);
interpreterProxy->pushInteger(-1);
@@ -2000,6 +2041,9 @@
int result;
sqInt sig;
+
+ /* Do not allow signal sending if running in secure mode */
+
if ((sandboxSecurity()) == 1) {
interpreterProxy->pop(2);
interpreterProxy->pushInteger(-1);
@@ -2029,6 +2073,9 @@
int result;
sqInt sig;
+
+ /* Do not allow signal sending if running in secure mode */
+
if ((sandboxSecurity()) == 1) {
interpreterProxy->pop(2);
interpreterProxy->pushInteger(-1);
@@ -2057,6 +2104,9 @@
int result;
sqInt sig;
+
+ /* Do not allow signal sending if running in secure mode */
+
if ((sandboxSecurity()) == 1) {
interpreterProxy->pop(2);
interpreterProxy->pushInteger(-1);
@@ -2085,6 +2135,9 @@
int result;
sqInt sig;
+
+ /* Do not allow signal sending if running in secure mode */
+
if ((sandboxSecurity()) == 1) {
interpreterProxy->pop(2);
interpreterProxy->pushInteger(-1);
@@ -2113,6 +2166,9 @@
int result;
sqInt sig;
+
+ /* Do not allow signal sending if running in secure mode */
+
if ((sandboxSecurity()) == 1) {
interpreterProxy->pop(2);
interpreterProxy->pushInteger(-1);
@@ -2141,6 +2197,9 @@
int result;
sqInt sig;
+
+ /* Do not allow signal sending if running in secure mode */
+
if ((sandboxSecurity()) == 1) {
interpreterProxy->pop(2);
interpreterProxy->pushInteger(-1);
@@ -2169,6 +2228,9 @@
int result;
sqInt sig;
+
+ /* Do not allow signal sending if running in secure mode */
+
if ((sandboxSecurity()) == 1) {
interpreterProxy->pop(2);
interpreterProxy->pushInteger(-1);
@@ -2197,6 +2259,9 @@
int result;
sqInt sig;
+
+ /* Do not allow signal sending if running in secure mode */
+
if ((sandboxSecurity()) == 1) {
interpreterProxy->pop(2);
interpreterProxy->pushInteger(-1);
@@ -2225,6 +2290,9 @@
int result;
sqInt sig;
+
+ /* Do not allow signal sending if running in secure mode */
+
if ((sandboxSecurity()) == 1) {
interpreterProxy->pop(2);
interpreterProxy->pushInteger(-1);
@@ -2253,6 +2321,9 @@
int result;
sqInt sig;
+
+ /* Do not allow signal sending if running in secure mode */
+
if ((sandboxSecurity()) == 1) {
interpreterProxy->pop(2);
interpreterProxy->pushInteger(-1);
@@ -2281,6 +2352,9 @@
int result;
sqInt sig;
+
+ /* Do not allow signal sending if running in secure mode */
+
if ((sandboxSecurity()) == 1) {
interpreterProxy->pop(2);
interpreterProxy->pushInteger(-1);
@@ -2309,6 +2383,9 @@
int result;
sqInt sig;
+
+ /* Do not allow signal sending if running in secure mode */
+
if ((sandboxSecurity()) == 1) {
interpreterProxy->pop(2);
interpreterProxy->pushInteger(-1);
@@ -2666,6 +2743,9 @@
return null;
}
if ((semaIndices[sigNum]) > 0) {
+
+ /* Handler is already set, answer an error */
+
return sigErrorNumber();
}
newHandler = getPrintAllStacksFunction();
@@ -2812,6 +2892,9 @@
# ifdef SA_ONSTACK // true if platform supports sigaltstack
+
+ /* See if there's already a sigaltstack in place */
+
if ((sigaltstack(0,&sigstack)) < 0) {
perror("sigaltstack");
}
Modified: trunk/src/plugins/WeDoPlugin/WeDoPlugin.c
===================================================================
--- trunk/src/plugins/WeDoPlugin/WeDoPlugin.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/WeDoPlugin/WeDoPlugin.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:53:02 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:08 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -54,9 +54,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "WeDoPlugin 29 December 2012 (i)"
+ "WeDoPlugin 3 January 2013 (i)"
#else
- "WeDoPlugin 29 December 2012 (e)"
+ "WeDoPlugin 3 January 2013 (e)"
#endif
;
Modified: trunk/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c
===================================================================
--- trunk/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/plugins/XDisplayControlPlugin/XDisplayControlPlugin.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:53:02 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:27:08 pm
+ by VMMaker 4.10.8
*/
#include <math.h>
@@ -70,9 +70,9 @@
struct VirtualMachine* interpreterProxy;
static const char *moduleName =
#ifdef SQUEAK_BUILTIN_PLUGIN
- "XDisplayControlPlugin 29 December 2012 (i)"
+ "XDisplayControlPlugin 3 January 2013 (i)"
#else
- "XDisplayControlPlugin 29 December 2012 (e)"
+ "XDisplayControlPlugin 3 January 2013 (e)"
#endif
;
static int osprocessSandboxSecurity;
@@ -114,6 +114,9 @@
sqInt name;
char * namePtr;
+
+ /* Do not allow this if running in secure mode */
+
if ((sandboxSecurity()) == 1) {
interpreterProxy->pop(2);
interpreterProxy->push(interpreterProxy->falseObject());
@@ -122,9 +125,15 @@
namePtr = transientCStringFromString(name);
d = XOpenDisplay(namePtr);
if (d == 0) {
+
+ /* Failed to make connection to server, answer false */
+
interpreterProxy->pop(2);
interpreterProxy->push(interpreterProxy->falseObject());
} else {
+
+ /* Successfully opened connection; close it and answer true */
+
XCloseDisplay(d);
interpreterProxy->pop(2);
interpreterProxy->push(interpreterProxy->trueObject());
@@ -221,6 +230,9 @@
static char nameBuffer[501];
char * namePtr;
+
+ /* Do not allow this if running in secure mode */
+
if ((sandboxSecurity()) == 1) {
interpreterProxy->pop(2);
interpreterProxy->pushInteger(-1);
Modified: trunk/src/vm/interp.c
===================================================================
--- trunk/src/vm/interp.c 2013-01-03 22:00:52 UTC (rev 2655)
+++ trunk/src/vm/interp.c 2013-01-04 04:55:58 UTC (rev 2656)
@@ -1,5 +1,5 @@
-/* Automatically generated from Squeak on 29 December 2012 7:52:34 pm
- by VMMaker 4.10.7
+/* Automatically generated from Squeak on 3 January 2013 11:26:59 pm
+ by VMMaker 4.10.8
*/
#if 1
# define SQ_USE_GLOBAL_STRUCT 1
@@ -158,7 +158,7 @@
#define InitialIPIndex 4
#define InstanceSpecificationIndex 2
#define InstructionPointerIndex 1
-#define InterpreterSourceVersion "4.10.7"
+#define InterpreterSourceVersion "4.10.8"
#define InvokeCallbackSelector 53
#define LargeContextBit 262144
#define LastLinkIndex 1
@@ -929,7 +929,7 @@
struct foo * foo = &fum;
sqInt extraVMMemory;
-const char *interpreterVersion = "Squeak4.3 of 22 December 2011 [latest update: #11860]";
+const char *interpreterVersion = "Squeak4.3 of 2 January 2013 [latest update: #12359]";
sqInt (*compilerHooks[16])();
struct VirtualMachine* interpreterProxy;
sqInt imageFormatVersionNumber = 0;
@@ -1722,6 +1722,9 @@
for (p = 0; p <= (CacheProbeMax - 1); p += 1) {
probe = (((usqInt) hash) >> p) & MethodCacheMask;
if ((foo->methodCache[probe + MethodCacheSelector]) == 0) {
+
+ /* Found an empty entry -- use it */
+
foo->methodCache[probe + MethodCacheSelector] = foo->messageSelector;
foo->methodCache[probe + MethodCacheClass] = foo->lkupClass;
foo->methodCache[probe + MethodCacheMethod] = foo->newMethod;
@@ -1937,6 +1940,9 @@
sqInt oop3;
if (foo->allocationCount >= foo->allocationsBetweenGCs) {
+
+ /* do an incremental GC every so many allocations to keep pauses short */
+
incrementalGC();
}
/* begin sufficientSpaceToAllocate: */
@@ -2103,6 +2109,9 @@
return 1;
}
if (!foo->primFailCode) {
+
+ /* Successful prim, stack must have exactly nArgs arguments popped off */
+
return ((foo->stackPointer - foo->activeContext) + (nArgs * (BYTES_PER_WORD))) == delta;
}
return (foo->stackPointer - foo->activeContext) == delta;
@@ -2117,6 +2126,9 @@
sqInt header;
if (((((usqInt) oop)) < (((usqInt) foo->youngStart))) && (!((oop & 1)))) {
+
+ /* Yes, oop is an old object */
+
/* begin noteAsRoot:headerLoc: */
header = longAt(oop);
if ((header & (ROOT_BIT)) == 0) {
@@ -2176,6 +2188,9 @@
}
}
} else {
+
+ /* Normal -- no forwarding */
+
/* begin noteAsRoot:headerLoc: */
header2 = longAt(oop);
if ((header2 & (ROOT_BIT)) == 0) {
@@ -2241,8 +2256,14 @@
return 0;
}
if (allYoungand(array1, array2)) {
+
+ /* sweep only the young objects plus the roots */
+
mapPointersInObjectsFromto(foo->youngStart, foo->endOfMemory);
} else {
+
+ /* sweep all objects */
+
mapPointersInObjectsFromto(memory, foo->endOfMemory);
}
if (twoWayFlag) {
@@ -2536,6 +2557,9 @@
sqInt lastLink;
sqInt oop21;
+
+ /* For now, do not allow a callback unless we're in a primitiveResponse */
+
if (foo->primitiveIndex == 0) {
return 0;
}
@@ -2561,6 +2585,9 @@
foo->nextPollTick = 0;
result = setjmp(foo->jmpBuf[foo->jmpDepth]);
if (result == 0) {
+
+ /* Fill in callbackID */
+
callbackID[0] = foo->jmpDepth;
interpret();
}
@@ -2693,6 +2720,9 @@
}
longAtput(rcvr, ((longAt(rcvr)) & (~CompactClassMask)) | ccIndex);
} else {
+
+ /* Exchange the class pointer, which could make rcvr a root for argClass */
+
longAtput(rcvr - (BASE_HEADER_SIZE), argClass | ((longAt(rcvr)) & TypeMask));
if ((((usqInt) rcvr)) < (((usqInt) foo->youngStart))) {
possibleRootStoreIntovalue(rcvr, argClass);
@@ -2753,9 +2783,11 @@
now = (ioMSecs()) & MillisecondClockMask;
if (!(foo->interruptCheckCounter < -100)) {
+
+ /* don't play with the feedback if we forced a check. It only makes life difficult */
+
if ((now - foo->lastTick) < foo->interruptChecksEveryNms) {
- /* don't play with the feedback if we forced a check. It only makes life difficult */
/* wrapping is not a concern, it'll get caught quickly
enough. This clause is trying to keep a reasonable
guess of how many times per interruptChecksEveryNms we are calling
@@ -2882,6 +2914,9 @@
sqInt checkImageVersionFromstartingAt(sqImageFile f, squeakFileOffsetType imageOffset) {
sqInt firstVersion;
+
+ /* check the version number */
+
sqImageFileSeek(f, imageOffset);
imageFormatInitialVersion = (firstVersion = getLongFromFileswap(f, 0));
if (readableFormat(imageFormatInitialVersion)) {
@@ -2893,6 +2928,9 @@
return 1;
}
if (imageOffset == 0) {
+
+ /* try skipping the first 512 bytes (prepended by certain Mac file transfer utilities) */
+
sqImageFileSeek(f, 512);
imageFormatInitialVersion = getLongFromFileswap(f, 0);
if (readableFormat(imageFormatInitialVersion)) {
@@ -3284,10 +3322,15 @@
if ((foo->messageSelector == (fetchPointerofObject(16 * 2, fetchPointerofObject(SpecialSelectors, foo->specialObjectsOop)))) && (foo->lkupClass == (fetchClassOfNonInt(rcvr)))) {
/* OK -- look in the at-cache */
+
+
/* Index into atCache = 4N, for N = 0 ... 7 */
atIx = rcvr & AtCacheMask;
if (!((foo->atCache[atIx + AtCacheOop]) == rcvr)) {
+
+ /* Rcvr not in cache. Install it... */
+
installinAtCacheatstring(rcvr, foo->atCache, atIx, stringy);
}
if (!foo->primFailCode) {
@@ -3352,10 +3395,15 @@
if ((foo->messageSelector == (fetchPointerofObject(17 * 2, fetchPointerofObject(SpecialSelectors, foo->specialObjectsOop)))) && (foo->lkupClass == (fetchClassOfNonInt(rcvr)))) {
/* OK -- look in the at-cache */
+
+
/* Index into atPutCache */
atIx = (rcvr & AtCacheMask) + AtPutBase;
if (!((foo->atCache[atIx + AtCacheOop]) == rcvr)) {
+
+ /* Rcvr not in cache. Install it... */
+
installinAtCacheatstring(rcvr, foo->atCache, atIx, stringy);
}
if (!foo->primFailCode) {
@@ -3456,12 +3504,19 @@
return result;
}
if (fmt >= 16) {
+
+ /* Note fmt >= 16 is an artificial flag for strings */
+ /* String */
+
/* begin fetchPointer:ofObject: */
/* begin fetchPointer:ofObject: */
oop1 = foo->specialObjectsOop;
oop = longAt((oop1 + (BASE_HEADER_SIZE)) + (CharacterTable << (SHIFT_FOR_WORD)));
return longAt((oop + (BASE_HEADER_SIZE)) + ((byteAt((rcvr + (BASE_HEADER_SIZE)) + (index - 1))) << (SHIFT_FOR_WORD)));
} else {
+
+ /* ByteArray */
+
return (((byteAt((rcvr + (BASE_HEADER_SIZE)) + (index - 1))) << 1) | 1);
}
}
@@ -3793,6 +3848,9 @@
}
longAtput((message + (BASE_HEADER_SIZE)) + (MessageArgumentsIndex << (SHIFT_FOR_WORD)), argumentArray);
if ((lastPointerOf(message)) >= ((MessageLookupClassIndex * (BYTES_PER_WORD)) + (BASE_HEADER_SIZE))) {
+
+ /* Only store lookupClass if message has 3 fields (old images don't) */
+
/* begin storePointer:ofObject:withValue: */
if ((((usqInt) message)) < (((usqInt) foo->youngStart))) {
possibleRootStoreIntovalue(message, lookupClass);
@@ -4148,6 +4206,9 @@
if (ccIndex == 0) {
return (longAt(oop - (BASE_HEADER_SIZE))) & (ALL_BUT_TYPE_MASK);
} else {
+
+ /* look up compact class */
+
/* begin fetchPointer:ofObject: */
/* begin fetchPointer:ofObject: */
oop3 = foo->specialObjectsOop;
@@ -4165,6 +4226,9 @@
if (ccIndex == 0) {
return (longAt(oop - (BASE_HEADER_SIZE))) & (ALL_BUT_TYPE_MASK);
} else {
+
+ /* look up compact class */
+
/* begin fetchPointer:ofObject: */
/* begin fetchPointer:ofObject: */
oop2 = foo->specialObjectsOop;
@@ -4339,19 +4403,22 @@
weakOop = longAt(oop + i);
if (!((weakOop == foo->nilObj) || (((weakOop & 1)) || (weakOop < foo->youngStart)))) {
- if (weakOop < oop) {
- /* Check if the object is being collected.
+ /* Check if the object is being collected.
If the weak reference points
* backward: check if the weakOops chunk is free
* forward: check if the weakOoop has been marked by GC */
+ if (weakOop < oop) {
chunk = weakOop - (foo->headerTypeBytes[(longAt(weakOop)) & TypeMask]);
oopGone = ((longAt(chunk)) & TypeMask) == HeaderTypeFree;
} else {
oopGone = ((longAt(weakOop)) & (MARK_BIT)) == 0;
}
if (oopGone) {
+
+ /* Store nil in the pointer and signal the interpreter */
+
longAtput(oop + i, foo->nilObj);
if (nonWeakCnt >= 2) {
/* begin weakFinalizerCheck: */
@@ -4507,6 +4574,9 @@
ok = 0;
l1: /* end lookupInMethodCacheSel:class: */;
if (!(ok)) {
+
+ /* entry was not found in the cache; look it up the hard way */
+
lookupMethodInClass(class);
foo->lkupClass = class;
addNewMethodToCache();
@@ -4692,10 +4762,16 @@
l3: /* end fixedFieldsOf:format:length: */;
if (fmt < 8) {
if (fmt == 6) {
+
+ /* 32 bit field objects */
+
return pointerForOop((oop + (BASE_HEADER_SIZE)) + (fixedFields << 2));
}
return pointerForOop((oop + (BASE_HEADER_SIZE)) + (fixedFields << (SHIFT_FOR_WORD)));
} else {
+
+ /* Byte objects */
+
return pointerForOop((oop + (BASE_HEADER_SIZE)) + fixedFields);
}
}
@@ -4800,10 +4876,16 @@
while ((((usqInt) oop)) < (((usqInt) foo->endOfMemory))) {
if (!(((longAt(oop)) & TypeMask) == HeaderTypeFree)) {
if (((((usqInt) (longAt(oop))) >> 8) & 15) >= 12) {
+
+ /* This is a compiled method */
+
/* begin primitiveIndexOf: */
primBits = (((usqInt) (longAt((oop + (BASE_HEADER_SIZE)) + (HeaderIndex << (SHIFT_FOR_WORD))))) >> 1) & 268435967;
primIdx = (primBits & 511) + (((usqInt) primBits) >> 19);
if (primIdx == PrimitiveExternalCallIndex) {
+
+ /* It's primitiveExternalCall */
+
flushExternalPrimitiveOf(oop);
}
}
@@ -4952,6 +5034,9 @@
sqInt fwdTableInit(sqInt blkSize) {
register struct foo * foo = &fum;
+
+ /* set endOfMemory to just after a minimum-sized free block */
+
/* begin setSizeOfFree:to: */
longAtput(foo->freeBlock, ((BASE_HEADER_SIZE) & (ALL_BUT_TYPE_MASK)) | HeaderTypeFree);
@@ -5107,6 +5192,9 @@
register struct foo * foo = &fum;
sqInt bytesFreed;
+
+ /* reserve memory for forwarding table */
+
fwdTableInit((BYTES_PER_WORD) * 2);
/* update pointers to point at new oops */
@@ -5145,6 +5233,9 @@
if (((longAt(oop)) & TypeMask) == HeaderTypeFree) {
bytesFreed += (longAt(oop)) & (ALL_BUT_TYPE_MASK);
} else {
+
+ /* create a forwarding block for oop */
+
/* begin fwdBlockGet: */
foo->fwdTableNext += (BYTES_PER_WORD) * 2;
if (foo->fwdTableNext <= foo->fwdTableLast) {
@@ -5368,6 +5459,9 @@
if ((objectAfter(newFreeChunk)) == foo->endOfMemory) {
initializeMemoryFirstFree(newFreeChunk);
} else {
+
+ /* newFreeChunk is not at end of memory; re-install freeBlock */
+
initializeMemoryFirstFree(foo->freeBlock);
}
return newFreeChunk;
@@ -5784,6 +5878,9 @@
hdr = longAt(rcvr);
fmt = (((usqInt) hdr) >> 8) & 15;
if ((fmt == 3) && ((((((usqInt) hdr) >> 12) & 31) == 13) || ((((((usqInt) hdr) >> 12) & 31) == 14) || (((((usqInt) hdr) >> 12) & 31) == 4)))) {
+
+ /* Contexts must not be put in the atCache, since their size is not constant */
+
/* begin primitiveFail */
if (foo->primFailCode == 0) {
foo->primFailCode = 1;
@@ -6391,8 +6488,14 @@
sqInt integerValueOf(sqInt objectPointer) {
if ((objectPointer & 2147483648U) != 0) {
+
+ /* negative */
+
return ((((usqInt) (objectPointer & 2147483647U)) >> 1) - 1073741823) - 1;
} else {
+
+ /* positive */
+
return ((usqInt) objectPointer) >> 1;
}
}
@@ -12935,6 +13038,9 @@
sqInt int64;
sqInt shiftCount;
+
+ /* 32 bit signed integer */
+
# ifdef SQ_IMAGE64 // a 64-bit object memory word size
@@ -12956,6 +13062,9 @@
}
return 0;
# else
+
+ /* if sqInt is 64 bit, size parameter may overflow int32 */
+
if (size > 4294967295U) {
return 0;
}
@@ -13162,6 +13271,9 @@
fmt = (((usqInt) header) >> 8) & 15;
if (fmt <= 4) {
if ((fmt == 3) && ((((((usqInt) header) >> 12) & 31) == 13) || ((((((usqInt) header) >> 12) & 31) == 14) || (((((usqInt) header) >> 12) & 31) == 4)))) {
+
+ /* contexts end at the stack pointer */
+
/* begin fetchStackPointerOf: */
sp = longAt((oop + (BASE_HEADER_SIZE)) + (StackPointerIndex << (SHIFT_FOR_WORD)));
if (!((sp & 1))) {
@@ -13381,6 +13493,10 @@
while (currentClass != foo->nilObj) {
dictionary = longAt((currentClass + (BASE_HEADER_SIZE)) + (MessageDictionaryIndex << (SHIFT_FOR_WORD)));
if (dictionary == foo->nilObj) {
+
+ /* MethodDict pointer is nil (hopefully due a swapped out stub)
+ -- raise exception #cannotInterpret:. */
+
/* begin pushRemappableOop: */
foo->remapBuffer[(foo->remapBufferCount += 1)] = currentClass;
createActualMessageTo(class);
@@ -13897,12 +14013,17 @@
if (((((usqInt) (longAt(oop))) >> 8) & 15) == 4) {
/* Set lastFieldOffset before the weak fields in the receiver */
+
+
/* And remember as weak root */
lastFieldOffset = (nonWeakFieldsOf(oop)) << (SHIFT_FOR_WORD);
foo->weakRootCount += 1;
foo->weakRoots[foo->weakRootCount] = oop;
} else {
+
+ /* Do it the usual way */
+
/* begin lastPointerOf: */
header1 = longAt(oop);
fmt = (((usqInt) header1) >> 8) & 15;
@@ -14264,6 +14385,9 @@
sqInt oop2;
sqInt oop3;
+
+ /* No need to inline - we won't call this often */
+
if (!(((((usqInt) (longAt(oop))) >> 8) & 15) == 4)) {
error("Called fixedFieldsOfWeak: with a non-weak oop");
}
@@ -14310,6 +14434,9 @@
sqInt header2;
if (!(isBigEnder())) {
+
+ /* Swap words within Float objects, taking them out of native platform ordering */
+
/* begin firstAccessibleObject */
obj1 = memory + (foo->headerTypeBytes[(longAt(memory)) & TypeMask]);
while ((((usqInt) obj1)) < (((usqInt) foo->endOfMemory))) {
@@ -14417,9 +14544,11 @@
header = longAt(headerLoc);
if ((header & (ROOT_BIT)) == 0) {
+
+ /* record oop as root only if not already recorded */
+
if (foo->rootTableCount < RootTableRedZone) {
- /* record oop as root only if not already recorded */
/* record root if there is enough room in the roots
table */
@@ -14427,9 +14556,11 @@
foo->rootTable[foo->rootTableCount] = oop;
longAtput(headerLoc, header | (ROOT_BIT));
} else {
+
+ /* we're getting in the red zone */
+
if (foo->rootTableCount < RootTableSize) {
- /* we're getting in the red zone */
/* but there's still space to record it */
foo->rootTableCount += 1;
@@ -15108,6 +15239,9 @@
sqInt header;
if (((((usqInt) valueObj)) >= (((usqInt) foo->youngStart))) && (!((valueObj & 1)))) {
+
+ /* Yes, valueObj is a young object */
+
/* begin noteAsRoot:headerLoc: */
header = longAt(oop);
if ((header & (ROOT_BIT)) == 0) {
@@ -15148,6 +15282,10 @@
}
}
if (oopisGreaterThan((longAt(foo->freeBlock)) & (ALL_BUT_TYPE_MASK), foo->shrinkThreshold)) {
+
+ /* Attempt to shrink memory after successfully
+ reclaiming lots of memory */
+
/* begin shrinkObjectMemory: */
delta = ((longAt(foo->freeBlock)) & (ALL_BUT_TYPE_MASK)) - foo->growHeadroom;
foo->statShrinkMemory += 1;
@@ -15328,6 +15466,9 @@
}
longAtput(oop1, (((usqInt) fwdBlock) >> 1) | ((MARK_BIT) | originalHeaderType1));
if (twoWayFlag) {
+
+ /* Second block maps oop2 back to oop1 for two-way become */
+
/* begin fwdBlockGet: */
foo->fwdTableNext += fwdBlkSize;
if (foo->fwdTableNext <= foo->fwdTableLast) {
@@ -15415,6 +15556,9 @@
return null;
}
if (aIsNegative == bIsNegative) {
+
+ /* Protect against overflow */
+
if (a > (18446744073709551615U - b)) {
/* begin primitiveFail */
if (foo->primFailCode == 0) {
@@ -15485,6 +15629,9 @@
l2: /* end stackObjectValue: */;
err = changeClassOfto(arg, rcvr);
if (err == 0) {
+
@@ Diff output truncated at 50000 characters. @@
More information about the Vm-dev
mailing list