Dynamically linking to smalltalk objects

I am planning to implement dynamic binding to my smalltalk dialect. The problem is how to pass messages to work with dynamic linking.

Passing messages in itself is simple: a message with a selector is sent to an object, the object selects a method that matches the selector from its protocol, then processes the data complete with the message and returns the result.

In image-based implementations, messaging can be implemented very simply: your message selectors can be integers translated from the global symbol table, your protocols can be just hash tables with integers and addresses in them. Assuming it all compiled into one big image with this global symbol table.

In dynamic linking, you cannot accept a symbol table pointing to the correct selector. You can work around the problem by using strings as your selectors, but you doom the language more slowly.

There's one way to go, and it involves copying the protocols and the selector table so the process can move them around correctly. But that sounds like a lot of work.

Are there any better ways to solve this problem? Also, is dynamic linking worth it? How could I implement movement for selectors and protocols?

0


source to share


1 answer


You can of course accept a global symbol table, you just need to update it and ensure at link time that codes only use symbol instances from that table. Have you looked at Squeak? The download code is an image layer (not a virtual machine), so it is easy to view from any Squeak image.



0


source







All Articles