Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2826.mcz ==================== Summary ==================== Name: VMMaker.oscog-eem.2826 Author: eem Time: 26 September 2020, 7:40:24.668927 pm UUID: 0dd1c326-6391-497c-896b-b605178640de Ancestors: VMMaker.oscog-eem.2825 InterpreterPlugins: Reduce the duplication of the Alien decoding functions. Provide isAlien: =============== Diff against VMMaker.oscog-eem.2825 =============== Item was changed: ----- Method: IA32ABIPlugin>>primSizeField (in category 'primitives-accessing') ----- primSizeField "Answer the signed 32- or 64-bit integer comprising the size field (the first 32- or 64-bit field)." "<Alien> primSizeField ^<Integer> <primitive: 'primSizeField' error: errorCode module: 'IA32ABI'>" + | rcvr valueOop | - | rcvr value valueOop | <export: true> rcvr := interpreterProxy stackValue: 0. + valueOop := interpreterProxy wordSize = 8 + ifTrue: [interpreterProxy signed64BitIntegerFor: (self longAt: rcvr + interpreterProxy baseHeaderSize) signedIntFromLong64] + ifFalse: [interpreterProxy signed32BitIntegerFor:(self longAt: rcvr + interpreterProxy baseHeaderSize) signedIntFromLong]. - value := self cppIf: interpreterProxy bytesPerOop = 8 - ifTrue: [(self longAt: rcvr + interpreterProxy baseHeaderSize) signedIntFromLong64] - ifFalse: [(self longAt: rcvr + interpreterProxy baseHeaderSize) signedIntFromLong]. - valueOop := self signedMachineIntegerFor: value. ^interpreterProxy methodReturnValue: valueOop! Item was removed: - ----- Method: IA32ABIPlugin>>sizeField: (in category 'private-support') ----- - sizeField: rcvr - "Answer the first field of rcvr which is assumed to be an Alien of at least 8 bytes" - <inline: true> - ^self longAt: rcvr + interpreterProxy baseHeaderSize! Item was removed: - ----- Method: IA32ABIPlugin>>startOfData: (in category 'private-support') ----- - startOfData: rcvr "<Alien oop> ^<Integer>" - "Answer the start of rcvr's data. For direct aliens this is the address of - the second field. For indirect and pointer aliens it is what the second field points to." - <inline: true> - ^(self sizeField: rcvr) > 0 - ifTrue: [rcvr + interpreterProxy baseHeaderSize + interpreterProxy bytesPerOop] - ifFalse: [self longAt: rcvr + interpreterProxy baseHeaderSize + interpreterProxy bytesPerOop]! Item was added: + ----- Method: InterpreterPlugin>>isAlien: (in category 'alien support') ----- + isAlien: oop + "Answer if oop is an Alien. We could ask if isWordsOrBytes: first, but that doesn't help. We still have to do the is:KindOf: walk. + We're not interested in fast falsehood, but as fast as possible truth, and with the current API this is it." + <inline: true> + ^interpreterProxy is: oop KindOf: interpreterProxy classAlien! Item was added: + ----- Method: InterpreterPlugin>>sizeField: (in category 'alien support') ----- + sizeField: alienOop + "Answer the size field of an alienOop which is assumed to be an Alien of at least 8 bytes (32-bits) or 16 bytes (64 bits)" + <inline: true> + ^self longAt: alienOop + interpreterProxy baseHeaderSize! Item was added: + ----- Method: InterpreterPlugin>>startOfData: (in category 'alien support') ----- + startOfData: alienOop + "Answer the start of an Alien's data. For direct aliens this is the address of the second field. + For indirect and pointer aliens it is what the second field points to." + ^(self sizeField: alienOop) > 0 + ifTrue: [alienOop + interpreterProxy baseHeaderSize + interpreterProxy bytesPerOop] + ifFalse: [self longAt: alienOop + interpreterProxy baseHeaderSize + interpreterProxy bytesPerOop]! Item was removed: - ----- Method: ThreadedFFIPlugin>>sizeField: (in category 'primitive support') ----- - sizeField: oop - "Answer the first field of oop which is assumed to be an Alien of at least 8 bytes" - <inline: true> - ^self longAt: oop + interpreterProxy baseHeaderSize! Item was removed: - ----- Method: ThreadedFFIPlugin>>startOfData: (in category 'primitive support') ----- - startOfData: oop "<Alien oop> ^<Integer>" - "Answer the start of oop's data. For direct aliens this is the address of - the second field. For indirect and pointer aliens it is what the second field points to." - <inline: true> - ^(self sizeField: oop) > 0 - ifTrue: [oop + interpreterProxy baseHeaderSize + interpreterProxy bytesPerOop] - ifFalse: [self longAt: oop + interpreterProxy baseHeaderSize + interpreterProxy bytesPerOop]! |
Free forum by Nabble | Edit this page |