Skip to content

Commit

Permalink
CogVM source as per VMMaker.oscog-eem.2748
Browse files Browse the repository at this point in the history
Plugins: Add error to the VM proxy API, deleting obsoleteDontUseThisFetchWord:
ofObject:. obsoleteDontUseThisFetchWord:ofObject: has never been used by a
Cog/Stack VM plugin, and no plugin has sent erro up until now, so this is a
safe repurpose of an unused slot.

Have BalloonEngineBase>>errorWrongIndex use the VM proxy API's error.

Fix the path to cygwin in SETPATH.BAT to contain a drive letter; needed if
making e.g. on a network drive.

Fix the type of allocateExecutablePage's argument to agree with
primAllocateExecutablePage's byteSize var.

Placate Clang-cl somewhat by changing files in platforms/win32/vm to include
Windows.h rather than windows.h.
  • Loading branch information
eliotmiranda committed Apr 27, 2020
1 parent 99553e0 commit e36f650
Show file tree
Hide file tree
Showing 30 changed files with 46 additions and 35 deletions.
2 changes: 1 addition & 1 deletion build.win32x86/common/SETPATH.BAT
@@ -1 +1 @@
set PATH=%PATH%;\cygwin64\bin
set PATH=%PATH%;c:\cygwin64\bin
2 changes: 1 addition & 1 deletion build.win64x64/common/SETPATH.BAT
@@ -1 +1 @@
set PATH=%PATH%;\cygwin64\bin
set PATH=%PATH%;c:\cygwin64\bin
2 changes: 1 addition & 1 deletion platforms/Cross/plugins/IA32ABI/arm32abicc.c
Expand Up @@ -234,7 +234,7 @@ static unsigned long pagesize = 0;
#endif

void *
allocateExecutablePage(long *size)
allocateExecutablePage(sqIntptr_t *size)
{
void *mem;

Expand Down
2 changes: 1 addition & 1 deletion platforms/Cross/plugins/IA32ABI/arm64abicc.c
Expand Up @@ -272,7 +272,7 @@ static unsigned long pagesize = 0;
#endif

void *
allocateExecutablePage(long *size)
allocateExecutablePage(sqIntptr_t *size)
{
void *mem;

Expand Down
2 changes: 1 addition & 1 deletion platforms/Cross/plugins/IA32ABI/ia32abi.h
Expand Up @@ -63,6 +63,6 @@ extern sqInt callIA32DoubleReturn (SIGNATURE);
# define DBL_REG_ARGS double,double,double,double,double,double,double,double,
#endif
extern thunkEntryType thunkEntry (INT_REG_ARGS DBL_REG_ARGS void *,sqIntptr_t *);
extern void *allocateExecutablePage(long *pagesize);
extern void *allocateExecutablePage(sqIntptr_t *pagesize);
extern VMCallbackContext *getMostRecentCallbackContext(void);
#undef thunkEntryType
2 changes: 1 addition & 1 deletion platforms/Cross/plugins/IA32ABI/ia32abicc.c
Expand Up @@ -277,7 +277,7 @@ static unsigned long pagesize = 0;
#endif

void *
allocateExecutablePage(long *size)
allocateExecutablePage(sqIntptr_t *size)
{
void *mem;

Expand Down
2 changes: 1 addition & 1 deletion platforms/Cross/plugins/IA32ABI/ppc32abicc.c
Expand Up @@ -290,7 +290,7 @@ static unsigned long pagesize = 0;
#endif

void *
allocateExecutablePage(long *size)
allocateExecutablePage(sqIntptr_t *size)
{
void *mem;

Expand Down
2 changes: 1 addition & 1 deletion platforms/Cross/plugins/IA32ABI/x64sysvabicc.c
Expand Up @@ -257,7 +257,7 @@ static unsigned long pagesize = 0;
#endif

void *
allocateExecutablePage(long *size)
allocateExecutablePage(sqIntptr_t *size)
{
void *mem;

Expand Down
2 changes: 1 addition & 1 deletion platforms/Cross/plugins/IA32ABI/x64win64abicc.c
Expand Up @@ -268,7 +268,7 @@ static unsigned long pagesize = 0;
#endif

void *
allocateExecutablePage(long *size)
allocateExecutablePage(sqIntptr_t *size)
{
void *mem;

Expand Down
7 changes: 7 additions & 0 deletions platforms/Cross/vm/sqVirtualMachine.c
Expand Up @@ -34,6 +34,7 @@ sqInt fetchClassOf(sqInt oop);
double fetchFloatofObject(sqInt fieldIndex, sqInt objectPointer);
sqInt fetchIntegerofObject(sqInt fieldIndex, sqInt objectPointer);
sqInt fetchPointerofObject(sqInt index, sqInt oop);
#if OLD_FOR_REFERENCE /* slot repurposed for error */
/* sqInt fetchWordofObject(sqInt fieldIndex, sqInt oop); *
* has been rescinded as of VMMaker 3.8 and the 64bitclean VM *
* work. To support old plugins we keep a valid function in *
Expand All @@ -42,6 +43,7 @@ sqInt fetchPointerofObject(sqInt index, sqInt oop);
* equivalent but 64 bit valid function is added as *
* 'fetchLong32OfObject' */
sqInt obsoleteDontUseThisFetchWordofObject(sqInt index, sqInt oop);
#endif
sqInt fetchLong32ofObject(sqInt index, sqInt oop);
void *firstFixedField(sqInt oop);
void *firstIndexableField(sqInt oop);
Expand Down Expand Up @@ -155,6 +157,7 @@ sqInt getThisSessionID(void);
sqInt ioFilenamefromStringofLengthresolveAliases(char* aCharBuffer, char* filenameIndex, sqInt filenameLength, sqInt resolveFlag);
sqInt vmEndianness(void);
sqInt getInterruptPending(void);
void error(char *);

/* InterpreterProxy methodsFor: 'BitBlt support' */
sqInt loadBitBltFrom(sqInt bbOop);
Expand Down Expand Up @@ -323,7 +326,11 @@ struct VirtualMachine* sqGetInterpreterProxy(void)
VM->fetchIntegerofObject = fetchIntegerofObject;
#endif
VM->fetchPointerofObject = fetchPointerofObject;
#if OLD_FOR_REFERENCE /* slot repurposed for error */
VM->obsoleteDontUseThisFetchWordofObject = obsoleteDontUseThisFetchWordofObject;
#else
VM->error = error;
#endif
VM->firstFixedField = firstFixedField;
VM->firstIndexableField = firstIndexableField;
VM->literalofMethod = literalofMethod;
Expand Down
4 changes: 4 additions & 0 deletions platforms/Cross/vm/sqVirtualMachine.h
Expand Up @@ -91,6 +91,7 @@ typedef struct VirtualMachine {
double (*fetchFloatofObject)(sqInt fieldIndex, sqInt objectPointer);
sqInt (*fetchIntegerofObject)(sqInt fieldIndex, sqInt objectPointer);
sqInt (*fetchPointerofObject)(sqInt fieldIndex, sqInt oop);
#if OLD_FOR_REFERENCE
/* sqInt (*fetchWordofObject)(sqInt fieldFieldIndex, sqInt oop); *
* has been rescinded as of VMMaker 3.8 and the 64bitclean VM *
* work. To support old plugins we keep a valid function in *
Expand All @@ -99,6 +100,9 @@ typedef struct VirtualMachine {
* equivalent but 64 bit valid function is added as *
* 'fetchLong32OfObject' */
sqInt (*obsoleteDontUseThisFetchWordofObject)(sqInt fieldFieldIndex, sqInt oop);
#else /* since there is no legacy plugin problem back to 3.8 we repurpose... */
void (*error)(char *);
#endif
void *(*firstFixedField)(sqInt oop);
void *(*firstIndexableField)(sqInt oop);
sqInt (*literalofMethod)(sqInt offset, sqInt methodPointer);
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32Alloc.c
Expand Up @@ -8,7 +8,7 @@
* EMAIL: raab@isg.cs.uni-magdeburg.de
*
*****************************************************************************/
#include <windows.h>
#include <Windows.h>
#include "sq.h"

#if !defined(NO_VIRTUAL_MEMORY) && !SPURVM /* Spur uses sqWin32SpurAlloc.c */
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32Backtrace.c
Expand Up @@ -14,7 +14,7 @@
* Eliot Miranda, 7 january 2010.
*/

#include <windows.h>
#include <Windows.h>
#include <stdio.h>
#include <string.h>

Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32DirectInput.c
Expand Up @@ -30,7 +30,7 @@
#endif
#endif

#include <windows.h>
#include <Windows.h>
#include <ole2.h>
#include "sq.h"
#ifdef __MINGW32__
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32Directory.c
Expand Up @@ -12,7 +12,7 @@
* (Marcel Taeumel, Hasso Plattner Institute, Postdam, Germany)
*
*****************************************************************************/
#include <windows.h>
#include <Windows.h>

#include "sq.h"
#include "../plugins/FilePlugin/sqWin32File.h"
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32DnsInfo.c
@@ -1,5 +1,5 @@
/* sqWin32DnsInfo.c: Gathers DNS information on Windows */
#include <windows.h>
#include <Windows.h>
#include "sq.h"

extern struct VirtualMachine *interpreterProxy;
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32ExternalPrims.c
Expand Up @@ -11,7 +11,7 @@
* 1) Currently, we're looking for DLLs named either sample.dll or sample32.dll
*
*****************************************************************************/
#include <windows.h>
#include <Windows.h>
#include <stdio.h>
#include <assert.h>
#include "sq.h"
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32GUID.c
@@ -1,6 +1,6 @@
#define INITGUID

#include <windows.h>
#include <Windows.h>

#ifdef __MINGW32__
#define HMONITOR_DECLARED
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32Heartbeat.c
Expand Up @@ -10,7 +10,7 @@
*
*****************************************************************************/

#include <windows.h>
#include <Windows.h>
#include <mmsystem.h>

#include "sq.h"
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32Main.c
Expand Up @@ -11,7 +11,7 @@
* 1) When using this module the virtual machine MUST NOT be compiled
* with Unicode support.
*****************************************************************************/
#include <windows.h>
#include <Windows.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32PluginSupport.c
@@ -1,5 +1,5 @@
/* Plugin support primitives */
#include <windows.h>
#include <Windows.h>
#include "sq.h"
#include "../plugins/FilePlugin/FilePlugin.h"

Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32Prefs.c
Expand Up @@ -15,7 +15,7 @@ void TrackPrefsMenu(void) {}
void HandlePrefsMenu(int) {}
#else

#include <windows.h>
#include <Windows.h>
#include "sq.h"
#include "sqWin32Prefs.h"

Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32Service.c
Expand Up @@ -13,7 +13,7 @@
* HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\\RunServices
*
*****************************************************************************/
#include <windows.h>
#include <Windows.h>
#include "sq.h"

#ifndef NO_SERVICE
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32SpurAlloc.c
Expand Up @@ -8,7 +8,7 @@
*
*****************************************************************************/

#include <windows.h>
#include <Windows.h>
#include <errno.h>
#include "sq.h"

Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32Threads.c
Expand Up @@ -13,7 +13,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <limits.h>
#include <windows.h>
#include <Windows.h>

#define ForCOGMTVMImplementation 1

Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32Time.c
Expand Up @@ -4,7 +4,7 @@
* trunk sqWin32Window.c
*****************************************************************************/

#include <windows.h>
#include <Windows.h>

#include "sq.h"

Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32Utils.c
Expand Up @@ -8,7 +8,7 @@
* EMAIL: raab@isg.cs.uni-magdeburg.de
*
*****************************************************************************/
#include <windows.h>
#include <Windows.h>
#include <tchar.h>
#include <math.h>
#include "sq.h"
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32VMProfile.c
Expand Up @@ -11,7 +11,7 @@
*
*****************************************************************************/

#include <windows.h>
#include <Windows.h>
/* MSVC v6 == 1200 */
#if defined(_MSC_VER) && _MSC_VER > 0 && _MSC_VER < 1300
typedef DWORD *DWORD_PTR; /* ULONGLONG on 64-bit systems */
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32Window.c
Expand Up @@ -20,7 +20,7 @@
* Option -> Right ALT
*
*****************************************************************************/
#include <windows.h>
#include <Windows.h>
#include <windowsx.h>
#include <shellapi.h>
#include <commdlg.h>
Expand Down
16 changes: 8 additions & 8 deletions src/plugins/B2DPlugin/B2DPlugin.c
@@ -1,9 +1,9 @@
/* Automatically generated by
VMPluginCodeGenerator VMMaker.oscog-eem.2744 uuid: 0273a0b2-9293-4e5f-b9ff-546a7d6a8270
VMPluginCodeGenerator VMMaker.oscog-eem.2748 uuid: 76ab3da9-b0d6-4c09-9d55-9ac9d70f5ec3
from
BalloonEnginePlugin VMMaker.oscog-eem.2744 uuid: 0273a0b2-9293-4e5f-b9ff-546a7d6a8270
BalloonEnginePlugin VMMaker.oscog-eem.2748 uuid: 76ab3da9-b0d6-4c09-9d55-9ac9d70f5ec3
*/
static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.2744 uuid: 0273a0b2-9293-4e5f-b9ff-546a7d6a8270 " __DATE__ ;
static char __buildInfo[] = "BalloonEnginePlugin VMMaker.oscog-eem.2748 uuid: 76ab3da9-b0d6-4c09-9d55-9ac9d70f5ec3 " __DATE__ ;



Expand Down Expand Up @@ -747,6 +747,7 @@ static sqInt (*booleanValueOf)(sqInt obj);
static sqInt (*byteSizeOf)(sqInt oop);
static sqInt (*classBitmap)(void);
static sqInt (*classPoint)(void);
static void (*error)(char *aString);
static sqInt (*failed)(void);
static sqInt (*fetchClassOf)(sqInt oop);
static sqInt (*fetchIntegerofObject)(sqInt fieldIndex, sqInt objectPointer);
Expand Down Expand Up @@ -794,6 +795,7 @@ extern sqInt booleanValueOf(sqInt obj);
extern sqInt byteSizeOf(sqInt oop);
extern sqInt classBitmap(void);
extern sqInt classPoint(void);
extern void error(char *aString);
extern sqInt failed(void);
extern sqInt fetchClassOf(sqInt oop);
extern sqInt fetchIntegerofObject(sqInt fieldIndex, sqInt objectPointer);
Expand Down Expand Up @@ -844,7 +846,7 @@ extern
#endif
struct VirtualMachine* interpreterProxy;
static void * loadBBFn;
static const char *moduleName = "B2DPlugin VMMaker.oscog-eem.2744 " INT_EXT;
static const char *moduleName = "B2DPlugin VMMaker.oscog-eem.2748 " INT_EXT;
static int* objBuffer;
static sqInt objUsed;
static unsigned int* spanBuffer;
Expand Down Expand Up @@ -2937,14 +2939,11 @@ edgeZValueOfput(sqInt edge, sqInt value)
return objBuffer[edge + GEZValue] = value;
}


/* Ignore dispatch errors when translating to C
(since we have no entry point for #error in the VM proxy) */

/* BalloonEngineBase>>#errorWrongIndex */
static sqInt
errorWrongIndex(void)
{
error("BalloonEngine: Fatal dispatch error");
return 0;
}

Expand Down Expand Up @@ -12622,6 +12621,7 @@ setInterpreter(struct VirtualMachine *anInterpreter)
byteSizeOf = interpreterProxy->byteSizeOf;
classBitmap = interpreterProxy->classBitmap;
classPoint = interpreterProxy->classPoint;
error = interpreterProxy->error;
failed = interpreterProxy->failed;
fetchClassOf = interpreterProxy->fetchClassOf;
fetchIntegerofObject = interpreterProxy->fetchIntegerofObject;
Expand Down

0 comments on commit e36f650

Please sign in to comment.