[Vm-dev] VM Maker: VMMaker.oscog-eem.155.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Apr 6 23:00:54 UTC 2012
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.155.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.155
Author: eem
Time: 6 April 2012, 3:59:00.584 pm
UUID: 09dcf403-f832-4bee-9665-6a3b9dfdeb11
Ancestors: VMMaker.oscog-eem.154
Refactor bytecode table initialization in the Cogits to mimic initialization
in the Stack/CoInterpreter. Refactor Cogit class initialization so that
only the concrete class need be initialized.
=============== Diff against VMMaker.oscog-eem.154 ===============
Item was changed:
----- Method: CogVMSimulator class>>chooseAndInitCogitClassWithOpts: (in category 'instance creation') -----
chooseAndInitCogitClassWithOpts: opts
+ (CoInterpreter classPool
+ at: #CogitClass
+ put: Cogit chooseCogitClass)
+ initializeWithOptions: opts!
- ((CoInterpreter classPool at: #CogitClass put: Cogit chooseCogitClass)
- withAllSuperclasses copyUpThrough: Cogit) reverseDo:
- [:cc| cc initializeWithOptions: opts]!
Item was added:
+ ----- Method: Cogit class>>initializeBytecodeTable (in category 'class initialization') -----
+ initializeBytecodeTable
+ "SimpleStackBasedCogit initializeBytecodeTable"
+ "StackToRegisterMappingCogit initializeBytecodeTable"
+
+ NewspeakVM ifTrue:
+ [^self initializeBytecodeTableForNewspeakV3PlusClosures].
+
+ ^self initializeBytecodeTableForSqueakV3PlusClosures!
Item was added:
+ ----- Method: Cogit class>>initializePrimitiveTable (in category 'class initialization') -----
+ initializePrimitiveTable
+ "Currently there is only one sequence of primitives."
+ self initializePrimitiveTableForSqueakV3!
Item was changed:
----- Method: Cogit class>>initializeWithOptions: (in category 'class initialization') -----
initializeWithOptions: optionsDictionary
self initializeMiscConstantsWith: optionsDictionary. "must preceed other initialization."
self initializeErrorCodes.
self initializeCogMethodConstants.
self initializeAnnotationConstants.
+ self initializeCompilationConstants.
+ self initializeBytecodeTable.
+ self initializePrimitiveTable!
- self initializeCompilationConstants!
Item was added:
+ ----- Method: CurrentImageCoInterpreterFacade>>methodUsesAlternateBytecodeSet: (in category 'testing') -----
+ methodUsesAlternateBytecodeSet: methodObjOop
+ "A negative header selects the alternate bytecode set."
+ ^(self objectForOop: methodObjOop) signFlag!
Item was removed:
- ----- Method: SimpleStackBasedCogit class>>initializeBytecodeTableForClosureV3 (in category 'class initialization') -----
- initializeBytecodeTableForClosureV3
- "SimpleStackBasedCogit initializeBytecodeTableForClosureV3"
-
- self flag:
- 'Special selector send class must be inlined to agree with the interpreter, which
- inlines class. If class is sent to e.g. a general instance of ProtoObject then unless
- class is inlined there will be an MNU. It must be that the Cointerpreter and Cogit
- have identical semantics. We get away with not hardwiring the other special
- selectors either because in the Cointerpreter they are not inlined or because they
- are inlined only to instances of classes for which there will always be a method.'.
- self generatorTableFrom: {
- #(1 0 15 genPushReceiverVariableBytecode).
- #(1 16 31 genPushTemporaryVariableBytecode).
- #(1 32 63 genPushLiteralConstantBytecode needsFrameNever: 1).
- #(1 64 95 genPushLiteralVariableBytecode needsFrameNever: 1).
- #(1 96 103 genStoreAndPopReceiverVariableBytecode needsFrameNever: -1).
- #(1 104 111 genStoreAndPopTemporaryVariableBytecode).
- #(1 112 112 genPushReceiverBytecode).
- #(1 113 113 genPushConstantTrueBytecode needsFrameNever: 1).
- #(1 114 114 genPushConstantFalseBytecode needsFrameNever: 1).
- #(1 115 115 genPushConstantNilBytecode needsFrameNever: 1).
- #(1 116 119 genPushQuickIntegerConstantBytecode needsFrameNever: 1).
- "method returns in blocks need a frame because of nonlocalReturn:through:"
- #(1 120 120 genReturnReceiver return needsFrameIfInBlock: mappedInBlock 0).
- #(1 121 121 genReturnTrue return needsFrameIfInBlock: mappedInBlock 0).
- #(1 122 122 genReturnFalse return needsFrameIfInBlock: mappedInBlock 0).
- #(1 123 123 genReturnNil return needsFrameIfInBlock: mappedInBlock 0).
- #(1 124 124 genReturnTopFromMethod return needsFrameIfInBlock: mappedInBlock -1).
- #(1 125 125 genReturnTopFromBlock return needsFrameNever: -1).
-
- NewspeakVM
- ifTrue: [#(3 126 126 genDynamicSuperSendBytecode mapped)]
- ifFalse: [#(1 126 126 unknownBytecode)].
- NewspeakVM
- ifTrue: [#(2 127 127 genPushImplicitReceiverBytecode mapped)]
- ifFalse: [#(1 127 127 unknownBytecode)].
-
- #(2 128 128 extendedPushBytecode needsFrameNever: 1).
- #(2 129 129 extendedStoreBytecode).
- #(2 130 130 extendedStoreAndPopBytecode).
- #(2 131 131 genExtendedSendBytecode mapped).
- #(3 132 132 doubleExtendedDoAnythingBytecode mapped).
- #(2 133 133 genExtendedSuperBytecode mapped).
- #(2 134 134 genSecondExtendedSendBytecode mapped).
- #(1 135 135 genPopStackBytecode needsFrameNever: -1).
- #(1 136 136 duplicateTopBytecode needsFrameNever: 1).
-
- #(1 137 137 genPushActiveContextBytecode).
- #(2 138 138 genPushNewArrayBytecode).
- NewspeakVM
- ifTrue: [#(2 139 139 genPushExplicitOuterSendReceiverBytecode mapped)]
- ifFalse: [#(1 139 139 unknownBytecode)].
- #(3 140 140 genPushRemoteTempLongBytecode).
- #(3 141 141 genStoreRemoteTempLongBytecode).
- #(3 142 142 genStoreAndPopRemoteTempLongBytecode).
- #(4 143 143 genPushClosureCopyCopiedValuesBytecode block blockCodeS:i:z:e:).
-
- #(1 144 151 genShortUnconditionalJump forward shortForwardBranchDistance:).
- #(1 152 159 genShortJumpIfFalse forward false mapped "because of mustBeBoolean"
- shortForwardBranchDistance:).
- #(2 160 163 genLongUnconditionalBackwardJump backward mapped "because of interrupt check"
- longBranchDist:ance:).
- #(2 164 167 genLongUnconditionalForwardJump forward longBranchDist:ance:).
- #(2 168 171 genLongJumpIfTrue forward true mapped "because of mustBeBoolean"
- longForwardBranchDist:ance:).
- #(2 172 175 genLongJumpIfFalse forward false mapped "because of mustBeBoolean"
- longForwardBranchDist:ance:).
-
- #(1 176 197 genSpecialSelectorSend mapped).
- #(1 198 198 genSpecialSelectorEqualsEquals needsFrameNever: notMapped -1). "not mapped because it is directly inlined (for now)"
- #(1 199 199 genSpecialSelectorClass needsFrameNever: notMapped 0). "not mapped because it is directly inlined (for now)"
- #(1 200 207 genSpecialSelectorSend mapped).
- #(1 208 223 genSendLiteralSelector0ArgsBytecode mapped).
- #(1 224 239 genSendLiteralSelector1ArgBytecode mapped).
- #(1 240 255 genSendLiteralSelector2ArgsBytecode mapped)}!
Item was added:
+ ----- Method: SimpleStackBasedCogit class>>initializeBytecodeTableForNewspeakV3PlusClosures (in category 'class initialization') -----
+ initializeBytecodeTableForNewspeakV3PlusClosures
+ "SimpleStackBasedCogit initializeBytecodeTableForNewspeakV3PlusClosures"
+
+ self flag:
+ 'Special selector send class must be inlined to agree with the interpreter, which
+ inlines class. If class is sent to e.g. a general instance of ProtoObject then unless
+ class is inlined there will be an MNU. It must be that the Cointerpreter and Cogit
+ have identical semantics. We get away with not hardwiring the other special
+ selectors either because in the Cointerpreter they are not inlined or because they
+ are inlined only to instances of classes for which there will always be a method.'.
+ self generatorTableFrom: #(
+ (1 0 15 genPushReceiverVariableBytecode)
+ (1 16 31 genPushTemporaryVariableBytecode)
+ (1 32 63 genPushLiteralConstantBytecode needsFrameNever: 1)
+ (1 64 95 genPushLiteralVariableBytecode needsFrameNever: 1)
+ (1 96 103 genStoreAndPopReceiverVariableBytecode needsFrameNever: -1)
+ (1 104 111 genStoreAndPopTemporaryVariableBytecode)
+ (1 112 112 genPushReceiverBytecode)
+ (1 113 113 genPushConstantTrueBytecode needsFrameNever: 1)
+ (1 114 114 genPushConstantFalseBytecode needsFrameNever: 1)
+ (1 115 115 genPushConstantNilBytecode needsFrameNever: 1)
+ (1 116 119 genPushQuickIntegerConstantBytecode needsFrameNever: 1)
+ "method returns in blocks need a frame because of nonlocalReturn:through:"
+ (1 120 120 genReturnReceiver return needsFrameIfInBlock: mappedInBlock 0)
+ (1 121 121 genReturnTrue return needsFrameIfInBlock: mappedInBlock 0)
+ (1 122 122 genReturnFalse return needsFrameIfInBlock: mappedInBlock 0)
+ (1 123 123 genReturnNil return needsFrameIfInBlock: mappedInBlock 0)
+ (1 124 124 genReturnTopFromMethod return needsFrameIfInBlock: mappedInBlock -1)
+ (1 125 125 genReturnTopFromBlock return needsFrameNever: -1)
+
+ (3 126 126 genDynamicSuperSendBytecode mapped) "Newspeak"
+ (2 127 127 genPushImplicitReceiverBytecode mapped) "Newspeak"
+
+ (2 128 128 extendedPushBytecode needsFrameNever: 1)
+ (2 129 129 extendedStoreBytecode)
+ (2 130 130 extendedStoreAndPopBytecode)
+ (2 131 131 genExtendedSendBytecode mapped)
+ (3 132 132 doubleExtendedDoAnythingBytecode mapped)
+ (2 133 133 genExtendedSuperBytecode mapped)
+ (2 134 134 genSecondExtendedSendBytecode mapped)
+ (1 135 135 genPopStackBytecode needsFrameNever: -1)
+ (1 136 136 duplicateTopBytecode needsFrameNever: 1)
+
+ (1 137 137 genPushActiveContextBytecode)
+ (2 138 138 genPushNewArrayBytecode)
+
+ (2 139 139 genPushExplicitOuterSendReceiverBytecode mapped) "Newspeak"
+
+ (3 140 140 genPushRemoteTempLongBytecode)
+ (3 141 141 genStoreRemoteTempLongBytecode)
+ (3 142 142 genStoreAndPopRemoteTempLongBytecode)
+ (4 143 143 genPushClosureCopyCopiedValuesBytecode block blockCodeS:i:z:e:)
+
+ (1 144 151 genShortUnconditionalJump forward shortForwardBranchDistance:)
+ (1 152 159 genShortJumpIfFalse forward false mapped "because of mustBeBoolean"
+ shortForwardBranchDistance:)
+ (2 160 163 genLongUnconditionalBackwardJump backward mapped "because of interrupt check"
+ longBranchDist:ance:)
+ (2 164 167 genLongUnconditionalForwardJump forward longBranchDist:ance:)
+ (2 168 171 genLongJumpIfTrue forward true mapped "because of mustBeBoolean"
+ longForwardBranchDist:ance:)
+ (2 172 175 genLongJumpIfFalse forward false mapped "because of mustBeBoolean"
+ longForwardBranchDist:ance:)
+
+ (1 176 197 genSpecialSelectorSend mapped)
+ (1 198 198 genSpecialSelectorEqualsEquals needsFrameNever: notMapped -1) "not mapped because it is directly inlined (for now)"
+ (1 199 199 genSpecialSelectorClass needsFrameNever: notMapped 0) "not mapped because it is directly inlined (for now)"
+ (1 200 207 genSpecialSelectorSend mapped)
+ (1 208 223 genSendLiteralSelector0ArgsBytecode mapped)
+ (1 224 239 genSendLiteralSelector1ArgBytecode mapped)
+ (1 240 255 genSendLiteralSelector2ArgsBytecode mapped))!
Item was added:
+ ----- Method: SimpleStackBasedCogit class>>initializeBytecodeTableForSqueakV3PlusClosures (in category 'class initialization') -----
+ initializeBytecodeTableForSqueakV3PlusClosures
+ "SimpleStackBasedCogit initializeBytecodeTableForSqueakV3PlusClosures"
+
+ self flag:
+ 'Special selector send class must be inlined to agree with the interpreter, which
+ inlines class. If class is sent to e.g. a general instance of ProtoObject then unless
+ class is inlined there will be an MNU. It must be that the Cointerpreter and Cogit
+ have identical semantics. We get away with not hardwiring the other special
+ selectors either because in the Cointerpreter they are not inlined or because they
+ are inlined only to instances of classes for which there will always be a method.'.
+ self generatorTableFrom: #(
+ (1 0 15 genPushReceiverVariableBytecode)
+ (1 16 31 genPushTemporaryVariableBytecode)
+ (1 32 63 genPushLiteralConstantBytecode needsFrameNever: 1)
+ (1 64 95 genPushLiteralVariableBytecode needsFrameNever: 1)
+ (1 96 103 genStoreAndPopReceiverVariableBytecode needsFrameNever: -1)
+ (1 104 111 genStoreAndPopTemporaryVariableBytecode)
+ (1 112 112 genPushReceiverBytecode)
+ (1 113 113 genPushConstantTrueBytecode needsFrameNever: 1)
+ (1 114 114 genPushConstantFalseBytecode needsFrameNever: 1)
+ (1 115 115 genPushConstantNilBytecode needsFrameNever: 1)
+ (1 116 119 genPushQuickIntegerConstantBytecode needsFrameNever: 1)
+ "method returns in blocks need a frame because of nonlocalReturn:through:"
+ (1 120 120 genReturnReceiver return needsFrameIfInBlock: mappedInBlock 0)
+ (1 121 121 genReturnTrue return needsFrameIfInBlock: mappedInBlock 0)
+ (1 122 122 genReturnFalse return needsFrameIfInBlock: mappedInBlock 0)
+ (1 123 123 genReturnNil return needsFrameIfInBlock: mappedInBlock 0)
+ (1 124 124 genReturnTopFromMethod return needsFrameIfInBlock: mappedInBlock -1)
+ (1 125 125 genReturnTopFromBlock return needsFrameNever: -1)
+
+ (1 126 127 unknownBytecode)
+
+ (2 128 128 extendedPushBytecode needsFrameNever: 1)
+ (2 129 129 extendedStoreBytecode)
+ (2 130 130 extendedStoreAndPopBytecode)
+ (2 131 131 genExtendedSendBytecode mapped)
+ (3 132 132 doubleExtendedDoAnythingBytecode mapped)
+ (2 133 133 genExtendedSuperBytecode mapped)
+ (2 134 134 genSecondExtendedSendBytecode mapped)
+ (1 135 135 genPopStackBytecode needsFrameNever: -1)
+ (1 136 136 duplicateTopBytecode needsFrameNever: 1)
+
+ (1 137 137 genPushActiveContextBytecode)
+ (2 138 138 genPushNewArrayBytecode)
+
+ (1 139 139 unknownBytecode)
+
+ (3 140 140 genPushRemoteTempLongBytecode)
+ (3 141 141 genStoreRemoteTempLongBytecode)
+ (3 142 142 genStoreAndPopRemoteTempLongBytecode)
+ (4 143 143 genPushClosureCopyCopiedValuesBytecode block blockCodeS:i:z:e:)
+
+ (1 144 151 genShortUnconditionalJump forward shortForwardBranchDistance:)
+ (1 152 159 genShortJumpIfFalse forward false mapped "because of mustBeBoolean"
+ shortForwardBranchDistance:)
+ (2 160 163 genLongUnconditionalBackwardJump backward mapped "because of interrupt check"
+ longBranchDist:ance:)
+ (2 164 167 genLongUnconditionalForwardJump forward longBranchDist:ance:)
+ (2 168 171 genLongJumpIfTrue forward true mapped "because of mustBeBoolean"
+ longForwardBranchDist:ance:)
+ (2 172 175 genLongJumpIfFalse forward false mapped "because of mustBeBoolean"
+ longForwardBranchDist:ance:)
+
+ (1 176 197 genSpecialSelectorSend mapped)
+ (1 198 198 genSpecialSelectorEqualsEquals needsFrameNever: notMapped -1) "not mapped because it is directly inlined (for now)"
+ (1 199 199 genSpecialSelectorClass needsFrameNever: notMapped 0) "not mapped because it is directly inlined (for now)"
+ (1 200 207 genSpecialSelectorSend mapped)
+ (1 208 223 genSendLiteralSelector0ArgsBytecode mapped)
+ (1 224 239 genSendLiteralSelector1ArgBytecode mapped)
+ (1 240 255 genSendLiteralSelector2ArgsBytecode mapped))!
Item was removed:
- ----- Method: SimpleStackBasedCogit class>>initializeWithOptions: (in category 'class initialization') -----
- initializeWithOptions: optionsDictionary
-
- self initializeMiscConstantsWith: optionsDictionary. "must preceed other initialization."
- self initializeBytecodeTableForClosureV3.
- self initializePrimitiveTableForSqueakV3!
Item was changed:
----- Method: SistaStackToRegisterMappingCogit class>>initializeWithOptions: (in category 'class initialization') -----
initializeWithOptions: optionsDictionary
+ super initializeWithOptions: optionsDictionary.
CounterBytes := 4.
MaxCounterValue := (1 << 16) - 1!
Item was added:
+ ----- Method: StackToRegisterMappingCogit class>>initializeBytecodeTableForNewspeakV3PlusClosures (in category 'class initialization') -----
+ initializeBytecodeTableForNewspeakV3PlusClosures
+ "StackToRegisterMappingCogit initializeBytecodeTableForNewspeakV3PlusClosures"
+
+ self flag:
+ 'Special selector send class must be inlined to agree with the interpreter, which
+ inlines class. If class is sent to e.g. a general instance of ProtoObject then unless
+ class is inlined there will be an MNU. It must be that the Cointerpreter and Cogit
+ have identical semantics. We get away with not hardwiring the other special
+ selectors either because in the Cointerpreter they are not inlined or because they
+ are inlined only to instances of classes for which there will always be a method.'.
+ self generatorTableFrom: #(
+ (1 0 15 genPushReceiverVariableBytecode needsFrameNever: 1)
+ (1 16 31 genPushTemporaryVariableBytecode 1)
+ (1 32 63 genPushLiteralConstantBytecode needsFrameNever: 1)
+ (1 64 95 genPushLiteralVariableBytecode needsFrameNever: 1)
+ (1 96 103 genStoreAndPopReceiverVariableBytecode needsFrameNever: -1) "N.B. not frameless if immutability"
+ (1 104 111 genStoreAndPopTemporaryVariableBytecode)
+ (1 112 112 genPushReceiverBytecode needsFrameNever: 1)
+ (1 113 113 genPushConstantTrueBytecode needsFrameNever: 1)
+ (1 114 114 genPushConstantFalseBytecode needsFrameNever: 1)
+ (1 115 115 genPushConstantNilBytecode needsFrameNever: 1)
+ (1 116 119 genPushQuickIntegerConstantBytecode needsFrameNever: 1)
+ "method returns in blocks need a frame because of nonlocalReturn:through:"
+ (1 120 120 genReturnReceiver return needsFrameIfInBlock: mappedInBlock 0)
+ (1 121 121 genReturnTrue return needsFrameIfInBlock: mappedInBlock 0)
+ (1 122 122 genReturnFalse return needsFrameIfInBlock: mappedInBlock 0)
+ (1 123 123 genReturnNil return needsFrameIfInBlock: mappedInBlock 0)
+ (1 124 124 genReturnTopFromMethod return needsFrameIfInBlock: mappedInBlock -1)
+ (1 125 125 genReturnTopFromBlock needsFrameNever: return -1)
+
+ (3 126 126 genDynamicSuperSendBytecode mapped) "Newspeak"
+ (2 127 127 genPushImplicitReceiverBytecode mapped) "Newspeak"
+
+ (2 128 128 extendedPushBytecode needsFrameNever: 1)
+ (2 129 129 extendedStoreBytecode)
+ (2 130 130 extendedStoreAndPopBytecode)
+ (2 131 131 genExtendedSendBytecode mapped)
+ (3 132 132 doubleExtendedDoAnythingBytecode mapped)
+ (2 133 133 genExtendedSuperBytecode mapped)
+ (2 134 134 genSecondExtendedSendBytecode mapped)
+ (1 135 135 genPopStackBytecode needsFrameNever: -1)
+ (1 136 136 duplicateTopBytecode needsFrameNever: 1)
+
+ (1 137 137 genPushActiveContextBytecode)
+ (2 138 138 genPushNewArrayBytecode)
+
+ (2 139 139 genPushExplicitOuterSendReceiverBytecode mapped) "Newspeak"
+
+ (3 140 140 genPushRemoteTempLongBytecode)
+ (3 141 141 genStoreRemoteTempLongBytecode)
+ (3 142 142 genStoreAndPopRemoteTempLongBytecode)
+ (4 143 143 genPushClosureCopyCopiedValuesBytecode block blockCodeS:i:z:e:)
+
+ (1 144 151 genShortUnconditionalJump forward shortForwardBranchDistance:)
+ (1 152 159 genShortJumpIfFalse forward false mapped "because of mustBeBoolean"
+ shortForwardBranchDistance:)
+ (2 160 163 genLongUnconditionalBackwardJump backward mapped "because of interrupt check"
+ longBranchDist:ance:)
+ (2 164 167 genLongUnconditionalForwardJump forward longBranchDist:ance:)
+ (2 168 171 genLongJumpIfTrue forward true mapped "because of mustBeBoolean"
+ longForwardBranchDist:ance:)
+ (2 172 175 genLongJumpIfFalse forward false mapped "because of mustBeBoolean"
+ longForwardBranchDist:ance:)
+
+ (1 176 176 genSpecialSelectorArithmetic mapped AddRR)
+ (1 177 177 genSpecialSelectorArithmetic mapped SubRR)
+ (1 178 178 genSpecialSelectorComparison mapped JumpLess)
+ (1 179 179 genSpecialSelectorComparison mapped JumpGreater)
+ (1 180 180 genSpecialSelectorComparison mapped JumpLessOrEqual)
+ (1 181 181 genSpecialSelectorComparison mapped JumpGreaterOrEqual)
+ (1 182 182 genSpecialSelectorComparison mapped JumpZero)
+ (1 183 183 genSpecialSelectorComparison mapped JumpNonZero)
+ (1 184 189 genSpecialSelectorSend mapped) " #* #/ #\\ #@ #bitShift: //"
+ (1 190 190 genSpecialSelectorArithmetic mapped AndRR)
+ (1 191 191 genSpecialSelectorArithmetic mapped OrRR)
+ (1 192 197 genSpecialSelectorSend mapped) "#at: #at:put: #size #next #nextPut: #atEnd"
+ (1 198 198 genSpecialSelectorEqualsEquals needsFrameNever: notMapped -1) "not mapped because it is directly inlined (for now)"
+ (1 199 199 genSpecialSelectorClass needsFrameNever: notMapped 0) "not mapped because it is directly inlined (for now)"
+ (1 200 207 genSpecialSelectorSend mapped) "#blockCopy: #value #value: #do: #new #new: #x #y"
+ (1 208 223 genSendLiteralSelector0ArgsBytecode mapped)
+ (1 224 239 genSendLiteralSelector1ArgBytecode mapped)
+ (1 240 255 genSendLiteralSelector2ArgsBytecode mapped))!
Item was added:
+ ----- Method: StackToRegisterMappingCogit class>>initializeBytecodeTableForSqueakV3PlusClosures (in category 'class initialization') -----
+ initializeBytecodeTableForSqueakV3PlusClosures
+ "StackToRegisterMappingCogit initializeBytecodeTableForSqueakV3PlusClosures"
+
+ self flag:
+ 'Special selector send class must be inlined to agree with the interpreter, which
+ inlines class. If class is sent to e.g. a general instance of ProtoObject then unless
+ class is inlined there will be an MNU. It must be that the Cointerpreter and Cogit
+ have identical semantics. We get away with not hardwiring the other special
+ selectors either because in the Cointerpreter they are not inlined or because they
+ are inlined only to instances of classes for which there will always be a method.'.
+ self generatorTableFrom: #(
+ (1 0 15 genPushReceiverVariableBytecode needsFrameNever: 1)
+ (1 16 31 genPushTemporaryVariableBytecode 1)
+ (1 32 63 genPushLiteralConstantBytecode needsFrameNever: 1)
+ (1 64 95 genPushLiteralVariableBytecode needsFrameNever: 1)
+ (1 96 103 genStoreAndPopReceiverVariableBytecode needsFrameNever: -1) "N.B. not frameless if immutability"
+ (1 104 111 genStoreAndPopTemporaryVariableBytecode)
+ (1 112 112 genPushReceiverBytecode needsFrameNever: 1)
+ (1 113 113 genPushConstantTrueBytecode needsFrameNever: 1)
+ (1 114 114 genPushConstantFalseBytecode needsFrameNever: 1)
+ (1 115 115 genPushConstantNilBytecode needsFrameNever: 1)
+ (1 116 119 genPushQuickIntegerConstantBytecode needsFrameNever: 1)
+ "method returns in blocks need a frame because of nonlocalReturn:through:"
+ (1 120 120 genReturnReceiver return needsFrameIfInBlock: mappedInBlock 0)
+ (1 121 121 genReturnTrue return needsFrameIfInBlock: mappedInBlock 0)
+ (1 122 122 genReturnFalse return needsFrameIfInBlock: mappedInBlock 0)
+ (1 123 123 genReturnNil return needsFrameIfInBlock: mappedInBlock 0)
+ (1 124 124 genReturnTopFromMethod return needsFrameIfInBlock: mappedInBlock -1)
+ (1 125 125 genReturnTopFromBlock needsFrameNever: return -1)
+
+ (1 126 127 unknownBytecode)
+
+ (2 128 128 extendedPushBytecode needsFrameNever: 1)
+ (2 129 129 extendedStoreBytecode)
+ (2 130 130 extendedStoreAndPopBytecode)
+ (2 131 131 genExtendedSendBytecode mapped)
+ (3 132 132 doubleExtendedDoAnythingBytecode mapped)
+ (2 133 133 genExtendedSuperBytecode mapped)
+ (2 134 134 genSecondExtendedSendBytecode mapped)
+ (1 135 135 genPopStackBytecode needsFrameNever: -1)
+ (1 136 136 duplicateTopBytecode needsFrameNever: 1)
+
+ (1 137 137 genPushActiveContextBytecode)
+ (2 138 138 genPushNewArrayBytecode)
+
+ (1 139 139 unknownBytecode)
+
+ (3 140 140 genPushRemoteTempLongBytecode)
+ (3 141 141 genStoreRemoteTempLongBytecode)
+ (3 142 142 genStoreAndPopRemoteTempLongBytecode)
+ (4 143 143 genPushClosureCopyCopiedValuesBytecode block blockCodeS:i:z:e:)
+
+ (1 144 151 genShortUnconditionalJump forward shortForwardBranchDistance:)
+ (1 152 159 genShortJumpIfFalse forward false mapped "because of mustBeBoolean"
+ shortForwardBranchDistance:)
+ (2 160 163 genLongUnconditionalBackwardJump backward mapped "because of interrupt check"
+ longBranchDist:ance:)
+ (2 164 167 genLongUnconditionalForwardJump forward longBranchDist:ance:)
+ (2 168 171 genLongJumpIfTrue forward true mapped "because of mustBeBoolean"
+ longForwardBranchDist:ance:)
+ (2 172 175 genLongJumpIfFalse forward false mapped "because of mustBeBoolean"
+ longForwardBranchDist:ance:)
+
+ (1 176 176 genSpecialSelectorArithmetic mapped AddRR)
+ (1 177 177 genSpecialSelectorArithmetic mapped SubRR)
+ (1 178 178 genSpecialSelectorComparison mapped JumpLess)
+ (1 179 179 genSpecialSelectorComparison mapped JumpGreater)
+ (1 180 180 genSpecialSelectorComparison mapped JumpLessOrEqual)
+ (1 181 181 genSpecialSelectorComparison mapped JumpGreaterOrEqual)
+ (1 182 182 genSpecialSelectorComparison mapped JumpZero)
+ (1 183 183 genSpecialSelectorComparison mapped JumpNonZero)
+ (1 184 189 genSpecialSelectorSend mapped) " #* #/ #\\ #@ #bitShift: //"
+ (1 190 190 genSpecialSelectorArithmetic mapped AndRR)
+ (1 191 191 genSpecialSelectorArithmetic mapped OrRR)
+ (1 192 197 genSpecialSelectorSend mapped) "#at: #at:put: #size #next #nextPut: #atEnd"
+ (1 198 198 genSpecialSelectorEqualsEquals needsFrameNever: notMapped -1) "not mapped because it is directly inlined (for now)"
+ (1 199 199 genSpecialSelectorClass needsFrameNever: notMapped 0) "not mapped because it is directly inlined (for now)"
+ (1 200 207 genSpecialSelectorSend mapped) "#blockCopy: #value #value: #do: #new #new: #x #y"
+ (1 208 223 genSendLiteralSelector0ArgsBytecode mapped)
+ (1 224 239 genSendLiteralSelector1ArgBytecode mapped)
+ (1 240 255 genSendLiteralSelector2ArgsBytecode mapped))!
Item was changed:
----- Method: StackToRegisterMappingCogit class>>initializeWithOptions: (in category 'class initialization') -----
initializeWithOptions: optionsDictionary
+ super initializeWithOptions: optionsDictionary.
- self initializeMiscConstantsWith: optionsDictionary. "must preceed other initialization."
- self initializeBytecodeTableForClosureV3.
- self initializePrimitiveTableForSqueakV3.
self initializeSimStackConstants!
Item was changed:
----- Method: VMMaker>>buildCodeGeneratorForCogit: (in category 'generate sources') -----
buildCodeGeneratorForCogit: getAPIMethods
"Answer the code generator for translating the cogit."
| cg cogitClass cogitClasses apicg |
cg := self createCogitCodeGenerator.
cg vmClass: (cogitClass := self cogitClass).
+ { cogitClass. self interpreterClass } do:
+ [:cgc|
+ (cgc respondsTo: #initializeWithOptions:)
+ ifTrue: [cgc initializeWithOptions: optionsDictionary]
+ ifFalse: [cgc initialize]].
+
cogitClasses := OrderedCollection new.
[cogitClasses addFirst: cogitClass.
cogitClass ~~ Cogit
and: [cogitClass inheritsFrom: Cogit]] whileTrue:
[cogitClass := cogitClass superclass].
cogitClasses addFirst: VMClass.
cogitClasses addAllLast: self cogitClass ancilliaryClasses.
- cogitClasses, { self interpreterClass } do:
- [:cgc|
- (cgc respondsTo: #initializeWithOptions:)
- ifTrue: [cgc initializeWithOptions: optionsDictionary]
- ifFalse: [cgc initialize]].
cogitClasses do: [:cgc| cg addClass: cgc].
(cg structClassesForTranslationClasses: cogitClasses) do:
[:structClass| cg addStructClass: structClass].
getAPIMethods ifTrue:
[apicg := self buildCodeGeneratorForInterpreter: false.
cg apiMethods: apicg selectAPIMethods].
^cg!
More information about the Vm-dev
mailing list