opensmalltalk-vm icon indicating copy to clipboard operation
opensmalltalk-vm copied to clipboard

Windows VM import lib needs to be distributed with VM, and interp.c needs to export less

Open eliotmiranda opened this issue 5 years ago • 0 comments

We use sqVirtualMachine.c/h as a poor-mans cross-platform reverse export facility, allowing shared objects o access facilities exported by the VM. None of this is strictly necessary; all platforms providing shared objects (that I'm aware of) allow for an executable to export symbols and have these linked into a shared object built to be loaded by that executable. That said, there's no need to reengineer plugins. We can keep the existing structure.

However, the VM still exports API not covered in sqVirtualMachine. In particular the pre-alien callback machinery, error and warning(at) are exported not thrugh sqVirtualMachine (although in desperation a few months ago I put error in there; it can be taken back out).

On Windows the mechanism is to link a dll with the import lib of the main executable, e.g. Squeak.lib. SO to be able to build external plugins against the VM without having to build one's own VM, one needs that import lib. Therefore Squeak.lib should be distributed with the VM release.

Again, however, Squeak.lib has many symbols that don't need to be exported. Here are the primitives that (AFAICT) have no business being exported:

0000000000000000 T primitiveAddLargeIntegers 0000000000000000 T primitiveAllInstances 0000000000000000 T primitiveAllObjects 0000000000000000 T primitiveBitAndLargeIntegers 0000000000000000 T primitiveBitOrLargeIntegers 0000000000000000 T primitiveBitShiftLargeIntegers 0000000000000000 T primitiveBitXorLargeIntegers 0000000000000000 T primitiveClockLogAddresses 0000000000000000 T primitiveCompareBytes 0000000000000000 T primitiveCompareWith 0000000000000000 T primitiveCrashVM 0000000000000000 T primitiveDisablePowerManager 0000000000000000 T primitiveDivLargeIntegers 0000000000000000 T primitiveDivideLargeIntegers 0000000000000000 T primitiveDnsInfo 0000000000000000 T primitiveEqualLargeIntegers 0000000000000000 T primitiveEventProcessingControl 0000000000000000 T primitiveGetLogDirectory 0000000000000000 T primitiveGetWindowLabel 0000000000000000 T primitiveGetWindowSize 0000000000000000 T primitiveGetenv 0000000000000000 T primitiveGreaterOrEqualLargeIntegers 0000000000000000 T primitiveGreaterThanLargeIntegers 0000000000000000 T primitiveHeartbeatFrequency 0000000000000000 T primitiveHighResClock 0000000000000000 T primitiveImageFormatVersion 0000000000000000 T primitiveInterruptChecksPerMSec 0000000000000000 T primitiveIsBigEnder 0000000000000000 T primitiveIsWindowObscured 0000000000000000 T primitiveLessOrEqualLargeIntegers 0000000000000000 T primitiveLessThanLargeIntegers 0000000000000000 T primitiveLongRunningPrimitive 0000000000000000 T primitiveLongRunningPrimitiveSemaphore 0000000000000000 T primitiveMethodPCData 0000000000000000 T primitiveMillisecondClockMask 0000000000000000 T primitiveMinimumUnusedHeadroom 0000000000000000 T primitiveModLargeIntegers 0000000000000000 T primitiveMultiplyLargeIntegers 0000000000000000 T primitiveNotEqualLargeIntegers 0000000000000000 T primitivePathToUsing 0000000000000000 T primitivePluginBrowserReady 0000000000000000 T primitivePluginDestroyRequest 0000000000000000 T primitivePluginPostURL 0000000000000000 T primitivePluginRequestFileHandle 0000000000000000 T primitivePluginRequestState 0000000000000000 T primitivePluginRequestURL 0000000000000000 T primitivePluginRequestURLStream 0000000000000000 T primitiveProfilePrimitive 0000000000000000 T primitiveProfileSample 0000000000000000 T primitiveProfileSemaphore 0000000000000000 T primitiveProfileStart 0000000000000000 T primitiveQuoLargeIntegers 0000000000000000 T primitiveRemLargeIntegers 0000000000000000 T primitiveScreenDepth 0000000000000000 T primitiveScreenScaleFactor 0000000000000000 T primitiveSetGCSemaphore 0000000000000000 T primitiveSetLogDirectory 0000000000000000 T primitiveSetWindowLabel 0000000000000000 T primitiveSetWindowSize 0000000000000000 T primitiveSubtractLargeIntegers 0000000000000000 T primitiveUtcWithOffset 0000000000000000 T primitiveVoidReceiver

So this issue is to note both that the VM import lib needs to be included in the distribution (thankfully the import lib for the Windows subsystem VM also works for the Console subsystem VM), and that the interpreter should export fewer symbols. The final list is something like

0000000000000000 T callbackEnter 0000000000000000 T callbackLeave 0000000000000000 T error 0000000000000000 T moduleUnloaded 0000000000000000 T reestablishContextPriorToCallback 0000000000000000 T returnAsThroughCallbackContext 0000000000000000 T segmentContainingObj 0000000000000000 T sendInvokeCallbackContext 0000000000000000 T sendInvokeCallbackStackRegistersJmpbuf 0000000000000000 T setInterruptCheckChain 0000000000000000 T statNumGCs 0000000000000000 T warning 0000000000000000 T warningat

eliotmiranda avatar Sep 28 '20 14:09 eliotmiranda