11/* Automatically generated by
2- VMPluginCodeGenerator VMMaker.oscog-eem.2826 uuid: 0dd1c326-6391-497c-896b-b605178640de
2+ VMPluginCodeGenerator VMMaker.oscog-eem.2830 uuid: b30cd73c-7118-461b-9d8a-1c523c6aa011
33 from
4- IA32ABIPlugin VMMaker.oscog-eem.2826 uuid: 0dd1c326-6391-497c-896b-b605178640de
4+ IA32ABIPlugin VMMaker.oscog-eem.2830 uuid: b30cd73c-7118-461b-9d8a-1c523c6aa011
55 */
6- static char __buildInfo [] = "IA32ABIPlugin VMMaker.oscog-eem.2826 uuid: 0dd1c326-6391-497c-896b-b605178640de " __DATE__ ;
6+ static char __buildInfo [] = "IA32ABIPlugin VMMaker.oscog-eem.2830 uuid: b30cd73c-7118-461b-9d8a-1c523c6aa011 " __DATE__ ;
77
88
99
@@ -74,6 +74,7 @@ static sqInt indexlengthinRange(sqInt byteIndex, sqInt length, sqInt rcvr);
7474EXPORT (sqInt ) isAlien (sqInt anOop );
7575EXPORT (sqInt ) primAddressField (void );
7676EXPORT (sqInt ) primAddressFieldPut (void );
77+ EXPORT (sqInt ) primAlienCopyInto (void );
7778EXPORT (sqInt ) primAlienReplace (void );
7879EXPORT (sqInt ) primAllocateExecutablePage (void );
7980EXPORT (sqInt ) primBoxedFree (void );
@@ -193,6 +194,9 @@ static sqInt (*isOopImmutable)(sqInt oop);
193194#endif /* IMMUTABILITY */
194195static sqInt (* isWordsOrBytes )(sqInt oop );
195196static sqInt (* methodArgumentCount )(void );
197+ static sqInt (* methodReturnFloat )(double aFloat );
198+ static sqInt (* methodReturnInteger )(sqInt integer );
199+ static sqInt (* methodReturnReceiver )(void );
196200static sqInt (* methodReturnValue )(sqInt oop );
197201static sqInt (* pop )(sqInt nItems );
198202static sqInt (* popthenPush )(sqInt nItems , sqInt oop );
@@ -202,7 +206,6 @@ static sqInt (*positive64BitIntegerFor)(usqLong integerValue);
202206static usqLong (* positive64BitValueOf )(sqInt oop );
203207static usqIntptr_t (* positiveMachineIntegerValueOf )(sqInt oop );
204208static sqInt (* primitiveFailFor )(sqInt reasonCode );
205- static sqInt (* pushFloat )(double f );
206209static sqInt (* returnAsThroughCallbackContext )(sqInt returnTypeOop , VMCallbackContext * vmCallbackContext , sqInt callbackMethodContext );
207210static sqInt (* signalNoResume )(sqInt aSemaphore );
208211static sqInt (* signed32BitIntegerFor )(sqInt integerValue );
@@ -254,6 +257,9 @@ extern sqInt isOopImmutable(sqInt oop);
254257#endif
255258extern sqInt isWordsOrBytes (sqInt oop );
256259extern sqInt methodArgumentCount (void );
260+ extern sqInt methodReturnFloat (double aFloat );
261+ extern sqInt methodReturnInteger (sqInt integer );
262+ extern sqInt methodReturnReceiver (void );
257263extern sqInt methodReturnValue (sqInt oop );
258264extern sqInt pop (sqInt nItems );
259265extern sqInt popthenPush (sqInt nItems , sqInt oop );
@@ -263,7 +269,6 @@ extern sqInt positive64BitIntegerFor(usqLong integerValue);
263269extern usqLong positive64BitValueOf (sqInt oop );
264270extern usqIntptr_t positiveMachineIntegerValueOf (sqInt oop );
265271extern sqInt primitiveFailFor (sqInt reasonCode );
266- extern sqInt pushFloat (double f );
267272extern sqInt returnAsThroughCallbackContext (sqInt returnTypeOop , VMCallbackContext * vmCallbackContext , sqInt callbackMethodContext );
268273extern sqInt signalNoResume (sqInt aSemaphore );
269274extern sqInt signed32BitIntegerFor (sqInt integerValue );
@@ -280,7 +285,7 @@ extern sqInt trueObject(void);
280285extern
281286#endif
282287struct VirtualMachine * interpreterProxy ;
283- static const char * moduleName = "IA32ABI VMMaker.oscog-eem.2826 " INT_EXT ;
288+ static const char * moduleName = "IA32ABI VMMaker.oscog-eem.2830 " INT_EXT ;
284289
285290
286291
@@ -343,15 +348,12 @@ primAddressField(void)
343348{
344349 sqInt rcvr ;
345350 sqInt value ;
346- sqInt valueOop ;
347351
348352 rcvr = stackValue (0 );
349353 value = longAt ((rcvr + BaseHeaderSize ) + BytesPerOop );
350- /* begin positiveMachineIntegerFor: */
351- valueOop = (BytesPerWord == 8
354+ return methodReturnValue ((BytesPerWord == 8
352355 ? positive64BitIntegerFor (value )
353- : positive32BitIntegerFor (value ));
354- return methodReturnValue (valueOop );
356+ : positive32BitIntegerFor (value )));
355357}
356358
357359
@@ -383,6 +385,81 @@ primAddressFieldPut(void)
383385}
384386
385387
388+ /* Copy some number of bytes from the receiver starting at the first index
389+ into some destination
390+ object starting at the second index. The destination may be an Aliens or a
391+ bit-indexable object.
392+ The primitive will have the following signature:
393+ <Alien>
394+ primCopyFrom: start <Integer>
395+ to: stop <Integer>
396+ into: destination <Alien | indexableByteSubclass et al>
397+ startingAt: destStart <Integer> ^<self>
398+ <primitive: 'primitiveAlienReplace' error: errorCode module: 'IA32ABI'>
399+ */
400+
401+ /* IA32ABIPlugin>>#primAlienCopyInto */
402+ EXPORT (sqInt )
403+ primAlienCopyInto (void )
404+ {
405+ sqInt alien ;
406+ sqInt dest ;
407+ sqInt destAddr ;
408+ sqInt destStart ;
409+ sqInt myLength ;
410+ sqInt src ;
411+ sqInt start ;
412+ sqInt stop ;
413+ sqInt totalLength ;
414+
415+
416+ /* Unchecked! */
417+ alien = stackValue (4 );
418+ start = stackIntegerValue (3 );
419+ stop = stackIntegerValue (2 );
420+ dest = stackValue (1 );
421+ destStart = stackIntegerValue (0 );
422+ if ((failed ())
423+ || (!(isWordsOrBytes (dest )))) {
424+ return primitiveFailFor (PrimErrBadArgument );
425+ }
426+ myLength = longAt (alien + BaseHeaderSize );
427+ src = (((myLength > 0
428+ ? (alien + BaseHeaderSize ) + BytesPerOop
429+ : longAt ((alien + BaseHeaderSize ) + BytesPerOop ))) + start ) - 1 ;
430+ if (includesBehaviorThatOf (fetchClassOf (dest ), classAlien ())) {
431+ totalLength = longAt (dest + BaseHeaderSize );
432+ destAddr = (((totalLength > 0
433+ ? (dest + BaseHeaderSize ) + BytesPerOop
434+ : longAt ((dest + BaseHeaderSize ) + BytesPerOop ))) + start ) - 1 ;
435+ if (totalLength == 0 ) {
436+
437+ /* no bounds checks for zero-sized (pointer) Aliens */
438+ totalLength = stop ;
439+ }
440+ else {
441+ totalLength = SQABS (totalLength );
442+ }
443+ }
444+ else {
445+ totalLength = byteSizeOf (dest );
446+ destAddr = ((dest + BaseHeaderSize ) + start ) - 1 ;
447+ }
448+ if (!(((start >= 1 )
449+ && (((start - 1 ) <= stop )
450+ && (stop <= (SQABS (myLength )))))
451+ && (((stop - start ) + 1 ) <= totalLength ))) {
452+ return primitiveFailFor (PrimErrBadIndex );
453+ }
454+ if (isOopImmutable (dest )) {
455+ return primitiveFailFor (PrimErrNoModification );
456+ }
457+ memmove (((void * )destAddr ), ((void * )src ), (stop - start ) + 1 );
458+ methodReturnReceiver ();
459+ return 0 ;
460+ }
461+
462+
386463/* Copy some number of bytes from some source object starting at the index
387464 into the receiver destination object from startIndex to stopIndex. The
388465 source and destination may be Aliens or byte-indexable objects. The
@@ -408,7 +485,6 @@ EXPORT(sqInt)
408485primAlienReplace (void )
409486{
410487 sqInt array ;
411- sqInt count ;
412488 sqInt dest ;
413489 sqInt repl ;
414490 sqInt replStart ;
@@ -485,9 +561,8 @@ primAlienReplace(void)
485561 if (isOopImmutable (array )) {
486562 return primitiveFailFor (PrimErrNoModification );
487563 }
488- count = (stop - start ) + 1 ;
489- memmove (((void * )dest ), ((void * )src ), count );
490- pop (methodArgumentCount ());
564+ memmove (((void * )dest ), ((void * )src ), (stop - start ) + 1 );
565+ methodReturnReceiver ();
491566 return 0 ;
492567}
493568
@@ -551,7 +626,7 @@ primBoxedFree(void)
551626 || (isInMemory (addr )))) {
552627 return primitiveFailFor (PrimErrInappropriate );
553628 }
554- free ((void * )addr );
629+ free ((( void * )addr ) );
555630 ptr [0 ] = 0 ;
556631 ptr [1 ] = 0 ;
557632 return 0 ;
@@ -754,8 +829,8 @@ primDoubleAt(void)
754829 }
755830 addr = startAddr + byteOffset ;
756831 memcpy ((& floatValue ), addr , sizeof (floatValue ));
757- pop ( 2 );
758- return pushFloat ( floatValue ) ;
832+ methodReturnFloat ( floatValue );
833+ return 0 ;
759834}
760835
761836
@@ -846,8 +921,8 @@ primFloatAt(void)
846921 }
847922 addr = startAddr + byteOffset ;
848923 memcpy ((& floatValue ), addr , sizeof (floatValue ));
849- pop ( 2 );
850- return pushFloat ( floatValue ) ;
924+ methodReturnFloat ( floatValue );
925+ return 0 ;
851926}
852927
853928
@@ -916,7 +991,7 @@ primFree(void)
916991 || (isInMemory (addr ))) {
917992 return primitiveFailFor (PrimErrInappropriate );
918993 }
919- free ((void * )addr );
994+ free ((( void * )addr ) );
920995 pop (1 );
921996 return 0 ;
922997}
@@ -1615,7 +1690,8 @@ primStrlenFromStartIndex(void)
16151690 index += 1 ;
16161691 }
16171692 }
1618- return methodReturnValue (positive32BitIntegerFor (index ));
1693+ methodReturnInteger (index );
1694+ return 0 ;
16191695}
16201696
16211697
@@ -1632,7 +1708,6 @@ primStrlenThroughPointerAtIndex(void)
16321708{
16331709 usqIntptr_t addr ;
16341710 usqIntptr_t byteOffset ;
1635- char * ptr ;
16361711 sqInt rcvr ;
16371712
16381713 byteOffset = (stackPositiveMachineIntegerValue (0 )) - 1 ;
@@ -1646,8 +1721,7 @@ primStrlenThroughPointerAtIndex(void)
16461721 addr = (((longAt (rcvr + BaseHeaderSize )) > 0
16471722 ? (rcvr + BaseHeaderSize ) + BytesPerOop
16481723 : longAt ((rcvr + BaseHeaderSize ) + BytesPerOop ))) + byteOffset ;
1649- ptr = ((char * ) (longAt (addr )));
1650- return methodReturnValue (positive32BitIntegerFor (strlen (ptr )));
1724+ return methodReturnInteger (strlen (((char * ) (longAt (addr )))));
16511725}
16521726
16531727
@@ -2245,6 +2319,9 @@ setInterpreter(struct VirtualMachine *anInterpreter)
22452319#endif
22462320 isWordsOrBytes = interpreterProxy -> isWordsOrBytes ;
22472321 methodArgumentCount = interpreterProxy -> methodArgumentCount ;
2322+ methodReturnFloat = interpreterProxy -> methodReturnFloat ;
2323+ methodReturnInteger = interpreterProxy -> methodReturnInteger ;
2324+ methodReturnReceiver = interpreterProxy -> methodReturnReceiver ;
22482325 methodReturnValue = interpreterProxy -> methodReturnValue ;
22492326 pop = interpreterProxy -> pop ;
22502327 popthenPush = interpreterProxy -> popthenPush ;
@@ -2254,7 +2331,6 @@ setInterpreter(struct VirtualMachine *anInterpreter)
22542331 positive64BitValueOf = interpreterProxy -> positive64BitValueOf ;
22552332 positiveMachineIntegerValueOf = interpreterProxy -> positiveMachineIntegerValueOf ;
22562333 primitiveFailFor = interpreterProxy -> primitiveFailFor ;
2257- pushFloat = interpreterProxy -> pushFloat ;
22582334 returnAsThroughCallbackContext = interpreterProxy -> returnAsThroughCallbackContext ;
22592335 signalNoResume = interpreterProxy -> signalNoResume ;
22602336 signed32BitIntegerFor = interpreterProxy -> signed32BitIntegerFor ;
@@ -2335,6 +2411,7 @@ void* IA32ABI_exports[][3] = {
23352411 {(void * )_m , "isAlien" , (void * )isAlien },
23362412 {(void * )_m , "primAddressField\000\000" , (void * )primAddressField },
23372413 {(void * )_m , "primAddressFieldPut\000\000" , (void * )primAddressFieldPut },
2414+ {(void * )_m , "primAlienCopyInto\000\000" , (void * )primAlienCopyInto },
23382415 {(void * )_m , "primAlienReplace\000\000" , (void * )primAlienReplace },
23392416 {(void * )_m , "primAllocateExecutablePage\000\377" , (void * )primAllocateExecutablePage },
23402417 {(void * )_m , "primBoxedFree\000\001" , (void * )primBoxedFree },
@@ -2390,6 +2467,7 @@ void* IA32ABI_exports[][3] = {
23902467
23912468signed char primAddressFieldAccessorDepth = 0 ;
23922469signed char primAddressFieldPutAccessorDepth = 0 ;
2470+ signed char primAlienCopyIntoAccessorDepth = 0 ;
23932471signed char primAlienReplaceAccessorDepth = 0 ;
23942472signed char primBoxedFreeAccessorDepth = 1 ;
23952473signed char primCallOutDoubleReturnAccessorDepth = 0 ;
0 commit comments