Skip to content

Instantly share code, notes, and snippets.

@seandenigris
Created December 5, 2011 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seandenigris/1434823 to your computer and use it in GitHub Desktop.
Save seandenigris/1434823 to your computer and use it in GitHub Desktop.
Cog VM (Squeak/Pharo Smalltalk) Hack: Skip Message Send (Smalltalk part)
commonSend
"Send a message, starting lookup with the receiver's class."
"Assume: messageSelector and argumentCount have been set, and that
the receiver and arguments have been pushed onto the stack,"
"Note: This method is inlined into the interpreter dispatch loop."
<sharedCodeNamed: 'commonSend' inCase: 131>
self sendBreak: messageSelector + BaseHeaderSize
point: (objectMemory lengthOf: messageSelector)
receiver: (self internalStackValue: argumentCount).
cogit recordSendTrace ifTrue:
[self recordTrace: lkupClass thing: messageSelector source: TraceIsFromInterpreter.
cogit printOnTrace ifTrue:
[self printActivationNameForSelector: messageSelector startClass: lkupClass; cr]].
"This hook will not work until we tweak the C source code"
messageSelector = #skipMe:
ifTrue: [ "we will manually insert code here" ]
ifFalse: [
self internalFindNewMethod.
self internalExecuteNewMethod ].
self fetchNextBytecode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment