Yay! :) I have zero assembly skills��� I���ve tried the following but then get an ���undefined label done18��� error:
NBExternalObject>>pushAsPointer: gen
"push a pointer to handle value"
| asm proxy oop notNil done |
proxy := gen proxy.
asm := gen asm.
<<<<<<<<<<<<<< new
done := asm uniqueLabelName: 'done���.
>>>>>>>>>>>>>>> new
oop := gen reserveTemp.
loader emitLoad: gen to: oop.
<<<<<<<<<<<<<< new
"handle nils, if we care"
gen optCoerceNilToNull
ifTrue: [
notNil := asm uniqueLabelName: 'notNil'.
proxy nilObject.
asm cmp: asm EAX with: oop;
jne: notNil;
xor: asm EAX with: asm EAX;
jmp: done;
label: notNil ]
ifFalse: [
"we can skip class verification, if loader loads receiver, since nothing to fear there"
loader isReceiver ifFalse: [
self verifyClassOf: oop is: objectClass generator: gen.
] ].
>>>>>>>>>>>>>>> new
proxy fetchPointer: (self handleIvarIndex) ofObject: oop. "handle ivar"
proxy varBytesFirstFieldOf: asm EAX. "handle value ptr"
asm push: asm EAX.
gen releaseTemps: 1.
Ok, I think I understand. Are you saying that, since NULL is a macro, you have no way of telling during runtime how NULL is defined? For a pointer it is simply 0 or (void *) 0, but for a non pointer it depends on the context. Is that about right?