[Vm-dev] VM Maker: VMMaker-dtl.302.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Mar 9 15:08:12 UTC 2013
David T. Lewis uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker-dtl.302.mcz
==================== Summary ====================
Name: VMMaker-dtl.302
Author: dtl
Time: 9 March 2013, 10:04:04.23 am
UUID: 4429f2bf-efd9-4ad1-b426-6625fea1d942
Ancestors: VMMaker-dtl.301
VMMaker 4.10.13
A WordArray parameter in the parameter list of a primitive declaration should be declared as (unsigned *) not (usqInt *) in the generated C code. Fix WordArray class>>ccgDeclareCForVar: code generation and provide a unit test.
Also remove redundant type declaration in HostWindowPlugin>>primitiveShowHostWindow:bits:width:height:depth:left:right:top:bottom: which was an ineffective attempt to work around the code generation bug.
=============== Diff against VMMaker-dtl.301 ===============
Item was changed:
----- Method: HostWindowPlugin>>primitiveShowHostWindow:bits:width:height:depth:left:right:top:bottom: (in category 'system primitives') -----
primitiveShowHostWindow: windowIndex bits: dispBits width: w height: h depth: d
left: left right: right top: top bottom: bottom
"Host window analogue of DisplayScreen> primShowRectLeft:right:top:bottom:
(Interpreter>primitiveShowDisplayRect) which takes the window index, bitmap
details and the rectangle bounds. Fail if the windowIndex is invalid or the
platform routine returns false to indicate failure"
|ok|
- self var: #dispBits type: 'unsigned char * '.
self primitive: 'primitiveShowHostWindowRect'
parameters: #(SmallInteger WordArray SmallInteger SmallInteger SmallInteger
SmallInteger SmallInteger SmallInteger SmallInteger).
"Tell the vm to copy pixel's from dispBits to the screen - this is just
ioShowDisplay with the extra parameter of the windowIndex integer"
ok := self cCode: 'ioShowDisplayOnWindow(dispBits, w, h, d, left, right, top,
bottom, windowIndex)'.
ok ifFalse:[interpreterProxy primitiveFail]!
Item was added:
+ ----- Method: SlangTest>>testSmartSyntaxParameterDeclaration (in category 'testing smart syntax') -----
+ testSmartSyntaxParameterDeclaration
+ "(SlangTest selector: #testSmartSyntaxParameterDeclaration) run"
+
+ | s |
+ s := (SlangTestSupportSmartSyntaxInterpreterPlugin
+ asInlinedCString: #declareInt:wordPointer: ).
+ "parameter taken from the stack should be cast to (unsigned *)"
+ self should: ['*pointerToWords = ((unsigned **) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(0))));*' match: s].
+ "local variable declaration should match the data type as in the cast"
+ self shouldnt: ['*usqInt **pointerToWords*' match: s]. "the buggy code generator renders it as 'usqInt *pointerToWords' "
+ self should: ['*unsigned **pointerToWords*' match: s]. "it should be rendered as 'unsigned *pointerToWords' "
+ !
Item was added:
+ SmartSyntaxInterpreterPlugin subclass: #SlangTestSupportSmartSyntaxInterpreterPlugin
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'VMMaker-Tests'!
Item was added:
+ ----- Method: SlangTestSupportSmartSyntaxInterpreterPlugin>>declareInt:wordPointer: (in category 'parameter declarations') -----
+ declareInt: anInt wordPointer: pointerToWords
+ "The pointerToWords parameter should be (unsigned *) as a result of the WordArray
+ declaration in primitive:parameters: and the local declaration for pointerToWords should
+ match this data type. For buggy code generator this is not the case."
+
+ self var: #pointerToWords type: 'unsigned char * '. "intentional red herring, no effect"
+ self primitive: 'primitiveShowHostWindowRect' parameters: #(SmallInteger WordArray).
+
+ "Incorrect output, demonstrating code generator bug:
+
+ EXPORT(sqInt) primitiveShowHostWindowRect(void) {
+ sqInt anInt;
+ usqInt *pointerToWords;
+
+ anInt = interpreterProxy->stackIntegerValue(1);
+ interpreterProxy->success(interpreterProxy->isWords(interpreterProxy->stackValue(0)));
+ pointerToWords = ((unsigned *) (interpreterProxy->firstIndexableField(interpreterProxy->stackValue(0))));
+ if (interpreterProxy->failed()) {
+ return null;
+ }
+ if (interpreterProxy->failed()) {
+ return null;
+ }
+ interpreterProxy->pop(2);
+ return null;
+ }
+ "!
Item was changed:
----- Method: VMMaker class>>versionString (in category 'version testing') -----
versionString
"VMMaker versionString"
+ ^'4.10.13'!
- ^'4.10.12'!
Item was changed:
----- Method: WordArray class>>ccgDeclareCForVar: (in category '*VMMaker-plugin generation') -----
ccgDeclareCForVar: aSymbolOrString
+ "Address of an unsigned 32 bit value, regardless of Smalltalk wordSize"
+ ^'unsigned *', aSymbolOrString!
- ^'usqInt *', aSymbolOrString!
More information about the Vm-dev
mailing list