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

commits at source.squeak.org commits at source.squeak.org
Wed Aug 28 17:58:59 UTC 2013


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

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

Name: VMMaker-eem.323
Author: eem
Time: 28 August 2013, 10:57:48.144 am
UUID: 05aa46ce-aac1-485a-924b-92c61239d600
Ancestors: VMMaker-dtl.322

Merge RePlugin with Cog VMMaker.oscog-eem.337.
.
Merge RePlugin fix for
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=710375
http://bugs.squeak.org/view.php?id=7785
(pcre_info => pcre_fullinfo).

Fix prim arg count for primPCREExecfromto.

Merge Cog compilation warning fixes for rePluginFree: &
rePluginMalloc:.

=============== Diff against VMMaker-dtl.322 ===============

Item was changed:
  ----- Method: RePlugin>>primPCREExecfromto (in category 're primitives') -----
  primPCREExecfromto
  
+ "<rcvr primPCREExec: searchObject from: fromInteger to: toInteger>, where rcvr is an object with instance variables:
- "<rcvr primPCREExec: searchObject> from: fromInteger to: toInteger>, where rcvr is an object with instance variables:
  
  	'patternStr compileFlags pcrePtr extraPtr errorStr errorOffset matchFlags'	
  
  Apply the regular expression (stored in <pcrePtr> and <extratr>, generated from calls to primPCRECompile), to smalltalk String searchObject using <matchOptions>, beginning at offset <fromInteger> and continuing until offset <toInteger>.  If there is no match, answer nil.  Otherwise answer a ByteArray of offsets representing the results of the match."
  
  	| searchObject searchBuffer length  result matchSpacePtr matchSpaceSize fromInteger toInteger |
  	<export: true>
  	<var:#searchBuffer	type: 'char *'>
  	<var:#matchSpacePtr	type: 'int *'>
  	
  	"Load Parameters"
  	toInteger := interpreterProxy stackIntegerValue: 0.
  	fromInteger := interpreterProxy stackIntegerValue: 1.
  	searchObject := interpreterProxy stackObjectValue: 2.	
  	searchBuffer := interpreterProxy arrayValueOf: searchObject.
  	length := interpreterProxy byteSizeOf: searchObject.
  	self loadRcvrFromStackAt: 3.
  
  	"Validate parameters"
  	interpreterProxy success: (1 <= fromInteger).
  	interpreterProxy success: (toInteger<=length).
  	fromInteger := fromInteger - 1. "Smalltalk offsets are 1-based"
  	interpreterProxy success: (fromInteger<=toInteger).
  
  	"adjust length, searchBuffer"
  	length := toInteger - fromInteger.
  	searchBuffer := searchBuffer + fromInteger.
  
  	"Load Instance Variables"
  	pcrePtr := self rcvrPCREBufferPtr.
  	extraPtr := self rcvrExtraPtr.
  	matchFlags := self rcvrMatchFlags.
  	matchSpacePtr := self rcvrMatchSpacePtr.
  	matchSpaceSize := self rcvrMatchSpaceSize.
  	interpreterProxy failed ifTrue:[^ nil].
  	
  	result := self 
  		cCode: 'pcre_exec((pcre *)pcrePtr, (pcre_extra *)extraPtr, 
  				searchBuffer, length, 0, matchFlags, matchSpacePtr, matchSpaceSize)'.
+ 	interpreterProxy pop: 4; pushInteger: result.
- 	interpreterProxy pop: 2; pushInteger: result.
  
  	"empty call so compiler doesn't bug me about variables not used"
  	self touch: searchBuffer; touch: matchSpacePtr; touch: matchSpaceSize; touch: length
  !

Item was changed:
  ----- Method: RePlugin>>primPCRENumSubPatterns (in category 're primitives') -----
  primPCRENumSubPatterns
  
  "<rcvr primPCRENumSubPatterns>, where rcvr is an object with instance variables:
  
  	'patternStr compileFlags pcrePtr extraPtr errorStr errorOffset matchFlags'	
  
  Return the number of subpatterns captured by the compiled pattern."
  
  	<export: true>
+ 	| ncap |
- 	
  	"Load Parameters"
  	self loadRcvrFromStackAt: 0.
  	"Load Instance Variables"
  	pcrePtr := self rcvrPCREBufferPtr.
+ 	self cCode: 'pcre_fullinfo((const pcre *)pcrePtr, NULL, PCRE_INFO_CAPTURECOUNT, &ncap)'
+ 		inSmalltalk: [ncap := -1].
+ 	interpreterProxy pop: 1; pushInteger: ncap.
- 	interpreterProxy pop: 1; pushInteger: (self cCode: 'pcre_info((pcre *)pcrePtr, NULL, NULL)').
  !

Item was changed:
  ----- Method: RePlugin>>rePluginFree: (in category 'memory management') -----
  rePluginFree: aPointer
  	"Free a block of fixed memory allocated with rePluginMalloc.  Instrumented version of C free() to facilitate leak analysis from Smalltalk.   OS-specific variations on malloc/free, such as with MacOS, are handled by adding a C macro to the header file redefining malloc/free -- see the class comment"
  
+ 	<inline: true>
- 	<inline: false>
  	<var: #aPointer type: 'void * '>
  	<returnTypeC: 'void'>
  
  	numFrees := numFrees + 1.
+ 	aPointer notNil ifTrue: [self free: aPointer]	!
- 	(aPointer)
- 		ifTrue: [self cCode: 'free(aPointer)']	!

Item was changed:
  ----- Method: RePlugin>>rePluginMalloc: (in category 'memory management') -----
  rePluginMalloc: anInteger
  	"Allocate a block of fixed memory using C calls to malloc().  Instrumented to facilitate leak analysis from Smalltalk.  Set global lastAlloc to anInteger.  OS-specific variations on malloc/free, such as with MacOS, are handled by adding a C macro to the header file redefining malloc/free -- see the class comment"
  
  	| aPointer |
+ 	<inline: true>
- 	<export: true>
- 	<inline: false>
  	<var: #anInteger type: 'size_t '>
  	<var: #aPointer type: 'void *'>
  	<returnTypeC: 'void *'>
  	numAllocs := numAllocs + 1.
+ 	(aPointer := self malloc: anInteger) notNil ifTrue:
+ 		[lastAlloc := anInteger].
- 	(aPointer := self cCode: 'malloc(anInteger)')
- 		ifTrue: [lastAlloc := anInteger].
  	^aPointer
  !



More information about the Vm-dev mailing list