Skip to content

Commit

Permalink
rename hardcoded C code
Browse files Browse the repository at this point in the history
  • Loading branch information
ivojawer committed Jul 25, 2023
1 parent f10621b commit 519117e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions smalltalksrc/Slang/CCodeGenerator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,7 @@ CCodeGenerator >> emitCCodeOn: aStream doInlining: inlineFlag doAssertions: asse
logger cr ].
assertionFlag ifFalse: [ self removeAssertions ].
self doInlining: inlineFlag.
SLAutomaticLocalization new
Expand All @@ -1056,6 +1057,8 @@ CCodeGenerator >> emitCCodeOn: aStream doInlining: inlineFlag doAssertions: asse
self renameConflictingMethods.
self renameKeywordsConflicts.
self renameConflictingLocals.
"If we're outputting the VM put the main interpreter loop first for two reasons.
1, so that the dispdbg.h header included at the bytecode dispatch can define
macros that affect all C code in the interpreter, and 2, so that all primitive
Expand All @@ -1074,6 +1077,8 @@ CCodeGenerator >> emitCCodeOn: aStream doInlining: inlineFlag doAssertions: asse
in: m ].
self localizeGlobalVariables.
self emitCHeaderOn: aStream.
self emitCConstantsOn: aStream.
self emitCTypesOn: aStream. "Emitting types after constants allows use of constant names, e.g. in declaring arrays."
Expand Down
10 changes: 6 additions & 4 deletions smalltalksrc/VMMaker/Cogit.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3140,7 +3140,8 @@ Cogit >> addressIsInCurrentCompilation: address [
{ #category : #testing }
Cogit >> addressIsInFixups: address [
<var: #address type: #'BytecodeFixup *'>
^self cCode: '(BytecodeFixup *)address >= fixups && (BytecodeFixup *)address < (fixups + numAbstractOpcodes)'
"Hardcode renaming to l_address"
^self cCode: '(BytecodeFixup *)l_address >= fixups && (BytecodeFixup *)l_address < (fixups + numAbstractOpcodes)'
inSmalltalk:
[fixups notNil
and: [(fixups object identityIndexOf: address) between: 1 and: numAbstractOpcodes]]
Expand All @@ -3149,9 +3150,10 @@ Cogit >> addressIsInFixups: address [
{ #category : #testing }
Cogit >> addressIsInInstructions: address [
<var: #address type: #'AbstractInstruction *'>
^self cCode: '!((usqInt)(address) & BytesPerWord-1) \
&& (address) >= &abstractOpcodes[0] \
&& (address) < &abstractOpcodes[opcodeIndex]'
"Hardcode renaming to l_address"
^self cCode: '!((usqInt)(l_address) & BytesPerWord-1) \
&& (l_address) >= &abstractOpcodes[0] \
&& (l_address) < &abstractOpcodes[opcodeIndex]'
inSmalltalk: [(abstractOpcodes object identityIndexOf: address) between: 1 and: opcodeIndex]
]
Expand Down

0 comments on commit 519117e

Please sign in to comment.