-
Notifications
You must be signed in to change notification settings - Fork 0
/
OSVMPluginMaker.pck.st
1688 lines (1352 loc) · 59.9 KB
/
OSVMPluginMaker.pck.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'From Cuis 5.0 [latest update: #4191] on 26 June 2020 at 9:03:56 pm'!
'Description Slang based plugin maker for the OpenSmalltalk-VM (OSVM) on which Squeak, Pharo, Cuis, Newspeak implementations are currently running.
License: MIT'!
!provides: 'OSVMPluginMaker' 1 9!
!requires: 'Slang-C' 1 19 nil!
SystemOrganization addCategory: #OSVMPluginMaker!
!classDefinition: #OSVMBasicConstants category: #OSVMPluginMaker!
SharedPool subclass: #OSVMBasicConstants
instanceVariableNames: ''
classVariableNames: 'IMMUTABILITY PrimErrFFIException PrimErrNoMemory PrimErrOSError PrimErrOperationFailed PrimNoErr'
poolDictionaries: ''
category: 'OSVMPluginMaker'!
!classDefinition: 'OSVMBasicConstants class' category: #OSVMPluginMaker!
OSVMBasicConstants class
instanceVariableNames: ''!
!classDefinition: #OSVMPlugin category: #OSVMPluginMaker!
SlangPlugin subclass: #OSVMPlugin
instanceVariableNames: 'interpreterProxy'
classVariableNames: ''
poolDictionaries: ''
category: 'OSVMPluginMaker'!
!classDefinition: 'OSVMPlugin class' category: #OSVMPluginMaker!
OSVMPlugin class
instanceVariableNames: ''!
!classDefinition: #OSVMPluginHeaderBuilder category: #OSVMPluginMaker!
SlangObject subclass: #OSVMPluginHeaderBuilder
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'OSVMPluginMaker'!
!classDefinition: 'OSVMPluginHeaderBuilder class' category: #OSVMPluginMaker!
OSVMPluginHeaderBuilder class
instanceVariableNames: ''!
!classDefinition: #OSVMInterpreterProxy category: #OSVMPluginMaker!
Object subclass: #OSVMInterpreterProxy
instanceVariableNames: 'primFailCode remapBuffer stack method argumentCount bb thisSessionID osErrorCode exceptionPC systemAdapter'
classVariableNames: ''
poolDictionaries: 'OSVMBasicConstants'
category: 'OSVMPluginMaker'!
!classDefinition: 'OSVMInterpreterProxy class' category: #OSVMPluginMaker!
OSVMInterpreterProxy class
instanceVariableNames: ''!
!OSVMBasicConstants commentStamp: '<historical>' prior: 0!
I am a shared pool for basic constants upon which the VM as a whole depends.
self ensureClassPool.
self classPool declare: #BytesPerWord from: VMSqueakV3ObjectRepresentationConstants classPool.
self classPool declare: #BaseHeaderSize from: VMSqueakV3ObjectRepresentationConstants classPool
(ObjectMemory classPool keys select: [:k| k beginsWith: 'Byte']) do:
[:k| self classPool declare: k from: ObjectMemory classPool]!
!OSVMPlugin commentStamp: '<historical>' prior: 0!
Represents an external plugin for the opensmalltalk-vm on which Squeak, Pharo, Cuis and Newspeak are running on!
!OSVMPluginHeaderBuilder commentStamp: '<historical>' prior: 0!
This class is a builder for Opensmalltalk-VM plugin header files.!
!OSVMInterpreterProxy commentStamp: 'eem 8/24/2018 15:43' prior: 0!
This class should provide the definition of what interpreter support plugins need and can have access to. Note that the proxy related files platforms - Cross - vm - sqVirtualMachine.[ch] are kept under the git tree at http://www.github.com/opensmalltalk/vm.
The main use of the class is to support the vm simulator and the RSqueak VM, which implements as many primitives as possible in Smalltalk.!
!OSVMPlugin methodsFor: 'as yet unclassified' stamp: 'jpb 6/18/2020 20:52:47'!
getInterpreter
"Note: This is coded so that plugins can be run from Squeak."
<returnType: 'VirtualMachine *'>
^interpreterProxy! !
!OSVMPlugin methodsFor: 'as yet unclassified' stamp: 'jpb 6/20/2020 10:55:56'!
getModuleName
"Note: This is hardcoded so it can be run from Squeak.
The module name is used for validating a module *after*
it is loaded to check if it does really contain the module
we're thinking it contains. This is important!!"
<returnType: 'const char*'>
<export: true>
^'OSVMPlugin (e)'! !
!OSVMPlugin methodsFor: 'as yet unclassified' stamp: 'jpb 6/18/2020 20:55:34'!
setInterpreter: anInterpreter
"Note: This is coded so that is can be run from Squeak."
<export: true>
<var: #anInterpreter type: #'struct VirtualMachine*'>
interpreterProxy _ anInterpreter.
^true! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/26/2020 21:02:39'!
emit64BitAccessorsOn: writer
writer nextPutComment: '64-Bit Integer Accessor functions'.
writer nextPutLine: '#if VM_PROXY_MINOR > 4'.
writer nextPutLine: 'sqInt (*positive64BitIntegerFor)(usqLong integerValue);'.
writer nextPutLine: 'usqLong(*positive64BitValueOf)(sqInt oop);'.
writer nextPutLine: 'sqInt (*signed64BitIntegerFor)(sqLong integerValue);'.
writer nextPutLine: 'sqLong (*signed64BitValueOf)(sqInt oop);'.
writer nextPutLine: '#endif'.
writer newLine.! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/20/2020 17:27:45'!
emitBitBlitSupportOn: writer
| lines |
lines _ #(
'#if VM_PROXY_MINOR > 1'
'/* InterpreterProxy methodsFor: ''BitBlt support'' */'
'sqInt (*loadBitBltFrom)(sqInt bbOop);'
'sqInt (*copyBits)(void);'
'sqInt (*copyBitsFromtoat)(sqInt leftX, sqInt rightX, sqInt yValue);'
'#endif'
).
lines do: [:line | writer nextPutLine: line ].
writer newLine.! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/20/2020 17:27:10'!
emitCompilerHelpersOn: writer
| lines |
lines _ #(
'# if VM_PROXY_MINOR > 13'
'/* Reuse these now that Cog provides a production JIT. */'
'sqInt (*statNumGCs)(void);'
'sqInt (*stringForCString)(char *nullTerminatedCString);'
'# else'
'/* InterpreterProxy methodsFor: ''compiler'' */'
'CompilerHook *(*compilerHookVector)(void);'
'sqInt (*setCompilerInitialized)(sqInt initFlag);'
'# endif'
).
lines do: [ :line| writer nextPutLine: line ].
writer newLine.
! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/20/2020 16:30:41'!
emitConstantsOn: writer
"Writes certain constant constructs used by primitives"
writer nextPutLine: '#define VM_PROXY_MAJOR ' , self findProxyMajorVersion asString.
writer nextPutLine: '#define VM_PROXY_MINOR ' , self findProxyMinorVersion asString.
writer nextPutLine: '#define VM_WORD_SIZE ' , self findWordSize asString.
writer nextPutLine: '#define VM_PLATFORM_NAME "' , self findPlatformName , '"'.
writer nextPutLine: '#define VM_PLATFORM_PROCESSOR "' , self findPlatformSubtype , '"'.
writer nextPutLine: '#define VM_OS_VERSION "' , self findOSVersion , '"'.
writer nextPutLine: '#define VM_VERSION "' , self findVMVersion , '"'.
writer newLine.
self emitPrimitiveConstantsOn: writer.! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/20/2020 17:26:59'!
emitFFISupportOn: writer
|lines |
lines _ #(
'#if VM_PROXY_MINOR > 2'
'sqInt (*classLargeNegativeInteger)(void);'
'sqInt (*signed32BitIntegerFor)(sqInt integerValue);'
'int (*signed32BitValueOf)(sqInt oop);'
'sqInt (*includesBehaviorThatOf)(sqInt aClass, sqInt aSuperClass);'
'sqInt (*primitiveMethod)(void);'
).
lines do: [:line | writer nextPutLine: line ].
writer newLine.
lines _ #(
'/* InterpreterProxy methodsFor: ''FFI support'' */'
'sqInt (*classExternalAddress)(void);'
'sqInt (*classExternalData)(void);'
'sqInt (*classExternalFunction)(void);'
'sqInt (*classExternalLibrary)(void);'
'sqInt (*classExternalStructure)(void);'
'void *(*ioLoadModuleOfLength)(sqInt modIndex, sqInt modLength);'
'void *(*ioLoadSymbolOfLengthFromModule)(sqInt fnIndex, sqInt fnLength, sqInt handle);'
'sqInt (*isInMemory)(sqInt address);'
'#endif'
).
lines do: [:line | writer nextPutLine: line ].
writer newLine! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/19/2020 21:37:25'!
emitHeaderOn: writer
writer nextPutLine: '#ifndef OSVM_PLUGIN_H'.
writer nextPutLine: '#define OSVM_PLUGIN_H'.
writer enableAutoIndent.
self emitConstantsOn: writer.
writer newLine.
self emitTypedefsOn: writer.
writer newLine.
self emitInterpreterProxyStructOn: writer.
writer disableAutoIndent.
writer nextPutLine: '#endif'! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/6/2020 22:37:17'!
emitInstanceCreatersOn: writer
| lines |
writer nextPutComment: 'InterpreterProxy methodsFor: ''instance creation'''.
lines _ #(
'sqInt (*clone)(sqInt oop);'
'sqInt (*instantiateClassindexableSize)(sqInt classPointer, sqInt size);'
'sqInt (*makePointwithxValueyValue)(sqInt xValue, sqInt yValue);'
'sqInt (*popRemappableOop)(void);'
'sqInt (*pushRemappableOop)(sqInt oop);'
).
lines do: [:line | writer nextPutLine: line ].
writer newLine.! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/26/2020 21:02:14'!
emitInterpreterProxyStructOn: writer
writer nextPutLine: 'typedef struct VirtualMachine {'.
writer autoIndentBy: 2.
self emitVersionGettersOn: writer.
self emitStackAccessorsOn: writer.
self emitObjectAccessorsOn: writer.
self emitObjectTestersOn: writer.
self emitObjectConvertersOn: writer.
self emitSpecialObjectsOn: writer.
self emitSpecialClassesOn: writer.
self emitInstanceCreatersOn: writer.
self emitOtherHelpersOn: writer.
self emitCompilerHelpersOn: writer.
self emitBitBlitSupportOn: writer.
self emitFFISupportOn: writer.
self emit64BitAccessorsOn: writer.
writer autoIndentBy: 1.
writer nextPutLine: '} VirtualMachine;'.! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/6/2020 22:37:41'!
emitObjectAccessorsOn: writer
| lines |
writer nextPutComment: 'InterpreterProxy methodsFor: ''object access'''.
lines _ #(
'sqInt (*argumentCountOf)(sqInt methodPointer);'
'void *(*arrayValueOf)(sqInt oop);'
'sqInt (*byteSizeOf)(sqInt oop);'
'void *(*fetchArrayofObject)(sqInt fieldIndex, sqInt objectPointer);'
'sqInt (*fetchClassOf)(sqInt oop);'
'double (*fetchFloatofObject)(sqInt fieldIndex, sqInt objectPointer);'
'sqInt (*fetchIntegerofObject)(sqInt fieldIndex, sqInt objectPointer);'
'sqInt (*fetchPointerofObject)(sqInt fieldIndex, sqInt oop);'
'sqInt (*obsoleteDontUseThisFetchWordofObject)(sqInt fieldFieldIndex, sqInt oop);'
'void *(*firstFixedField)(sqInt oop);'
'void *(*firstIndexableField)(sqInt oop);'
'sqInt (*literalofMethod)(sqInt offset, sqInt methodPointer);'
'sqInt (*literalCountOf)(sqInt methodPointer);'
'sqInt (*methodArgumentCount)(void);'
'sqInt (*methodPrimitiveIndex)(void);'
'sqInt (*primitiveIndexOf)(sqInt methodPointer);'
'sqInt (*sizeOfSTArrayFromCPrimitive)(void *cPtr);'
'sqInt (*slotSizeOf)(sqInt oop);'
'sqInt (*stObjectat)(sqInt array, sqInt fieldIndex);'
'sqInt (*stObjectatput)(sqInt array, sqInt fieldIndex, sqInt value);'
'sqInt (*stSizeOf)(sqInt oop);'
'sqInt (*storeIntegerofObjectwithValue)(sqInt fieldIndex, sqInt oop, sqInt integer);'
'sqInt (*storePointerofObjectwithValue)(sqInt fieldIndex, sqInt oop, sqInt valuePointer);'
).
lines do: [:line | writer nextPutLine: line ].
writer newLine.! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/6/2020 22:38:01'!
emitObjectConvertersOn: writer
| lines |
writer nextPutComment: 'InterpreterProxy methodsFor: ''converting'''.
lines _ #(
'sqInt (*booleanValueOf)(sqInt obj);'
'sqInt (*checkedIntegerValueOf)(sqInt intOop);'
'sqInt (*floatObjectOf)(double aFloat);'
'double (*floatValueOf)(sqInt oop);'
'sqInt (*integerObjectOf)(sqInt value);'
'sqInt (*integerValueOf)(sqInt oop);'
'sqInt (*positive32BitIntegerFor)(unsigned int integerValue);'
'usqInt (*positive32BitValueOf)(sqInt oop);'
).
lines do: [:line | writer nextPutLine: line ].
writer newLine.! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/6/2020 22:40:14'!
emitObjectTestersOn: writer
| lines |
writer nextPutComment: 'InterpreterProxy methodsFor: ''testing'''.
lines _ #(
'sqInt (*isKindOf)(sqInt oop, char *aString);'
'sqInt (*isMemberOf)(sqInt oop, char *aString);'
'sqInt (*isBytes)(sqInt oop);'
'sqInt (*isFloatObject)(sqInt oop);'
'sqInt (*isIndexable)(sqInt oop);'
'sqInt (*isIntegerObject)(sqInt oop);'
'sqInt (*isIntegerValue)(sqInt intValue);'
'sqInt (*isPointers)(sqInt oop);'
'sqInt (*isWeak)(sqInt oop);'
'sqInt (*isWords)(sqInt oop);'
'sqInt (*isWordsOrBytes)(sqInt oop);'
).
lines do: [:line | writer nextPutLine: line ].
writer newLine.! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/6/2020 22:38:14'!
emitOtherHelpersOn: writer
| lines |
writer nextPutComment: 'InterpreterProxy methodsFor: ''other'''.
lines _ #(
'sqInt (*becomewith)(sqInt array1, sqInt array2);'
'sqInt (*byteSwapped)(sqInt w);'
'sqInt (*failed)(void);'
'sqInt (*fullDisplayUpdate)(void);'
'void (*fullGC)(void);'
'void (*incrementalGC)(void);'
'sqInt (*primitiveFail)(void);'
'sqInt (*showDisplayBitsLeftTopRightBottom)(sqInt aForm, sqInt l, sqInt t, sqInt r, sqInt b);'
'sqInt (*signalSemaphoreWithIndex)(sqInt semaIndex);'
'sqInt (*success)(sqInt aBoolean);'
'sqInt (*superclassOf)(sqInt classPointer);'
).
lines do: [:line| writer nextPutLine: line].
writer newLine.! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/19/2020 21:44:20'!
emitPrimitiveConstantsOn: writer
"Writes the primitives constants on the given writer"
| majorVersion lines |
majorVersion _ self findProxyMajorVersion.
majorVersion <= 8 ifTrue: [ ^self ].
writer nextPutSectionComment: 'Primitive constants'.
lines _ #(
'#define PrimNoErr 0'
'#define PrimErrGenericFailure 1'
'#define PrimErrBadReceiver 2'
'#define PrimErrBadArgument 3'
'#define PrimErrBadIndex 4'
'#define PrimErrBadNumArgs 5'
'#define PrimErrInappropriate 6'
'#define PrimErrUnsupported 7'
'#define PrimErrNoModification 8'
'#define PrimErrNoMemory 9'
'#define PrimErrNoCMemory 10'
'#define PrimErrNotFound 11'
'#define PrimErrBadMethod 12'
'#define PrimErrNamedInternal 13'
'#define PrimErrObjectMayMove 14'
'#define PrimErrLimitExceeded 15'
'#define PrimErrObjectIsPinned 16'
'#define PrimErrWritePastObject 17'
'#define PrimErrObjectMoved 18'
'#define PrimErrObjectNotPinned 19'
'#define PrimErrCallbackError 20'
'#define PrimErrOSError 21'
'#define PrimErrFFIException 22'
'#define PrimErrNeedCompaction 23'
'#define PrimErrOperationFailed 24'
).
lines do: [:line | writer nextPutLine: line ].! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/6/2020 22:28:13'!
emitSpecialClassesOn: writer
| lines |
writer nextPutComment: 'InterpreterProxy methodsFor: ''special classes'''.
lines _ #(
'sqInt (*classArray)(void);'
'sqInt (*classBitmap)(void);'
'sqInt (*classByteArray)(void);'
'sqInt (*classCharacter)(void);'
'sqInt (*classFloat)(void);'
'sqInt (*classLargePositiveInteger)(void);'
'sqInt (*classPoint)(void);'
'sqInt (*classSemaphore)(void);'
'sqInt (*classSmallInteger)(void);'
'sqInt (*classString)(void);'
).
lines do: [:line | writer nextPutLine: line ].
writer newLine! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/6/2020 22:26:02'!
emitSpecialObjectsOn: writer
| lines |
writer nextPutComment: 'InterpreterProxy methodsFor: ''special objects'''.
lines _ #(
'sqInt (*characterTable)(void);'
'sqInt (*displayObject)(void);'
'sqInt (*falseObject)(void);'
'sqInt (*nilObject)(void);'
'sqInt (*trueObject)(void);'
).
lines do: [:line | writer nextPutLine: line ].
writer newLine.! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/19/2020 21:51:48'!
emitSqIntTypedefsOn: writer
"Here we use GCC macros for generating the types https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html#Common-Predefined-Macros"
"for 32bit images"
writer nextPutLine: '#if (__SIZEOF_INT__ == VM_WORD_SIZE)'.
writer nextPutLine: 'typedef int sqInt;'.
writer nextPutLine: 'typedef unsigned int usqInt;'.
"for 64bit"
writer nextPutLine: '#elif (__SIZEOF_LONG__ == VM_WORD_SIZE)'.
writer nextPutLine: 'typedef long sqInt;'.
writer nextPutLine: 'typedef unsigned long usqInt;'.
writer nextPutLine: '#elif (__SIZEOF_LONG_LONG__ == VM_WORD_SIZE)'.
writer nextPutLine: 'typedef long long sqInt;'.
writer nextPutLine: 'typedef unsigned long long usqInt;'.
writer nextPutLine: '#endif'! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/20/2020 17:36:54'!
emitSqLongTypedefsOn: writer
| lines |
lines _ #(
'# if !!defined(sqLong)'
'# if _MSC_VER'
'# define sqLong __int64'
'# define usqLong unsigned __int64'
'# else'
'# define sqLong long long'
'# define usqLong unsigned long long'
'# endif'
'# endif'
).
lines do: [:line | writer nextPutLine: line ].
writer newLine! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/6/2020 22:39:45'!
emitStackAccessorsOn: writer
| lines |
writer nextPutComment: 'InterpreterProxy methodsFor: ''stack access'''.
lines _ #(
'sqInt (*pop)(sqInt nItems);'
'sqInt (*popthenPush)(sqInt nItems, sqInt oop);'
'sqInt (*push)(sqInt object);'
'sqInt (*pushBool)(sqInt trueOrFalse);'
'sqInt (*pushFloat)(double f);'
'sqInt (*pushInteger)(sqInt integerValue);'
'double (*stackFloatValue)(sqInt offset);'
'sqInt (*stackIntegerValue)(sqInt offset);'
'sqInt (*stackObjectValue)(sqInt offset);'
'sqInt (*stackValue)(sqInt offset);'
).
lines do: [:line | writer nextPutLine: line ].
writer newLine! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/20/2020 17:37:11'!
emitTypedefsOn: writer
writer nextPutSectionComment: 'OpenSmalltalk Types'.
self emitSqIntTypedefsOn: writer.
self emitSqLongTypedefsOn: writer.
writer nextPutLine: 'typedef sqInt (*CompilerHook)(void);'.
writer newLine.
! !
!OSVMPluginHeaderBuilder methodsFor: 'C Header generation' stamp: 'jpb 6/6/2020 21:40:23'!
emitVersionGettersOn: writer
writer nextPutAll: 'sqInt (*minorVersion)(void);'; newLine.
writer nextPutAll: 'sqInt (*majorVersion)(void);'; newLine.
! !
!OSVMPluginHeaderBuilder methodsFor: 'as yet unclassified' stamp: 'jpb 6/6/2020 20:11:23'!
findInterpreterProxyVersion
"Only implemented for VMs which can generate 1:1 the interpreterProxy interface, which is only possible of a VM which inherits from the opensmalltalk-vm"
^{Smalltalk vmParameterAt: 70. Smalltalk vmParameterAt: 71}! !
!OSVMPluginHeaderBuilder methodsFor: 'as yet unclassified' stamp: 'jpb 6/19/2020 22:08:12'!
findOSVersion
^Smalltalk osVersion ! !
!OSVMPluginHeaderBuilder methodsFor: 'as yet unclassified' stamp: 'jpb 6/7/2020 18:49:04'!
findOoPointerSize
"Returns the size in bytes of the commonly used object oriented pointer (OOP) size used in the VM"
^Smalltalk vmParameterAt: 40! !
!OSVMPluginHeaderBuilder methodsFor: 'as yet unclassified' stamp: 'jpb 6/19/2020 21:59:30'!
findPlatformName
^Smalltalk platformName ! !
!OSVMPluginHeaderBuilder methodsFor: 'as yet unclassified' stamp: 'jpb 6/19/2020 22:08:01'!
findPlatformSubtype
^Smalltalk platformSubtype ! !
!OSVMPluginHeaderBuilder methodsFor: 'as yet unclassified' stamp: 'jpb 6/19/2020 21:35:44'!
findProxyMajorVersion
^Smalltalk vmParameterAt: 70.! !
!OSVMPluginHeaderBuilder methodsFor: 'as yet unclassified' stamp: 'jpb 6/19/2020 21:35:56'!
findProxyMinorVersion
^Smalltalk vmParameterAt: 71! !
!OSVMPluginHeaderBuilder methodsFor: 'as yet unclassified' stamp: 'jpb 6/19/2020 21:53:14'!
findVMVersion
^Smalltalk vmVersion ! !
!OSVMPluginHeaderBuilder methodsFor: 'as yet unclassified' stamp: 'jpb 6/7/2020 18:49:24'!
findWordSize
"Returns the word size within the VM"
^ Smalltalk wordSize! !
!OSVMPluginHeaderBuilder class methodsFor: 'as yet unclassified' stamp: 'jpb 6/19/2020 21:58:45'!
writeHeader
"Writes the header to a file"
| builder fileEntry writer |
builder _ self new.
fileEntry _ 'osvm_plugin.h' asFileEntry.
fileEntry writeStreamDo: [:headerStream |
writer _ SlangCLanguageWriter on: headerStream.
builder emitHeaderOn: writer.
].! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'ar 9/16/1998 01:40'!
argumentCountOf: methodPointer
^methodPointer numArgs! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'jpb 6/18/2020 20:03:44'!
arrayValueOf: oop
<returnType: 'void *'>
self success: (self isWordsOrBytes: oop).
^SlangCArrayAccessor on: oop.! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'eem 10/18/2018 13:51'!
byteSizeOf: oop
"Return the size of the receiver in bytes"
^oop class isBits
ifTrue: [oop basicSize * oop class elementSize]
ifFalse: [(self slotSizeOf: oop) * Smalltalk wordSize]! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'jpb 6/26/2020 20:27:11'!
characterObjectOf: characterCode
<option: #(atLeastVMProxyMajor:minor: 1 13)>
"StackInterpreter objectMemoryClass characterObjectOf: characterCode"
^Character asciiValue: characterCode! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'eem 10/31/2013 00:27'!
characterValueOf: aCharacter
<option: #(atLeastVMProxyMajor:minor: 1 13)>
^aCharacter asInteger! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'jpb 6/18/2020 20:04:24'!
fetchArray: fieldIndex ofObject: objectPointer
"Fetch the instance variable at the given index of the given object. Return the address of first indexable field of resulting array object, or fail if the instance variable does not contain an indexable bytes or words object."
"Note: May be called by translated primitive code."
| arrayOop |
<returnType: 'void *'>
arrayOop := self fetchPointer: fieldIndex ofObject: objectPointer.
^ self arrayValueOf: arrayOop
! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'ar 9/16/1998 01:07'!
fetchClassOf: oop
^oop class! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'jpb 6/18/2020 20:04:29'!
fetchFloat: fieldIndex ofObject: objectPointer
"Fetch the instance variable at the given index of the given object. Return the C double precision floating point value of that instance variable, or fail if it is not a Float."
"Note: May be called by translated primitive code."
| floatOop |
<returnType: 'double'>
floatOop := self fetchPointer: fieldIndex ofObject: objectPointer.
^ self floatValueOf: floatOop! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'tpr (auto pragmas 12/08) 3/15/2004 20:20'!
fetchInteger: fieldIndex ofObject: objectPointer
"Note: May be called by translated primitive code."
| intOop |
<inline: false>
intOop := self fetchPointer: fieldIndex ofObject: objectPointer.
^self checkedIntegerValueOf: intOop! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'tpr 6/6/2005 19:11'!
fetchLong32: fieldIndex ofObject: oop
"fetchWord:ofObject: is rescinded as of VMMaker 3.8 64bit VM. This is the same code as used therein and may need revision for 64 bit cleanliness"
^oop instVarAt: fieldIndex+1! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'ar 10/10/1998 16:04'!
fetchPointer: index ofObject: oop
^oop instVarAt: index+1! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'jpb 6/19/2020 20:07:20'!
firstFixedField: oop
<returnType:'void *'>
^SlangCObjectAccessor on: oop! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'jpb 6/18/2020 20:03:51'!
firstIndexableField: oop
<returnType:'void *'>
^SlangCArrayAccessor on: oop! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'eem 11/18/2009 15:50'!
instanceSizeOf: classObj
^classObj instSize! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'jpb 6/26/2020 20:28:45'!
isOopImmutable: oop
<option: #IMMUTABILITY>
self flag: #fixme.
"Original code: ^StackInterpreter objectMemoryClass isOopImmutable: oop"
^false! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'eem 5/23/2011 17:14'!
literal: offset ofMethod: methodPointer
^methodPointer literalAt: offset+1! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'ar 9/16/1998 01:40'!
literalCountOf: methodPointer
^methodPointer numLiterals! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'ar 10/7/1998 18:43'!
methodArgumentCount
^argumentCount! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'ar 10/7/1998 18:43'!
methodPrimitiveIndex
^method primitive! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'tpr 6/6/2005 19:28'!
obsoleteDontUseThisFetchWord: fieldIndex ofObject: oop
"fetchWord:ofObject: is rescinded as of VMMaker 3.8 64bit VM. This is a placeholder to sit in the sqVirtualMachine structure to support older plugins for a while"
self halt: 'deprecated method'! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'eem 10/31/2013 00:29'!
pinObject: anObject
<option: #(atLeastVMProxyMajor:minor: 1 13)>
^self shouldBeImplemented! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'ar 9/16/1998 01:39'!
primitiveIndexOf: methodPointer
^methodPointer primitive! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'ar 11/28/1999 17:43'!
primitiveMethod
"Return the method an external primitive was defined in"
^method! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'tpr (auto pragmas 12/08) 12/29/2005 16:35'!
sizeOfSTArrayFromCPrimitive: cPtr
"Note: Only called by translated primitive code."
<var: #cPtr type: 'void *'>
^self shouldNotImplement! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'ar 10/7/1998 18:24'!
slotSizeOf: oop
"Returns the number of slots in the receiver.
If the receiver is a byte object, return the number of bytes.
Otherwise return the number of words."
^(oop basicSize) + (oop class instSize)! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'ar 9/16/1998 01:53'!
stObject: array at: index
^array at: index! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'ar 9/16/1998 01:53'!
stObject: array at: index put: value
^array at: index put: value! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'ar 10/7/1998 18:26'!
stSizeOf: oop
"Return the number of indexable fields in the receiver"
^oop basicSize! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'ar 10/25/1998 16:16'!
storeInteger: index ofObject: oop withValue: integer
(self isIntegerValue: integer)
ifTrue:[^self storePointer: index ofObject: oop withValue: integer]
ifFalse:[^self primitiveFail]! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'ar 10/10/1998 21:25'!
storePointer: index ofObject: oop withValue: valuePointer
^oop instVarAt: index+1 put: valuePointer! !
!OSVMInterpreterProxy methodsFor: 'object access' stamp: 'eem 7/28/2014 07:12'!
unpinObject: anObject
<option: #(atLeastVMProxyMajor:minor: 1 13)>
^self shouldBeImplemented! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'jpb 6/18/2020 20:02:18'!
become: array1 with: array2
<returnType: #sqInt>
array1 elementsExchangeIdentityWith: array2! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'nice 4/5/2016 23:19'!
byteSwapped32IfBigEndian: anInteger
"Note: for simulation only.
This message is not generated in C but replaced with a macro"
<doNotGenerate>
self vmEndianness = 1 ifTrue: [^anInteger byteSwap32].
^anInteger! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'nice 4/5/2016 23:19'!
byteSwapped64IfBigEndian: anInteger
"Note: for simulation only.
This message is not generated in C but replaced with a macro"
<doNotGenerate>
self vmEndianness = 1 ifTrue: [^anInteger byteSwap64].
^anInteger! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'eem 11/1/2007 16:05'!
failed
^primFailCode ~= 0! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'jpb 6/18/2020 20:05:30'!
fullDisplayUpdate
<returnType: #sqInt>
Display display! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'jpb 6/18/2020 20:05:42'!
fullGC
<returnType: #sqInt>
Smalltalk garbageCollect! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'eem 1/23/2013 15:53'!
getInterruptPending
^self notYetImplementedError! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'jpb 6/18/2020 20:05:47'!
getStackPointer
<returnType: #'sqInt *'>
^self notYetImplementedError! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'eem 1/15/2018 14:04'!
getThisSessionID
"Answer a session identifier which represents the current instance of Squeak.
The identifier is expected to be unique among all instances of Squeak on a
network at any point in time."
[thisSessionID = 0]
whileTrue:
[thisSessionID := (Random new next * (SmallInteger maxVal min: 16rFFFFFFFF)) asInteger].
^ thisSessionID! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'ar 9/16/1998 20:52'!
incrementalGC
Smalltalk garbageCollectMost.! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'ar 5/13/2000 14:55'!
ioMicroMSecs
^Time millisecondClockValue! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'tfel 2/11/2016 09:03'!
majorVersion
^ 1! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'tfel 2/11/2016 09:03'!
minorVersion
^ 8! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'jpb 6/18/2020 20:08:44'!
primitiveFail
<returnType: #sqInt>
"Set general (unspecified) primitive failure."
self primitiveFailFor: 1! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'tfel 4/30/2015 07:54'!
primitiveFailFor: reasonCode
"Set specific primitive failure.
N.B. primitiveFailFor: PrimNoErr is expected to clear the primFailCode.
Primitive 255 is called to indicate that we are currently simulating a primitive that should fail and the VM should handle that case appropriately (if supported by the VM)."
<primitive: 255>
^ primFailCode := reasonCode! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'jpb 6/26/2020 20:27:39'!
primitiveFailForFFIException: exceptionCode at: pc
<var: 'exceptionCode' type: #usqLong>
<var: 'pc' type: #usqInt>
<option: #(atLeastVMProxyMajor:minor: 1 14)>
"Set PrimErrFFIException primitive failure and associated exceptionCode (a.k.a.
osErrorCode) and exceptionPC."
<primitive: 255>
osErrorCode := exceptionCode.
exceptionPC := pc.
^primFailCode := PrimErrFFIException! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'eem 12/18/2018 17:42'!
primitiveFailForOSError: osError
<var: 'osError' type: #sqLong>
<option: #(atLeastVMProxyMajor:minor: 1 14)>
"Set PrimErrOSError primitive failure and associated osErrorCode.
Primitive 255 is called to indicate that we are currently simulating a primitive that should fail and the VM should handle that case appropriately (if supported by the VM)."
<primitive: 255>
osErrorCode := osError.
^primFailCode := PrimErrOSError! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'eem 11/25/2009 10:39'!
primitiveFailureCode
^primFailCode! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'jpb 6/18/2020 20:09:57'!
setInterruptCheckChain: aFunction
<returnType: #'void *'>
<var: #aFunction declare: 'void (*aFunction)()'>
^self notYetImplementedError! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'tfel 3/3/2016 17:06'!
showDisplayBits: aForm Left: l Top: t Right: r Bottom: b
aForm == Display ifTrue:[
Display class isDeferringUpdates ifTrue: [^ nil].
Display forceToScreen: (Rectangle left: l right: r top: t bottom: b)].! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'jpb 6/18/2020 20:10:01'!
signalSemaphoreWithIndex: semaIndex
<returnType: #sqInt>
((Smalltalk externalObjects) at: semaIndex) signal! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'eem 12/18/2018 17:41'!
statNumGCs
<option: #(atLeastVMProxyMajor:minor: 1 14)>
^(Smalltalk vmParameterAt: 7 "statFullGCs") + (Smalltalk vmParameterAt: 9 "statScavenges/statIncrGCs")! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'jpb 6/18/2020 20:11:02'!
success: aBoolean
<returnType: #sqInt>
aBoolean ifTrue: [^self].
primFailCode = 0 ifTrue: [self primitiveFailFor: 1]! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'ar 9/16/1998 20:51'!
superclassOf: classPointer
^classPointer superclass! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'jpb 6/18/2020 20:11:07'!
tenuringIncrementalGC
<returnType: #void>
Smalltalk forceTenuring; garbageCollectMost! !
!OSVMInterpreterProxy methodsFor: 'other' stamp: 'jpb 6/26/2020 20:42:38'!
vmEndianness
"return 0 for little endian, 1 for big endian"
^systemAdapter findVMEndianess! !
!OSVMInterpreterProxy methodsFor: 'converting' stamp: 'ar 10/10/1998 21:27'!
booleanValueOf: obj
obj == true ifTrue:[^true].
obj == false ifTrue:[^false].
self primitiveFail.
^nil! !
!OSVMInterpreterProxy methodsFor: 'converting' stamp: 'ar 10/4/1998 15:47'!
checkedIntegerValueOf: intOop
(self isIntegerObject: intOop)
ifTrue:[^self integerValueOf: intOop]
ifFalse:[self primitiveFail. ^0].! !
!OSVMInterpreterProxy methodsFor: 'converting' stamp: 'jpb 6/18/2020 20:05:18'!
floatObjectOf: aFloat
<returnType: #sqInt> "...because answering the float argument causes the type inferencer to say this answers a float."
<var: #aFloat type: #double>
aFloat isFloat ifFalse: [self error:'Not a float object'].
^aFloat! !
!OSVMInterpreterProxy methodsFor: 'converting' stamp: 'jpb 6/18/2020 20:05:24'!
floatValueOf: oop
<returnType: #double>
oop isFloat
ifTrue:[^oop]
ifFalse:[self primitiveFail. ^0.0].! !
!OSVMInterpreterProxy methodsFor: 'converting' stamp: 'ar 10/10/1998 16:13'!
integerObjectOf: value
value class == SmallInteger ifFalse:[self error:'Not a SmallInteger object'].
^value! !
!OSVMInterpreterProxy methodsFor: 'converting' stamp: 'ar 10/10/1998 16:10'!
integerValueOf: oop
oop class == SmallInteger ifFalse:[self error:'Not a SmallInteger'].
^oop! !
!OSVMInterpreterProxy methodsFor: 'converting' stamp: 'eem 12/6/2012 16:01'!
ioFilename: aCharBuffer fromString: aFilenameString ofLength: filenameLength resolveAliases: aBoolean
<var: #aCharBuffer type: #'char *'>
<var: #aFilenameString type: #'char *'>
"the vm has to convert aFilenameString via any canonicalization and char-mapping and put the result in aCharBuffer. This doesn't translate well in Smalltalk since we know how long strings are rather than considering them terminated by a 0 char. Do the best we can.
Note the resolveAliases flag - this is an awful artefact of OSX and Apples demented alias handling. When opening a file, the flag must be true, when closing or renaming it must be false. Sigh."
aCharBuffer replaceFrom:1 to: filenameLength with: aFilenameString! !
!OSVMInterpreterProxy methodsFor: 'converting' stamp: 'jpb 6/18/2020 20:08:18'!
positive32BitIntegerFor: integerValue
<returnType: #sqInt>
<var: 'integerValue' type: #'unsigned int'>
integerValue isInteger ifFalse:[self error:'Not an Integer object'].
^integerValue > 0
ifTrue:[integerValue]
ifFalse:[ (1 bitShift: 32) + integerValue]! !
!OSVMInterpreterProxy methodsFor: 'converting' stamp: 'jpb 6/18/2020 20:08:24'!
positive32BitValueOf: oop
<returnType: #usqInt>
oop isInteger ifFalse:[self error:'Not an integer object'].
oop < 0
ifTrue:[self primitiveFail. ^0]
ifFalse:[^oop]! !
!OSVMInterpreterProxy methodsFor: 'converting' stamp: 'jpb 6/18/2020 20:08:29'!
positive64BitIntegerFor: integerValue
<api>
<returnType: #sqInt> "...because answering the 64-bit argument causes the type inferencer to say this answers 64-bits."
<var: 'integerValue' type: #usqLong>
integerValue isInteger ifFalse:[self error:'Not an Integer object'].
^integerValue > 0
ifTrue:[integerValue]
ifFalse:[ (1 bitShift: 64) + integerValue]! !
!OSVMInterpreterProxy methodsFor: 'converting' stamp: 'jpb 6/18/2020 20:08:34'!
positive64BitValueOf: oop
<returnType: #usqLong>
oop isInteger ifFalse:[self error:'Not an integer object'].
oop < 0
ifTrue:[self primitiveFail. ^0]
ifFalse:[^oop]! !
!OSVMInterpreterProxy methodsFor: 'converting' stamp: 'jpb 6/18/2020 20:08:38'!
positiveMachineIntegerValueOf: oop
<returnType: #'usqIntptr_t'>
oop isInteger ifFalse:[self error: 'Not an integer object'].
^oop < 0
ifTrue: [self primitiveFail. 0]
ifFalse: [oop]! !
!OSVMInterpreterProxy methodsFor: 'converting' stamp: 'ar 11/29/1999 22:01'!
signed32BitIntegerFor: integerValue
integerValue isInteger ifFalse:[self error:'Not an Integer object'].
^integerValue! !
!OSVMInterpreterProxy methodsFor: 'converting' stamp: 'jpb 6/18/2020 20:10:07'!
signed32BitValueOf: oop
<returnType: #int>
oop isInteger ifFalse:[self error:'Not an integer object'].
^oop! !
!OSVMInterpreterProxy methodsFor: 'converting' stamp: 'jpb 6/18/2020 20:10:11'!
signed64BitIntegerFor: integerValue
<returnType: #sqInt> "...because answering the 64-bit argument causes the type inferencer to say this answers 64-bits."
<var: 'integerValue' type: #sqLong>
integerValue isInteger ifFalse:[self error:'Not an Integer object'].
^integerValue! !
!OSVMInterpreterProxy methodsFor: 'converting' stamp: 'jpb 6/18/2020 20:10:18'!
signed64BitValueOf: oop
<returnType: #sqLong>
oop isInteger ifFalse:[self error:'Not an integer object'].
^oop! !
!OSVMInterpreterProxy methodsFor: 'converting' stamp: 'jpb 6/18/2020 20:10:36'!
signedMachineIntegerValueOf: oop
<returnType: #'sqIntptr_t'>
oop isInteger ifFalse:[self error:'Not an integer object'].
^oop! !