Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: 3b11fcf05214243cba7bacfba42afbe8e97f3aaf
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/3b11fcf05214243cba…
Author: Eliot Miranda <eliot.miranda(a)gmail.com>
Date: 2016-09-07 (Wed, 07 Sep 2016)
Changed paths:
M nsspur64src/vm/cogit.h
M nsspur64src/vm/cogitX64.c
M nsspur64src/vm/cointerp.c
M nsspur64src/vm/cointerp.h
M nsspur64src/vm/gcc3x-cointerp.c
M nsspursrc/vm/cogit.h
M nsspursrc/vm/cogitARMv5.c
M nsspursrc/vm/cogitIA32.c
M nsspursrc/vm/cogitMIPSEL.c
M nsspursrc/vm/cointerp.c
M nsspursrc/vm/cointerp.h
M nsspursrc/vm/gcc3x-cointerp.c
M nsspurstack64src/vm/gcc3x-interp.c
M nsspurstack64src/vm/interp.c
M nsspurstacksrc/vm/gcc3x-interp.c
M nsspurstacksrc/vm/interp.c
M spur64src/vm/cogit.h
M spur64src/vm/cogitX64.c
M spur64src/vm/cointerp.c
M spur64src/vm/cointerp.h
M spur64src/vm/gcc3x-cointerp.c
A spursista64src/examplePlugins.ext
A spursista64src/examplePlugins.int
A spursista64src/vm/cogit.c
A spursista64src/vm/cogit.h
A spursista64src/vm/cogitX64.c
A spursista64src/vm/cogmethod.h
A spursista64src/vm/cointerp.c
A spursista64src/vm/cointerp.h
A spursista64src/vm/exampleSqNamedPrims.h
A spursista64src/vm/gcc3x-cointerp.c
A spursista64src/vm/interp.h
A spursista64src/vm/vmCallback.h
M spursistasrc/vm/cogit.h
M spursistasrc/vm/cogitARMv5.c
M spursistasrc/vm/cogitIA32.c
M spursistasrc/vm/cogitMIPSEL.c
M spursistasrc/vm/cointerp.c
M spursistasrc/vm/cointerp.h
M spursistasrc/vm/gcc3x-cointerp.c
M spursrc/vm/cogit.h
M spursrc/vm/cogitARMv5.c
M spursrc/vm/cogitIA32.c
M spursrc/vm/cogitMIPSEL.c
M spursrc/vm/cointerp.c
M spursrc/vm/cointerp.h
M spursrc/vm/gcc3x-cointerp.c
M spurstack64src/vm/gcc3x-interp.c
M spurstack64src/vm/interp.c
M spurstacksrc/vm/gcc3x-interp.c
M spurstacksrc/vm/interp.c
M src/vm/cogit.h
M src/vm/cogitARMv5.c
M src/vm/cogitIA32.c
M src/vm/cogitMIPSEL.c
M src/vm/cointerp.c
M src/vm/cointerp.h
M src/vm/cointerpmt.c
M src/vm/cointerpmt.h
M src/vm/gcc3x-cointerp.c
M src/vm/gcc3x-cointerpmt.c
M stacksrc/vm/gcc3x-interp.c
M stacksrc/vm/interp.c
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.1950
Fix a callback bug that was triggered when using multiple bytecode sets (set
the method back to the callout method on all return paths).
Add MoveRA32 and MoveA32R support for Sista on x64. Add spursista64src.
Ronie Salgado Faila uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-rsf.1949.mcz
==================== Summary ====================
Name: VMMaker.oscog-rsf.1949
Author: rsf
Time: 7 September 2016, 3:10:29.660502 pm
UUID: 535f71f9-3f14-4e9f-9c50-73ac9fa568ef
Ancestors: VMMaker.oscog-eem.1948
Fix a callback bug that was triggered when using multiples bytecode sets.
=============== Diff against VMMaker.oscog-eem.1948 ===============
Item was changed:
----- Method: StackInterpreter>>returnAs:ThroughCallback:Context: (in category 'callback support') -----
returnAs: returnTypeOop ThroughCallback: vmCallbackContext Context: callbackMethodContext
"callbackMethodContext is an activation of invokeCallback:[stack:registers:jmpbuf:].
Its sender is the VM's state prior to the callback. Reestablish that state (via longjmp),
and mark callbackMethodContext as dead."
<export: true>
<var: #vmCallbackContext type: #'VMCallbackContext *'>
| calloutMethodContext theFP thePage |
<var: #theFP type: #'char *'>
<var: #thePage type: #'StackPage *'>
((self isIntegerObject: returnTypeOop)
and: [self isLiveContext: callbackMethodContext]) ifFalse:
[^false].
calloutMethodContext := self externalInstVar: SenderIndex ofContext: callbackMethodContext.
(self isLiveContext: calloutMethodContext) ifFalse:
[^false].
"We're about to leave this stack page; must save the current frame's instructionPointer."
self push: instructionPointer.
self externalWriteBackHeadFramePointers.
"Mark callbackMethodContext as dead; the common case is that it is the current frame.
We go the extra mile for the debugger."
(self isSingleContext: callbackMethodContext)
ifTrue: [self markContextAsDead: callbackMethodContext]
ifFalse:
[theFP := self frameOfMarriedContext: callbackMethodContext.
framePointer = theFP "common case"
ifTrue:
[(self isBaseFrame: theFP)
ifTrue: [stackPages freeStackPage: stackPage]
ifFalse: "calloutMethodContext is immediately below on the same page. Make it current."
[instructionPointer := (self frameCallerSavedIP: framePointer) asUnsignedInteger.
stackPointer := framePointer + (self frameStackedReceiverOffset: framePointer) + objectMemory wordSize.
framePointer := self frameCallerFP: framePointer.
+ self setMethod: (self frameMethod: framePointer).
self restoreCStackStateForCallbackContext: vmCallbackContext.
"N.B. siglongjmp is defines as _longjmp on non-win32 platforms.
This matches the use of _setjmp in ia32abicc.c."
self siglong: vmCallbackContext trampoline jmp: (self integerValueOf: returnTypeOop).
^true]]
ifFalse:
[self externalDivorceFrame: theFP andContext: callbackMethodContext.
self markContextAsDead: callbackMethodContext]].
"Make the calloutMethodContext the active frame. The case where calloutMethodContext
is immediately below callbackMethodContext on the same page is handled above."
(self isStillMarriedContext: calloutMethodContext)
ifTrue:
[theFP := self frameOfMarriedContext: calloutMethodContext.
thePage := stackPages stackPageFor: theFP.
"findSPOf:on: points to the word beneath the instructionPointer, but
there is no instructionPointer on the top frame of the current page."
self assert: thePage ~= stackPage.
stackPointer := (self findSPOf: theFP on: thePage) - objectMemory wordSize.
framePointer := theFP]
ifFalse:
[thePage := self makeBaseFrameFor: calloutMethodContext.
framePointer := thePage headFP.
stackPointer := thePage headSP].
instructionPointer := self popStack.
self setMethod: (objectMemory fetchPointer: MethodIndex ofObject: calloutMethodContext).
self setStackPageAndLimit: thePage.
self restoreCStackStateForCallbackContext: vmCallbackContext.
"N.B. siglongjmp is defines as _longjmp on non-win32 platforms.
This matches the use of _setjmp in ia32abicc.c."
self siglong: vmCallbackContext trampoline jmp: (self integerValueOf: returnTypeOop).
"NOTREACHED"
^true!
Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: bce1958136cca35f193b76804aa9957abd6a3e64
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/bce1958136cca35f19…
Author: Eliot Miranda <eliot.miranda(a)gmail.com>
Date: 2016-09-07 (Wed, 07 Sep 2016)
Changed paths:
A build.macos32x86/pharo.stack.spur/Makefile
A build.macos32x86/pharo.stack.spur/mvm
A build.macos32x86/pharo.stack.spur/plugins.ext
A build.macos32x86/pharo.stack.spur/plugins.int
M nsspur64src/vm/cogit.h
M nsspur64src/vm/cogitX64.c
M nsspur64src/vm/cointerp.c
M nsspur64src/vm/cointerp.h
M nsspur64src/vm/gcc3x-cointerp.c
M nsspursrc/vm/cogit.h
M nsspursrc/vm/cogitARMv5.c
M nsspursrc/vm/cogitIA32.c
M nsspursrc/vm/cogitMIPSEL.c
M nsspursrc/vm/cointerp.c
M nsspursrc/vm/cointerp.h
M nsspursrc/vm/gcc3x-cointerp.c
M nsspurstack64src/vm/gcc3x-interp.c
M nsspurstack64src/vm/interp.c
M nsspurstacksrc/vm/gcc3x-interp.c
M nsspurstacksrc/vm/interp.c
M spur64src/vm/cogit.h
M spur64src/vm/cogitX64.c
M spur64src/vm/cointerp.c
M spur64src/vm/cointerp.h
M spur64src/vm/gcc3x-cointerp.c
M spursistasrc/vm/cogit.h
M spursistasrc/vm/cogitARMv5.c
M spursistasrc/vm/cogitIA32.c
M spursistasrc/vm/cogitMIPSEL.c
M spursistasrc/vm/cointerp.c
M spursistasrc/vm/cointerp.h
M spursistasrc/vm/gcc3x-cointerp.c
M spursrc/vm/cogit.h
M spursrc/vm/cogitARMv5.c
M spursrc/vm/cogitIA32.c
M spursrc/vm/cogitMIPSEL.c
M spursrc/vm/cointerp.c
M spursrc/vm/cointerp.h
M spursrc/vm/gcc3x-cointerp.c
M spurstack64src/vm/gcc3x-interp.c
M spurstack64src/vm/interp.c
M spurstacksrc/vm/gcc3x-interp.c
M spurstacksrc/vm/interp.c
M src/vm/cogit.h
M src/vm/cogitARMv5.c
M src/vm/cogitIA32.c
M src/vm/cogitMIPSEL.c
M src/vm/cointerp.c
M src/vm/cointerp.h
M src/vm/cointerpmt.c
M src/vm/cointerpmt.h
M src/vm/gcc3x-cointerp.c
M src/vm/gcc3x-cointerpmt.c
M stacksrc/vm/gcc3x-interp.c
M stacksrc/vm/interp.c
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.1948
General:
Fix off-by-one error in an assert
Fixes related to Immutability / read-only objects:
- weak structures can't be mmutable
- primitiveStringReplace fails if the receier is immutable only if it attempts to mutate something.
SistaBytecodeSet/FullBlocks:
Re-enabled full block compilation to machine code.
Fix marryFrame:SP:copyTemps: for full blocks; the closureOrNil field must
still be set. Add an assert to primitiveFindNextUnwindContext that caught a
side-effect of the bug.
Added assertion ensuring that when a method is jitted, the compiled code
jitted is a compiled method and when a block is jitted, the compiled code
jitted is a compiled block.
Improve stack backtrace printing for full blocks.
Disabled 2 paths compiltion on full blocks.
Find the home of a full block for context printing. Fix pc mapping for full
block closures (mustMapMachineCodePC:context:).
In the Cogit change inBlock to be an integer value, 0 for methods, 1 for
vannilla blocks and 2 for full blocks (to reuce the amount of refactoring
now and when removing vanilla block support some time in the future).
Add trampolines for creating small and large full block contexts in the Spur
object representation.
Get frameless full block prolog generation more correct than it was ;-)
Added a deny to ensure the block can be frameless. Works both for blocks and
full blocks.
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1948.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.1948
Author: eem
Time: 7 September 2016, 2:25:30.049917 pm
UUID: 7725d8e2-28a4-4f42-9231-1df18e655857
Ancestors: VMMaker.oscog-eem.1947
Fix off-by-one error in an assert
=============== Diff against VMMaker.oscog-eem.1947 ===============
Item was changed:
----- Method: CoInterpreter>>externalInstVar:ofContext: (in category 'frame access') -----
externalInstVar: offset ofContext: aContext
"Fetch an instance variable from a maybe married context.
If the context is still married compute the value of the
relevant inst var from the spouse frame's state.
If the context is single but has a negative instruction pointer
recognise that the instruction pointer is actually into machine
code and convert it to the corresponding bytecode pc."
<inline: false>
| value |
self assert: (objectMemory isContext: aContext).
+ self assert: offset <= (ReceiverIndex + (self checkStackPointerForMaybeMarriedContext: aContext)).
- self assert: offset < (ReceiverIndex + (self checkStackPointerForMaybeMarriedContext: aContext)).
"method, closureOrNil & receiver need no special handling; only
sender, pc & stackp have to be computed for married contexts."
(self isReadMediatedContextInstVarIndex: offset) ifFalse:
[^objectMemory fetchPointer: offset ofObject: aContext].
self externalWriteBackHeadFramePointers.
(self isStillMarriedContext: aContext) ifTrue:
[^self fetchPointer: offset ofMarriedContext: aContext].
value := objectMemory fetchPointer: offset ofObject: aContext.
(offset = InstructionPointerIndex
and: [(objectMemory isIntegerObject: value)
and: [value signedIntFromLong < 0]]) ifTrue:
[^self mustMapMachineCodePC: (objectMemory integerValueOf: value) context: aContext].
^value!
Item was changed:
----- Method: StackInterpreter>>externalInstVar:ofContext: (in category 'frame access') -----
externalInstVar: offset ofContext: aContext
"Fetch an instance variable from a maybe married context.
If the context is still married compute the value of the
relevant inst var from the spouse frame's state."
<inline: false>
self assert: (objectMemory isContext: aContext).
+ self assert: offset <= (ReceiverIndex + (self checkStackPointerForMaybeMarriedContext: aContext)).
- self assert: offset < (ReceiverIndex + (self checkStackPointerForMaybeMarriedContext: aContext)).
"method, closureOrNil & receiver need no special handling; only
sender, pc & stackp have to be computed for married contexts."
(self isReadMediatedContextInstVarIndex: offset) ifTrue:
[self externalWriteBackHeadFramePointers.
(self isStillMarriedContext: aContext) ifTrue:
[^self fetchPointer: offset ofMarriedContext: aContext]].
^objectMemory fetchPointer: offset ofObject: aContext!
McStalker.oscogvm$ git add build.macos32x86/pharo.stack.spur/*
The following paths are ignored by one of your .gitignore files:
build.macos32x86/pharo.stack.spur/Makefile
build.macos32x86/pharo.stack.spur/plugins.ext
build.macos32x86/pharo.stack.spur/plugins.int
Use -f if you really want to add them.
fatal: no files added
McStalker.oscogvm$ vi .gitignore
McStalker.oscogvm$ git add -f build.macos32x86/pharo.stack.spur/*
plugins.int and plugins.ext are important; they specify the set of plains
to be built. They should not be in .gitignore. Why are they there?
_,,,^..^,,,_
best, Eliot
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1946.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.1946
Author: eem
Time: 6 September 2016, 7:25:45.714008 pm
UUID: 5d49f2e2-77f3-4f4d-877b-b3fecceda04e
Ancestors: VMMaker.oscog-eem.1945
Fix Slang bug that misgenerated the macros for the full block entry offsets.
Add some facade machinery for the new full block check asserts.
=============== Diff against VMMaker.oscog-eem.1945 ===============
Item was changed:
----- Method: CCodeGenerator>>addMethodFor:selector: (in category 'utilities') -----
addMethodFor: aClass selector: selector
"Add the given method to the code base and answer its translation
or nil if it shouldn't be translated."
| method tmethod |
method := aClass compiledMethodAt: selector.
(method pragmaAt: #doNotGenerate) ifNotNil:
["only remove a previous method if this one overrides it, i.e. this is a subclass method.
If the existing method is in a different hierarchy this method must be merely a redeirect."
(methods at: selector ifAbsent: []) ifNotNil:
[:tm|
(aClass includesBehavior: tm definingClass) ifTrue:
[self removeMethodForSelector: selector]].
^nil].
method isSubclassResponsibility ifTrue:
[^nil].
(self shouldIncludeMethodFor: aClass selector: selector) ifFalse:
[^nil].
tmethod := self compileToTMethodSelector: selector in: aClass.
"Even thoug we exclude initialize methods, we must consider their
global variable usage, otherwise globals may be incorrectly localized."
selector == #initialize ifTrue:
[self checkForGlobalUsage: (tmethod allReferencedVariablesUsing: self) in: tmethod.
^nil].
self addMethod: tmethod.
"If the method has a macro then add the macro. But keep the method
for analysis purposes (e.g. its variable accesses)."
(method pragmaAt: #cmacro:) ifNotNil:
[:pragma|
self addMacro: (pragma argumentAt: 1) for: selector.
(inlineList includes: selector) ifTrue:
[inlineList := inlineList copyWithout: selector]].
(method pragmaAt: #cmacro) ifNotNil:
[:pragma| | literal | "Method should be just foo ^const"
self assert: (method numArgs = 0 and: [method numLiterals = 3 or: [method isQuick]]).
literal := method isQuick
ifTrue: [method decompile block statements last expr key]
ifFalse: [method literalAt: 1].
+ self addMacro: '() ', (method isReturnField
+ ifTrue: [literal]
+ ifFalse: [self cLiteralFor: literal value name: method selector]) for: selector.
- self addMacro: '() ', (self cLiteralFor: literal value name: method selector) for: selector.
(inlineList includes: selector) ifTrue:
[inlineList := inlineList copyWithout: selector]].
^tmethod!
Item was changed:
----- Method: Cogit class>>mustBeGlobal: (in category 'translation') -----
mustBeGlobal: var
"Answer if a variable must be global and exported. Used for inst vars that are accessed from VM
support code. include cePositive32BitIntegerTrampoline as a hack to prevent it being inlined (it is
only used outside of Cogit by the object representation). Include CFramePointer CStackPointer as
a hack to get them declared at all."
^#( 'ceBaseFrameReturnTrampoline' #ceCaptureCStackPointers 'ceCheckForInterruptTrampoline'
ceEnterCogCodePopReceiverReg realCEEnterCogCodePopReceiverReg
ceCallCogCodePopReceiverReg realCECallCogCodePopReceiverReg
ceCallCogCodePopReceiverAndClassRegs realCECallCogCodePopReceiverAndClassRegs
'ceReturnToInterpreterTrampoline' 'ceCannotResumeTrampoline'
ceTryLockVMOwner ceUnlockVMOwner
+ 'cmEntryOffset' 'cmNoCheckEntryOffset' 'cmDynSuperEntryOffset' 'cmSelfSendEntryOffset'
+ 'missOffset' 'cbEntryOffset' 'cbNoSwitchEntryOffset' 'blockNoContextSwitchOffset' breakPC
- 'cmEntryOffset' 'cmNoCheckEntryOffset' 'cmDynSuperEntryOffset' 'cmSelfSendEntryOffset' 'missOffset'
- 'blockNoContextSwitchOffset' breakPC
CFramePointer CStackPointer 'cFramePointerInUse' ceGetFP ceGetSP
traceFlags 'traceStores' debugPrimCallStackOffset)
includes: var!
Item was changed:
----- Method: Cogit>>entryOffset (in category 'accessing') -----
entryOffset
<api>
+ <cmacro>
- <cmacro: '() cmEntryOffset'>
^cmEntryOffset!
Item was changed:
----- Method: Cogit>>noCheckEntryOffset (in category 'accessing') -----
noCheckEntryOffset
<api>
+ <cmacro>
- <cmacro: '() cmNoCheckEntryOffset'>
^cmNoCheckEntryOffset!
Item was added:
+ ----- Method: CurrentImageCoInterpreterFacade>>isOopCompiledMethod: (in category 'accessing') -----
+ isOopCompiledMethod: anOop
+ ^(objectMap keyAtValue: anOop) isCompiledMethod!
Item was added:
+ ----- Method: CurrentImageCoInterpreterFacade>>ultimateLiteralOf: (in category 'accessing') -----
+ ultimateLiteralOf: methodObj
+ | meth |
+ meth := (objectMap keyAtValue: methodObj).
+ ^self oopForObject: (meth literalAt: meth numLiterals)!