[Vm-dev] VM Maker: VMMaker.oscog-eem.3193.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Jun 18 19:33:05 UTC 2022


Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3193.mcz

==================== Summary ====================

Name: VMMaker.oscog-eem.3193
Author: eem
Time: 18 June 2022, 12:32:51.434311 pm
UUID: 1e6f2357-e233-4291-bdce-2b9a24fc617d
Ancestors: VMMaker.oscog-eem.3192

Fix regressions in ImageLeakChecker after not so recent changes.

=============== Diff against VMMaker.oscog-eem.3192 ===============

Item was changed:
  ----- Method: ImageLeakChecker class>>declareCVarsIn: (in category 'translation') -----
  declareCVarsIn: aCCodeGenerator
  	self declareInterpreterVersionIn: aCCodeGenerator defaultName: 'ImageChecker'.
  	aCCodeGenerator
  		var: #interpreterProxy  type: #'struct VirtualMachine*'.
  	"Do this to avoid redefining interp.h when we generate the image checker.  i.e. agree with StackInterpereter class's version above."
  	aCCodeGenerator addConstantForBinding: (self bindingOf: #MULTIPLEBYTECODESETS).
+ 	#('checkAllocFiller' 'externalPrimitiveTable' 'pcPreviousToFunction' 'primitiveTable' 'primitiveAccessorDepthTable' 'stackPages') do:
- 	#('checkAllocFiller' 'primitiveTable' 'primitiveAccessorDepthTable' 'stackPages') do:
  		[:surplus| aCCodeGenerator removeVariable: surplus]!

Item was changed:
  ----- Method: ImageLeakChecker class>>preGenerationHook: (in category 'translation') -----
  preGenerationHook: aCCodeGen
  	"Attempt to nuke everything we don't need in our hierarchy.  We will leave the
  	 pruning of most of methods in the memory manager hierarchy to the code generator."
  	| interpreterSelectors toBeRemoved |
  	toBeRemoved := Set withAll: (interpreterSelectors := StackInterpreter selectors, InterpreterPrimitives selectors).
  
  	"Now make sure we *don't* remove any of the following.  These we need."
  	{self selectors.
  	  #(addressCouldBeClassObj: checkAssumedCompactClasses fetchStackPointerOf:
  		highBit: is:KindOfClass: includesBehavior:ThatOf: initializeExtraClassInstVarIndices initializeInterpreter:
  		literalCountOfAlternateHeader: maybeSelectorOfMethod: maybeFixClonedCompiledMethod:
+ 		object:equalsString: object:equalsString:ofSize: objCouldBeClassObj: primitiveFail primitiveFailFor: successful superclassOf:).
- 		objCouldBeClassObj: primitiveFail primitiveFailFor: successful superclassOf:).
  	  (StackInterpreter methodsInCategory: #'debug printing') reject:
  		[:s1| #('Context' 'Frame' 'Proc' "Procs and Process" 'Stack') anySatisfy: [:s2| s1 includesSubstring: s2]].
  	  StackInterpreter methodsInCategory: #'compiled methods'.
  	  StackInterpreter methodsInCategory: #'frame access'.
  	  StackInterpreter methodsInCategory: #'image save/restore'.
  	 interpreterSelectors select: [:s| s includesSubstring: 'Alien'].
  	 "the ^self methods are usually no-op stubs overridden in CoInterpreter; we want these."
  	  interpreterSelectors select: [:s| ((StackInterpreter whichClassIncludesSelector: s) >> s) isReturnSelf].
  	  "And include all the isFoo methods..."
  	  interpreterSelectors select: [:s| s size > 2 and: [(s beginsWith: 'is') and: [s third isUppercase]]]} do:
  		[:selectors|
  		 toBeRemoved removeAll: (selectors intersection: toBeRemoved)].
  
  	"These we explicitly prune; they're used by InterpreterProxy and/or the Cogit and/or pieces of machinery we don't want"
  	toBeRemoved addAll: #(indexOf:in: instantiateClass:indexableSize: integerValueOf:
  							maybeMethodClassOf:seemsToBeInstantiating: remapObj:).
  
  	aCCodeGen pruneMethods: toBeRemoved.
  	aCCodeGen sortedExportMethods do:
  		[:tm| tm export: false]!

Item was changed:
  ----- Method: ImageLeakChecker class>>preambleCCode (in category 'translation') -----
  preambleCCode
  
  	"readImageFromFile:HeapSizeStartingAt is declared public in sq.h, so it has to be exported,
  	 but some weird bug with clang clang-1000.11.45.5 makes it complian that _m is undecared in this:
  
  		static char _m[] = "";
  		void* vm_exports[][3] = {
  		    {(void*)_m, ''readImageFromFileHeapSizeStartingAt'', (void*)readImageFromFileHeapSizeStartingAt},
  		    {NULL, NULL, NULL}
  		};
  
  	 so we hack around it by redefining readImageFromFileHeapSizeStartingAt after sq.h is included and keep
+ 	 our version of it private, and hence have no exports, avoiding generating the offending code above.
+ 
+ 	Then in main:_: we use PharoVM which may or may not be defined."
- 	 our version of it private, and hence have no exports, avoiding generating the offending code above."
  	
  	^super preambleCCode,
  		('\#define readImageFromFileHeapSizeStartingAt readImageFromFile\',
+ 		 '#if !!defined(PharoVM)\# define PharoVM 0\#endif\\',
+ 		 '\void error(const char *msg) {\  warning(msg);\  abort();\}\\') withCRs!
- 		 '\void error(char *msg) {\  warning(msg);\  abort();\}\\') withCRs!



More information about the Vm-dev mailing list