Skip to content

Commit a51d41c

Browse files
committed
CogVM source as per VMMaker.oscog-eem.3690
Simplify getting/setting the flags in imageHeaderFlags. No longer extract these into separate variables (eliminating 10 variables), but instead test the bits directly. Declare imageHeaderFlags in sq.h as extern const; provide sendWheelEvents as a macro. Split and rename primitiveDoMixedArithmetic into numericPrimsMixArithmetic & numericPrimsMixComparison. This involves adding loadFloatOrIntForComparisonFrom: alongside loadFloatOrIntFrom:. See Cuis-Smalltalk/Cuis-Smalltalk-Dev#308 Have the MTVM exit with an error if the flag for processHasThreadAffinity is not set, instead of testing it everywhere. Hence get rid of willNotThreadWarnCount, and avoid testing processHasThreadAffinity except once at startup. Commit the plumbing for processHasOSErr which will be tested by the FFI to collect errno/GetLastError immediately after any FFI call, eliminating the possibility of preemtion between call and error fetch if implemented at the image level. Move InterpreterPrimitives>>{primitiveFailForFFIException:at:,primitiveInvokeObjectAsMethod,primitiveMethod} from InterpreterPrimitives to StackInterpreterPrimitives/StackInterpreter, which allows moving messageSelector and newMethod down to StackInterpreter which is a better place for them. Make the logging into ownerLog in CogThreadManager conditional, controlled by the global enableOwnerLog. Cogit: Rename compileAbstractInstructionsFrom:through: to what it does, compileBytecodesFrom:through:
1 parent 56c571a commit a51d41c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+19402
-17735
lines changed

platforms/Cross/vm/sq.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,10 @@ sqInt success(sqInt);
218218

219219
extern VM_EXPORT void *displayBits;
220220
extern VM_EXPORT int displayWidth, displayHeight, displayDepth;
221-
extern VM_EXPORT sqInt sendWheelEvents;
221+
#if !defined(SQ_USE_GLOBAL_STRUCT) // In the interpreter this is not const
222+
extern VM_EXPORT const sqInt imageHeaderFlags;
223+
#define sendWheelEvents() (imageHeaderFlags & 0x80)
224+
#endif
222225

223226
sqInt ioBeep(void);
224227
sqInt ioExit(void);

platforms/Cross/vm/sqVirtualMachine.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ struct VirtualMachine* sqGetInterpreterProxy(void)
379379
VM->isWordsOrShorts = isWordsOrShorts;
380380
VM->bytesPerElement = bytesPerElement;
381381
VM->fileTimesInUTC = fileTimesInUTC;
382+
VM->processHasOSErr = processHasOSErr;
382383
#endif
383384
return VM;
384385
}

platforms/Cross/vm/sqVirtualMachine.h

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,20 @@
77
#include "interp.h"
88

99
#if SPURVM
10-
# define VM_VERSION "7.0rc2"
10+
# define VM_VERSION "7.0"
1111
#else
12-
# define VM_VERSION "4.7rc2"
12+
# define VM_VERSION "4.7"
1313
#endif
1414

15+
// Functions extending the original struct VirtualMachine are guarded by VM_PROXY_MINOR below
16+
// We want to clean-up and simplify with VM_PROXY_MAJOR -> 2 asap.
17+
// VM_PROXY_MAJOR & VM_PROXY_MINOR are properly defined in interp.h
18+
1519
#ifndef VM_PROXY_MAJOR
16-
/* Increment the following number if you change the order of
17-
functions listed or if you remove functions */
1820
# define VM_PROXY_MAJOR 1
1921
#endif
20-
2122
#ifndef VM_PROXY_MINOR
22-
/* Increment the following number if you add functions at the end */
23-
# if SPURVM
24-
# define VM_PROXY_MINOR 13
25-
# else
26-
# define VM_PROXY_MINOR 12
27-
# endif
23+
# define VM_PROXY_MINOR 12
2824
#endif
2925

3026
#include "sqMemoryAccess.h"
@@ -384,6 +380,7 @@ typedef struct VirtualMachine {
384380
sqInt (*isWordsOrShorts)(sqInt oop); /* for SoundPlugin et al */
385381
sqInt (*bytesPerElement)(sqInt oop); /* for SocketPugin et al */
386382
sqInt (*fileTimesInUTC)(void); /* for FilePlugin et al */
383+
sqInt (*processHasOSErr)(void); /* for ThreadedFFIPlugin/SqueakFFIPrims */
387384
#endif
388385
} VirtualMachine;
389386

@@ -610,6 +607,7 @@ sqInt identityHashOf(sqInt);
610607
sqInt isWordsOrShorts(sqInt);
611608
sqInt bytesPerElement(sqInt);
612609
sqInt fileTimesInUTC(void);
610+
sqInt processHasOSErr(void);
613611
sqInt primitiveFailForwithSecondary(sqInt reasonCode,sqLong extraErrorCode);
614612
#endif
615613

platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ - (void) recordWheelEvent:(NSEvent *) theEvent fromView: (NSView <sqSqueakOSXVie
377377
prevYDelta = ( now - prevYTime < 500) ? prevYDelta + yDelta : yDelta;
378378
prevYTime = now;
379379
}
380-
if (sendWheelEvents) {
380+
if (sendWheelEvents()) {
381381
float limit = 20;
382382
if (-limit < prevXDelta && prevXDelta < limit && -limit < prevYDelta && prevYDelta < limit ) return;
383383
sqMouseEvent evt;

platforms/unix/vm-display-X11/sqUnixX11.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3495,7 +3495,6 @@ static const char *
34953495
nameForKeyboardEvent(XEvent *evt) { return nameForKeycode(evt->xkey.keycode); }
34963496
#endif /* DEBUG_EVENTS */
34973497

3498-
extern sqInt sendWheelEvents; /* If true deliver EventTypeMouseWheel else kybd */
34993498
/* if sendWheelEvents is false this maps wheel events to arrow keys */
35003499
static int mouseWheel2Squeak[4] = {30, 31, 28, 29};
35013500
/* if sendWheelEvents is true this determines how much x & y are incremented */
@@ -3634,7 +3633,7 @@ handleEvent(XEvent *evt)
36343633
recordMouseEvent();
36353634
}
36363635
else if (evt->xbutton.button <= 7) { /* mouse wheel */
3637-
if (sendWheelEvents)
3636+
if (sendWheelEvents())
36383637
recordMouseWheelEvent(mouseWheelXDelta[evt->xbutton.button - 4],
36393638
mouseWheelYDelta[evt->xbutton.button - 4]);
36403639
else if (evt->xbutton.button <= 5) { /* only emulate up/down, as left/right

platforms/unix/vm-display-fbdev/sqUnixEvdevKeyMouse.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@
5151
/* #include <X11/keysym.h> * /usr/include/X11/keysym.h */
5252
#include <libevdev-1.0/libevdev/libevdev.h> /* /usr/include/libevdev-1.0/libevdev/libevdev.h */
5353

54-
extern sqInt sendWheelEvents; /* If true deliver EventTypeMouseWheel else kybd */
55-
5654
#ifndef input_event_sec
5755
#define input_event_sec time.tv_sec
5856
#define input_event_usec time.tv_usec
@@ -642,7 +640,7 @@ static void processLibEvdevMouseEvents() {
642640
#ifdef DEBUG_EVENTS
643641
DPRINTF("EVDEV Wheel value: %d\n", value);
644642
#endif
645-
if (sendWheelEvents) {
643+
if (sendWheelEvents()) {
646644
recordMouseWheelEvent( 0, value ); /* delta-y only */
647645
} else { /* Send wheel events as arrow up/down */
648646
if (value > -1) {

platforms/win32/vm/sqWin32Window.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ void setFullScreenFlag(sqInt);
7171
sqInt getSavedWindowSize(void);
7272
extern sqInt deferDisplayUpdates;
7373

74-
extern sqInt sendWheelEvents; /* If true deliver EventTypeMouseWheel else kybd */
75-
/* if sendWheelEvents is false this maps wheel events to arrow keys */
76-
7774
/*** Variables -- image and path names ***/
7875
#define IMAGE_NAME_SIZE MAX_PATH_UTF8
7976

@@ -383,7 +380,7 @@ MainWndProcW(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
383380
mousePosition.y = GET_Y_LPARAM(lParam);
384381
break;
385382
case WM_MOUSEHWHEEL: {
386-
if (inputSemaphoreIndex && sendWheelEvents) {
383+
if (inputSemaphoreIndex && sendWheelEvents()) {
387384
int zDelta = GET_WHEEL_DELTA_WPARAM(wParam);
388385
/* accumulate enough delta before sending the event to the image */
389386
int limit = WHEEL_DELTA / 6; /* threshold for delivering events */
@@ -413,7 +410,7 @@ MainWndProcW(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
413410
zDelta = vWheelDelta;
414411
vWheelDelta = 0;
415412
if (inputSemaphoreIndex) {
416-
if (sendWheelEvents) {
413+
if (sendWheelEvents()) {
417414
recordMouseWheelEvent(messageTouse,0,zDelta);
418415
break;
419416
} else {

src/plugins/VectorEnginePlugin/VectorEnginePlugin.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* Automatically generated by
2-
SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3668 uuid: d0a2c840-707b-457e-9ff3-c455828ac41c
3-
(Compiler-eem.523)
2+
SmartSyntaxPluginCodeGenerator VMMaker.oscog-eem.3690 uuid: b8fa6d9a-c8b4-4de4-9ecb-3bbc0d42fc4c
3+
(Compiler-eem.526)
44
from
5-
VectorEnginePlugin VectorEnginePlugin-eem.22 uuid: b78f39f5-368d-4cba-99a5-399c4ffe554c
5+
VectorEnginePlugin VectorEnginePlugin-jmv.23 uuid: 616c8d53-d834-4d11-a3b1-84e977cae8ca
66
*/
7-
static char __buildInfo[] = "VectorEnginePlugin VectorEnginePlugin-eem.22 uuid: b78f39f5-368d-4cba-99a5-399c4ffe554c " __DATE__ ;
7+
static char __buildInfo[] = "VectorEnginePlugin VectorEnginePlugin-jmv.23 uuid: 616c8d53-d834-4d11-a3b1-84e977cae8ca " __DATE__ ;
88

99

1010
#include "config.h"
@@ -171,7 +171,7 @@ extern sqInt stackValue(sqInt offset);
171171
extern
172172
#endif
173173
struct VirtualMachine* interpreterProxy;
174-
static const char *moduleName = "VectorEnginePlugin VectorEnginePlugin-eem.22 " INT_EXT;
174+
static const char *moduleName = "VectorEnginePlugin VectorEnginePlugin-jmv.23 " INT_EXT;
175175
static uint32_t * morphIds;
176176
static sqInt needsFullAlphaCircle;
177177
static sqInt prevYRounded;

src/spur32.cog.lowcode/cogit.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Automatically generated by
2-
CCodeGenerator VMMaker.oscog-eem.3680 uuid: a9ad06c5-1c8d-4efc-b2a6-1516f7d64803
3-
(Cog-eem.504, * Compiler-nice.525)
2+
CCodeGenerator VMMaker.oscog-eem.3690 uuid: b8fa6d9a-c8b4-4de4-9ecb-3bbc0d42fc4c
3+
(Cog-eem.504, Compiler-eem.526)
44
*/
55

66

0 commit comments

Comments
 (0)