From 3dcbd161f5c388a1a04b790659adc94c511a8435 Mon Sep 17 00:00:00 2001
From: Gwenael Casaccio
Date: Wed, 18 Dec 2013 21:09:08 +0100
Subject: [PATCH] Move some bytecode related constants from CompiledCode to
BytecodeDispatcher and refactor the users of those messages.
---
ChangeLog | 10 ++++++
kernel/BytecodeDispatcher.st | 66 +++++++++++++++++++++++++++++++++----
kernel/CompildCode.st | 34 +++++--------------
kernel/CompildMeth.st | 2 +-
kernel/CompiledBlk.st | 2 +-
packages/stinst/parser/ChangeLog | 4 +++
packages/stinst/parser/STCompLit.st | 2 +-
7 files changed, 85 insertions(+), 35 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index cbbcdd2..f8d6169 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2013-12-18 Gwenael Casaccio
+ * kernel/BytecodeDispatcher.st: Move the bytecode constants from
+ CompiledCode to BytecodeDispatcher.
+ * kernel/CompildCode.st: Move the bytecode constants from
+ CompiledCode to BytecodeDispatcher and refactor the code using
+ them.
+ * kernel/CompildMth.st: Refactor the code using the constants.
+ * kernel/CompiledBlk.st: Idem.
+
+2013-12-18 Gwenael Casaccio
+
* kernel/PkgLoader.st: Extract the parser from their classes
into a ParseXMLPackage and a ParseXMLPackageGroup. The same
is done for the pretty printer.
diff --git a/kernel/BytecodeDispatcher.st b/kernel/BytecodeDispatcher.st
index 562fedc..0bd0675 100644
--- a/kernel/BytecodeDispatcher.st
+++ b/kernel/BytecodeDispatcher.st
@@ -36,6 +36,42 @@ Object subclass: BytecodeDispatcher [
| code |
+ BytecodeDispatcher class >> specialSelectors [
+ "Answer an array of message names that don't need to be in
+ literals to be sent in a method. Their position here
+ reflects their integer code in bytecode."
+
+ ^#(#+ #- #< #> #<= #>= #= #~= #* #/ #\\ #bitXor: #bitShift: #// #bitAnd: #bitOr: #at: #at:put: #size #class #isNil #notNil #value #value: #== #javaAsInt #javaAsLong nil nil nil nil nil #new: #thisContext #callInto: #narrow #nextPutAll: #yourself #, #on: #subclassResponsibility #add: #nl #printString #contents #name #isEmpty #properties #container #error: #first #tclEval: #collect: #tclResult #key #asTkString #abs #basicNew #negated #not #close #includes: #at:ifAbsent: #asSymbol #with: #copy #copyFrom:to: #print: #last #initialize #tclEval:with:with: #assert: #primitiveFailed #initialize: #asString #cr #should: #arguments #x #readStream #y #tclEval:with:with:with: #asInteger #space #new #shouldNotImplement #-> #numArgs #with:with: #species #blox #step #signal #parent #selector #at:ifPresent: #to: #addLast: #squared #generality #signalOn:mustBe: #ensure: #body #max: #keysAndValuesDo: #printOn: #isKindOf: #visitNode: #addAll: #isInteger #name: #hash #sqrt #beep #primAt: #environment #position #at:ifAbsentPut: #signal: #postCopy #readFrom: #coefficients: #clientPI #flush #value:value: #asFloatD #on:do: #basicAt:put: #primSize #evaluate #connected #reset #copyEmpty: #start #signalOn: #basicAt: #asClass #ln #implementation #checkResponse #average #upTo: #receiver #peek #basicSize #x:y: #foregroundColor: #rows: #text #exp #statements #body: #| #sizeof #includesKey: #pi #completedSuccessfully #writeStream #superclass #arguments: #state #truncated #inject:into: #replaceFrom:to:with:startingAt: #current #between:and: #retryRelationalOp:coercing: #connectIfClosed #detect:ifNone: #checkError #executeAndWait:arguments: #min: #width #parentContext #removeLast #zero #bindWith:with: #temporaries #asOop #width:height: #methodDictionary #accumulate: #count #asLowercase #asArray #exists #signalOn:what: #select: #parent: #selector: #signalOn:withIndex: #bind:to:of:parameters: #return: #~~ #changeState: #sign #variance #asVector #getResponse #wait #instanceClass #asOrderedCollection #keys #asFloat #random #origin #superspace #stop #perform: #backgroundColor: #login #data: #nextToken #primAt:put: #method #allSatisfy: #position: #default #atAllPut: #asSortedCollection #invalidArgsError: #nameIn: #allSubclassesDo: #signalError #height #source #asNumber #primitive #store: #updateViews #errorContents: #displayString #skipSeparators #origin:corner: #activeProcess #bindWith: #beConsistent #at:type: #skip: #days #tclEval:with: #fromSeconds: #& #upToEnd #variable #become: #with:do: #findIndexOrNil: #asSeconds #copyWith: #background #status #selectors:receiver:argument: #create: #coerce: #bytecodeAt:)
+ ]
+
+ BytecodeDispatcher class >> specialSelectorsNumArgs [
+ "Answer a harmoniously-indexed array of arities for the
+ messages answered by #specialSelectors."
+
+ ^#[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 0 0 0 0 0 1 1 0 0 255 255 255 255 255 1 0 1 0 1 0 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 1 2 0 1 0 2 1 0 0 3 1 0 1 0 0 1 0 0 0 0 4 0 0 0 0 1 0 2 0 0 0 0 0 0 2 1 1 0 0 2 1 0 1 1 1 1 1 1 0 1 0 0 0 1 0 0 2 1 0 1 1 0 0 2 0 2 2 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 0 0 2 1 1 0 0 0 1 1 0 1 0 0 0 0 1 0 0 2 4 0 2 2 0 2 0 2 1 0 0 0 0 2 0 0 2 0 1 0 0 0 0 2 1 1 1 2 4 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 2 0 1 1 0 1 0 1 1 1 0 0 0 0 0 1 0 1 0 0 2 0 1 0 2 1 0 2 1 1 0 0 1 2 1 0 1 0 0 3 1 1 1]
+ ]
+
+ BytecodeDispatcher class >> bytecodeInfoTable [
+ "Return a ByteArray which defines some properties of the bytecodes.
+ For each bytecode, 4 bytes are reserved. The fourth byte is a
+ flag byte: bit 7 means that the argument is a line number to be
+ used in creating the bytecode->line number map.
+
+ The first three have a meaning only for those bytecodes that
+ represent a combination of operations: the combination can be
+ BC1 ARG BC2 OPERAND if the fourth byte's bit 0 = 0
+ or BC1 OPERAND BC2 ARG if the fourth byte's bit 0 = 1
+
+ where BC1 is the first byte, BC2 is the second, ARG is the third
+ and OPERAND is the bytecode argument as it appears in the bytecode
+ stream."
+
+ "Automatically generated by superops. Do not modify this definition!"
+
+
+ ^#[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 55 28 1 1 55 28 0 1 56 51 0 0 54 56 0 129 54 48 0 129 54 32 0 129 46 49 0 1 55 28 2 1 48 52 0 0 32 30 0 0 56 65 0 0 45 51 0 1 56 30 0 0 55 33 1 1 36 48 0 1 56 32 0 0 39 66 0 1 44 0 0 1 54 34 0 129 32 32 0 0 32 28 0 0 54 32 1 129 20 43 0 0 44 6 0 1 55 28 3 1 32 64 0 0 67 28 0 129 32 51 0 1 46 30 36 1 24 43 0 0 46 64 1 1 68 56 0 129 72 54 0 128 32 65 0 0 32 30 1 0 46 6 0 1 44 1 0 1 52 43 0 0 48 54 0 128 44 30 32 1 32 18 0 1 56 28 0 0 54 32 2 129 48 30 0 0 32 81 1 1 54 35 0 129 46 30 38 1 44 16 0 1 54 35 1 129 32 46 0 0 52 42 0 0 32 16 0 1 32 30 2 0 46 30 49 1 36 68 1 128 32 64 1 0 39 48 0 1 55 37 1 1 44 30 96 1 48 32 0 0 35 51 0 1 68 32 1 129 68 32 0 129 67 46 0 129 46 51 0 1 56 18 0 0 20 42 0 0 32 17 0 1 54 34 1 129 32 0 0 1 48 40 0 0 48 34 0 0 44 36 1 0 46 64 2 1 54 32 3 129 54 33 1 129 35 28 0 1 44 3 0 1 32 22 0 1 32 1 0 1 46 64 3 1 45 93 0 0 36 68 2 128 24 42 0 0 44 8 0 1 54 35 2 129 44 2 0 1 46 17 0 1 55 33 2 1 67 84 1 129 79 64 0 0 67 30 40 129 32 32 3 1 36 54 1 128 69 28 0 129 44 14 0 1 32 65 2 0 83 28 1 0 67 32 0 129 54 35 3 129 32 64 2 0 21 43 0 0 36 54 2 128 36 68 3 128 46 30 1 0 32 6 0 1 72 108 0 0 56 64 0 0 36 68 0 128 52 54 0 128 56 117 0 0 48 35 0 0 67 30 84 129 54 34 2 129 70 64 3 1 54 46 0 129 52 92 0 0 54 77 1 129 44 13 0 1 70 30 1 0 32 30 3 0 54 75 0 129 54 35 5 129 70 64 2 1 32 23 0 1 44 51 0 1 32 71 0 0 32 100 1 1 56 46 0 0 54 35 4 129 33 30 1 0 67 65 1 129 33 64 1 0 32 30 4 0 44 30 41 1 55 28 4 1 32 32 2 1 56 19 0 0 32 28 1 0 79 64 1 0 46 64 4 1 44 28 1 1 35 18 0 1 32 71 1 0 83 71 1 0 32 47 0 1 70 64 5 1 55 29 1 1 70 64 4 1 35 30 1 0 121 51 0 1 102 30 37 129 67 19 0 129 32 65 1 0 67 30 130 129 35 30 0 0 32 34 0 0 36 54 0 128 35 30 2 0 67 65 2 129 68 32 2 129 70 64 6 1 45 50 0 1 44 5 0 1 68 35 1 129 54 34 3 129 46 30 2 0 55 29 0 1 45 39 0 0 79 28 1 1 68 91 0 129 46 24 0 1 70 64 1 1 68 32 3 129 72 30 0 0 46 131 0 1 52 108 0 0 54 32 4 129 102 34 1 129 52 94 0 0 47 64 1 0 68 91 1 129 36 54 3 128 52 65 0 0 39 51 0 1 67 65 3 129 21 101 0 0 52 46 0 0 69 51 0 129 44 17 0 1 32 19 0 1 54 77 2 129]
+ ]
+
BytecodeDispatcher class >> for: aCompiledCode dispatchTo: anObject [
@@ -89,10 +125,10 @@ Object subclass: BytecodeDispatcher [
| index bc1 bc2 arg1 arg2 arg kind |
index := byte * 4.
- bc1 := CompiledCode bytecodeInfoTable at: index + 1.
- bc2 := CompiledCode bytecodeInfoTable at: index + 2.
- arg := CompiledCode bytecodeInfoTable at: index + 3.
- kind := CompiledCode bytecodeInfoTable at: index + 4.
+ bc1 := self bytecodeInfoTableAt: index + 1.
+ bc2 := self bytecodeInfoTableAt: index + 2.
+ arg := self bytecodeInfoTableAt: index + 3.
+ kind := self bytecodeInfoTableAt: index + 4.
kind \\ 2 = 0 ifTrue: [
arg1 := arg.
arg2 := operand
@@ -115,8 +151,8 @@ Object subclass: BytecodeDispatcher [
byte = 28 ifTrue: [ ^ anObject send: (code literalAt: operand // 256 + 1) numArgs: operand \\ 256 ].
byte = 29 ifTrue: [ ^ anObject superSend: (code literalAt: operand // 256 + 1) numArgs: operand \\ 256 ].
- byte = 30 ifTrue: [ ^ anObject send: (CompiledCode specialSelectors at: operand + 1) numArgs: (CompiledCode specialSelectorsNumArgs at: operand + 1) ].
- byte = 31 ifTrue: [ ^ anObject superSend: (CompiledCode specialSelectors at: operand + 1) numArgs: (CompiledCode specialSelectorsNumArgs at: operand + 1) ].
+ byte = 30 ifTrue: [ ^ anObject send: (self specialSelectorsAt: operand + 1) numArgs: (self specialSelectorsNumArgsAt: operand + 1) ].
+ byte = 31 ifTrue: [ ^ anObject superSend: (self specialSelectorsAt: operand + 1) numArgs: (self specialSelectorsNumArgsAt: operand + 1) ].
^ anObject invalidOpcode
]
@@ -185,5 +221,23 @@ Object subclass: BytecodeDispatcher [
byte >= 64 ifTrue: [ self dispatchSuperoperator: byte with: operand at: ofs to: aBlock ]
ifFalse: [ aBlock value: ofs value: byte value: operand ] ]
]
+
+ bytecodeInfoTableAt: anInteger [
+
+
+ ^ self class bytecodeInfoTable at: anInteger
+ ]
+
+ specialSelectorsAt: anInteger [
+
+
+ ^ self class specialSelectors at: anInteger
+ ]
+
+ specialSelectorsNumArgsAt: anInteger [
+
+
+ ^ self class specialSelectorsNumArgs at: anInteger
+ ]
]
diff --git a/kernel/CompildCode.st b/kernel/CompildCode.st
index dd46701..82883bb 100644
--- a/kernel/CompildCode.st
+++ b/kernel/CompildCode.st
@@ -41,39 +41,21 @@ ArrayedCollection subclass: CompiledCode [
superclass for blocks and methods'>
CompiledCode class >> specialSelectors [
- "Answer an array of message names that don't need to be in
- literals to be sent in a method. Their position here
- reflects their integer code in bytecode."
- ^#(#+ #- #< #> #<= #>= #= #~= #* #/ #\\ #bitXor: #bitShift: #// #bitAnd: #bitOr: #at: #at:put: #size #class #isNil #notNil #value #value: #== #javaAsInt #javaAsLong nil nil nil nil nil #new: #thisContext #callInto: #narrow #nextPutAll: #yourself #, #on: #subclassResponsibility #add: #nl #printString #contents #name #isEmpty #properties #container #error: #first #tclEval: #collect: #tclResult #key #asTkString #abs #basicNew #negated #not #close #includes: #at:ifAbsent: #asSymbol #with: #copy #copyFrom:to: #print: #last #initialize #tclEval:with:with: #assert: #primitiveFailed #initialize: #asString #cr #should: #arguments #x #readStream #y #tclEval:with:with:with: #asInteger #space #new #shouldNotImplement #-> #numArgs #with:with: #species #blox #step #signal #parent #selector #at:ifPresent: #to: #addLast: #squared #generality #signalOn:mustBe: #ensure: #body #max: #keysAndValuesDo: #printOn: #isKindOf: #visitNode: #addAll: #isInteger #name: #hash #sqrt #beep #primAt: #environment #position #at:ifAbsentPut: #signal: #postCopy #readFrom: #coefficients: #clientPI #flush #value:value: #asFloatD #on:do: #basicAt:put: #primSize #evaluate #connected #reset #copyEmpty: #start #signalOn: #basicAt: #asClass #ln #implementation #checkResponse #average #upTo: #receiver #peek #basicSize #x:y: #foregroundColor: #rows: #text #exp #statements #body: #| #sizeof #includesKey: #pi #completedSuccessfully #writeStream #superclass #arguments: #state #truncated #inject:into: #replaceFrom:to:with:startingAt: #current #between:and: #retryRelationalOp:coercing: #connectIfClosed #detect:ifNone: #checkError #executeAndWait:arguments: #min: #width #parentContext #removeLast #zero #bindWith:with: #temporaries #asOop #width:height: #methodDictionary #accumulate: #count #asLowercase #asArray #exists #signalOn:what: #select: #parent: #selector: #signalOn:withIndex: #bind:to:of:parameters: #return: #~~ #changeState: #sign #variance #asVector #getResponse #wait #instanceClass #asOrderedCollection #keys #asFloat #random #origin #superspace #stop #perform: #backgroundColor: #login #data: #nextToken #primAt:put: #method #allSatisfy: #position: #default #atAllPut: #asSortedCollection #invalidArgsError: #nameIn: #allSubclassesDo: #signalError #height #source #asNumber #primitive #store: #updateViews #errorContents: #displayString #skipSeparators #origin:corner: #activeProcess #bindWith: #beConsistent #at:type: #skip: #days #tclEval:with: #fromSeconds: #& #upToEnd #variable #become: #with:do: #findIndexOrNil: #asSeconds #copyWith: #background #status #selectors:receiver:argument: #create: #coerce: #bytecodeAt:)
+
+ ^ BytecodeDispatcher specialSelectors
]
CompiledCode class >> specialSelectorsNumArgs [
- "Answer a harmoniously-indexed array of arities for the
- messages answered by #specialSelectors."
- ^#[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 0 0 0 0 0 1 1 0 0 255 255 255 255 255 1 0 1 0 1 0 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 1 2 0 1 0 2 1 0 0 3 1 0 1 0 0 1 0 0 0 0 4 0 0 0 0 1 0 2 0 0 0 0 0 0 2 1 1 0 0 2 1 0 1 1 1 1 1 1 0 1 0 0 0 1 0 0 2 1 0 1 1 0 0 2 0 2 2 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 0 0 2 1 1 0 0 0 1 1 0 1 0 0 0 0 1 0 0 2 4 0 2 2 0 2 0 2 1 0 0 0 0 2 0 0 2 0 1 0 0 0 0 2 1 1 1 2 4 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 2 0 1 1 0 1 0 1 1 1 0 0 0 0 0 1 0 1 0 0 2 0 1 0 2 1 0 2 1 1 0 0 1 2 1 0 1 0 0 3 1 1 1]
+
+ ^ BytecodeDispatcher specialSelectorsNumArgs
]
CompiledCode class >> bytecodeInfoTable [
- "Return a ByteArray which defines some properties of the bytecodes.
- For each bytecode, 4 bytes are reserved. The fourth byte is a
- flag byte: bit 7 means that the argument is a line number to be
- used in creating the bytecode->line number map.
-
- The first three have a meaning only for those bytecodes that
- represent a combination of operations: the combination can be
- BC1 ARG BC2 OPERAND if the fourth byte's bit 0 = 0
- or BC1 OPERAND BC2 ARG if the fourth byte's bit 0 = 1
-
- where BC1 is the first byte, BC2 is the second, ARG is the third
- and OPERAND is the bytecode argument as it appears in the bytecode
- stream."
-
- "Automatically generated by superops. Do not modify this definition!"
-
- ^#[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 55 28 1 1 55 28 0 1 56 51 0 0 54 56 0 129 54 48 0 129 54 32 0 129 46 49 0 1 55 28 2 1 48 52 0 0 32 30 0 0 56 65 0 0 45 51 0 1 56 30 0 0 55 33 1 1 36 48 0 1 56 32 0 0 39 66 0 1 44 0 0 1 54 34 0 129 32 32 0 0 32 28 0 0 54 32 1 129 20 43 0 0 44 6 0 1 55 28 3 1 32 64 0 0 67 28 0 129 32 51 0 1 46 30 36 1 24 43 0 0 46 64 1 1 68 56 0 129 72 54 0 128 32 65 0 0 32 30 1 0 46 6 0 1 44 1 0 1 52 43 0 0 48 54 0 128 44 30 32 1 32 18 0 1 56 28 0 0 54 32 2 129 48 30 0 0 32 81 1 1 54 35 0 129 46 30 38 1 44 16 0 1 54 35 1 129 32 46 0 0 52 42 0 0 32 16 0 1 32 30 2 0 46 30 49 1 36 68 1 128 32 64 1 0 39 48 0 1 55 37 1 1 44 30 96 1 48 32 0 0 35 51 0 1 68 32 1 129 68 32 0 129 67 46 0 129 46 51 0 1 56 18 0 0 20 42 0 0 32 17 0 1 54 34 1 129 32 0 0 1 48 40 0 0 48 34 0 0 44 36 1 0 46 64 2 1 54 32 3 129 54 33 1 129 35 28 0 1 44 3 0 1 32 22 0 1 32 1 0 1 46 64 3 1 45 93 0 0 36 68 2 128 24 42 0 0 44 8 0 1 54 35 2 129 44 2 0 1 46 17 0 1 55 33 2 1 67 84 1 129 79 64 0 0 67 30 40 129 32 32 3 1 36 54 1 128 69 28 0 129 44 14 0 1 32 65 2 0 83 28 1 0 67 32 0 129 54 35 3 129 32 64 2 0 21 43 0 0 36 54 2 128 36 68 3 128 46 30 1 0 32 6 0 1 72 108 0 0 56 64 0 0 36 68 0 128 52 54 0 128 56 117 0 0 48 35 0 0 67 30 84 129 54 34 2 129 70 64 3 1 54 46 0 129 52 92 0 0 54 77 1 129 44 13 0 1 70 30 1 0 32 30 3 0 54 75 0 129 54 35 5 129 70 64 2 1 32 23 0 1 44 51 0 1 32 71 0 0 32 100 1 1 56 46 0 0 54 35 4 129 33 30 1 0 67 65 1 129 33 64 1 0 32 30 4 0 44 30 41 1 55 28 4 1 32 32 2 1 56 19 0 0 32 28 1 0 79 64 1 0 46 64 4 1 44 28 1 1 35 18 0 1 32 71 1 0 83 71 1 0 32 47 0 1 70 64 5 1 55 29 1 1 70 64 4 1 35 30 1 0 121 51 0 1 102 30 37 129 67 19 0 129 32 65 1 0 67 30 130 129 35 30 0 0 32 34 0 0 36 54 0 128 35 30 2 0 67 65 2 129 68 32 2 129 70 64 6 1 45 50 0 1 44 5 0 1 68 35 1 129 54 34 3 129 46 30 2 0 55 29 0 1 45 39 0 0 79 28 1 1 68 91 0 129 46 24 0 1 70 64 1 1 68 32 3 129 72 30 0 0 46 131 0 1 52 108 0 0 54 32 4 129 102 34 1 129 52 94 0 0 47 64 1 0 68 91 1 129 36 54 3 128 52 65 0 0 39 51 0 1 67 65 3 129 21 101 0 0 52 46 0 0 69 51 0 129 44 17 0 1 32 19 0 1 54 77 2 129]
+
+ ^ BytecodeDispatcher bytecodeInfoTable
]
CompiledCode class >> new: numBytecodes header: anInteger numLiterals: numLiterals [
@@ -427,7 +409,7 @@ superclass for blocks and methods'>
anObject isSymbol ifFalse: [^false].
"Look for symbols referenced to by special message sends"
- byte := self class specialSelectors indexOf: anObject.
+ byte := BytecodeDispatcher specialSelectors indexOf: anObject.
byte = 0 ifTrue: [^false].
byte := byte - 1.
self allByteCodeIndicesDo:
@@ -470,7 +452,7 @@ superclass for blocks and methods'>
first := true.
self allByteCodeIndicesDo:
[ :each :byte :operand |
- (self class bytecodeInfoTable at: byte * 4 + 4) >= 128
+ (BytecodeDispatcher bytecodeInfoTable at: byte * 4 + 4) >= 128
ifTrue:
[ first ifFalse: [ next := operand ].
first := false.
diff --git a/kernel/CompildMeth.st b/kernel/CompildMeth.st
index e0be59d..1303efe 100644
--- a/kernel/CompildMeth.st
+++ b/kernel/CompildMeth.st
@@ -181,7 +181,7 @@ instances.'>
| line |
self allByteCodeIndicesDo:
[:each :byte :operand |
- (self class bytecodeInfoTable at: byte * 4 + 4) >= 128
+ (BytecodeDispatcher bytecodeInfoTable at: byte * 4 + 4) >= 128
ifTrue: [^operand - 1]].
^0
]
diff --git a/kernel/CompiledBlk.st b/kernel/CompiledBlk.st
index 483897c..e62c0c5 100644
--- a/kernel/CompiledBlk.st
+++ b/kernel/CompiledBlk.st
@@ -86,7 +86,7 @@ CompiledCode subclass: CompiledBlock [
line := 1.
self allByteCodeIndicesDo:
[:each :byte :operand |
- (self class bytecodeInfoTable at: byte * 4 + 4) >= 128
+ (BytecodeDispatcher bytecodeInfoTable at: byte * 4 + 4) >= 128
ifTrue:
[line := operand.
operand > 255 ifTrue: [map := map asArray]].
diff --git a/packages/stinst/parser/ChangeLog b/packages/stinst/parser/ChangeLog
index 8e22b4e..fbf4713 100644
--- a/packages/stinst/parser/ChangeLog
+++ b/packages/stinst/parser/ChangeLog
@@ -1,3 +1,7 @@
+2013-12-18 Gwenael Casaccio
+
+ * STCompLit.st: Use BytecodeDispatcher>>specialSelectors.
+
2013-09-26 Holger Hans Peter Freyther
* GSTParser.st: Move the emptySeq variable into the block it is
diff --git a/packages/stinst/parser/STCompLit.st b/packages/stinst/parser/STCompLit.st
index 33726c0..2f1d7a2 100644
--- a/packages/stinst/parser/STCompLit.st
+++ b/packages/stinst/parser/STCompLit.st
@@ -71,7 +71,7 @@ Eval [
at: #ThisContextSpecial put: 33;
yourself).
selectorsMap := IdentityDictionary new: 512.
- CompiledCode specialSelectors keysAndValuesDo:
+ BytecodeDispatcher specialSelectors keysAndValuesDo:
[:index :selector |
selector isNil ifFalse: [selectorsMap at: selector put: index - 1]].
VMOtherConstants at: #VMSpecialSelectors put: selectorsMap.
--
1.8.3.2