[BUG?] [FIX?] pruning too much in C-code generation

Lex Spoon lex at cc.gatech.edu
Sat Jul 24 22:42:52 UTC 1999


Does it make sense to put pluggable primitives right inside the interp.c file?  It would seem so in some cases.

Assuming this is right, #pruneUnreachableMethods should be careful not to remove methods which are being exported, even if they can't be called directly.  One easy fix would be to add a line like this before the second blank line in #pruneUnreachableMethods:

	retain addAll: (methods select: [ :m | m export] thenCollect: [ :m | m selector ]).

The whole method after this change is appended.  FWIW, it seems to work for me....

	-Lex


pruneUnreachableMethods
	"Remove any methods that are not reachable. Retain methods needed by the BitBlt operation table, primitives, plug-ins, or interpreter support code."
 
	| retain |
	"Build a set of selectors for methods that should be output even though they have no apparent callers. Some of these are stored in tables for indirect lookup, some are called by the C support code or by primitives."
	retain _ BitBltSimulation opTable asSet.
	#(checkedLongAt: fullDisplayUpdate interpret nullCompilerHook printCallStack readImageFromFile:HeapSize: setCompilerInitialized: success:)
		do: [:sel | retain add: sel].
	InterpreterProxy organization categories do: [:cat |
		((cat ~= 'initialize') and: [cat ~= 'private']) ifTrue: [
			retain addAll: (InterpreterProxy organization listAtCategoryNamed: cat)]].
	retain addAll: (methods select: [ :m | m export] thenCollect: [ :m | m selector ]).

	"Remove all the unreachable methods that aren't retained for the reasons above."
	self unreachableMethods do: [:sel |
		(retain includes: sel) ifFalse: [
			methods removeKey: sel ifAbsent: []]].





More information about the Squeak-dev mailing list