|
Class: STCCompilerInterface
Object
|
+--STCCompilerInterface
- Package:
- stx:libcomp
- Category:
- System-Compiler
- Version:
- rev:
1.84
date: 2023/12/01 23:58:14
- user: cg
- file: STCCompilerInterface.st directory: libcomp
- module: stx stc-classLibrary: libcomp
a refactored complex method - originally found in ByteCodeCompiler.
self new
parserFlags:ParserFlags new;
ensureExternalToolsArePresent
copyrightCOPYRIGHT (c) 1989 by Claus Gittinger
COPYRIGHT (c) 2006 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
accessing
-
getCCDefine
-
return a string which was used to identify the C-Compiler used
when STX was compiled, and which should be passed down when compiling methods.
For example, when compiled with GNUC, this is '__GNUC__';
on windows, this is either '__VISUAL__', '__BORLANDC__' or '__MINGW64__'
Usage example(s):
STCCompilerInterface getCCDefine
|
-
getCPUDefine
-
return a string which was used to identify this CPU type when STX was
compiled, and which should be passed down when compiling methods.
For example, on a 386 (and successors), this may be '-D__x86__';
on a vax, this would be '-D__vax__'.
This is normally not of interest to 'normal' users; however, it is passed
down to the c-compiler when methods are incrementally compiled to machine code.
Do not use this for CPU determination; only to pass on to stc for compilation.
(see OperatingSystem getCPUType for this)
Usage example(s):
STCCompilerInterface getCPUDefine
|
-
getOSDefine
-
return a string which was used to identify this machine when stx was
compiled, and which should be passed down when compiling methods.
For example, on linux, this is '-D__linux__'; on osx, it is '-D__osx__'.
Do not use this for OS determination; only to pass on to stc for compilation.
(see OperatingSystem getOSType for this)
Usage example(s):
STCCompilerInterface getOSDefine
|
-
stcPathOf: command
-
return the path to an stc command, or nil if not found.
Usage example(s):
STCCompilerInterface stcPathOf:'stc'
|
-
verbose
-
if on, trace command execution on the Transcript
-
verbose: aBoolean
-
if on, trace command execution on the Transcript
accessing
-
cFileName: aFilename
-
Modified (format): / 27-07-2023 / 16:01:32 / mobile
-
incrementalStcPath
-
return the path to the stc command for incremental method compilation,
or nil if not found.
-
originator: something
-
-
parserFlags: parserFlagsArg
-
Modified (format): / 27-07-2023 / 16:01:46 / mobile
-
stFileName: aFilename
-
Modified (format): / 27-07-2023 / 16:01:36 / mobile
error raising
-
parseError: messageText position: position
-
not normally reached
machine code generation
-
compileClassToMachineCode: aClass install: install generateCOnly: generateCOnly
-
this is called to compile a whole class using stc
(via the browser's special menu entry 'compile class with stc').
It saves the code to a tmporary, calls stc to create C-code, compiles it, links
it to a dll and loads it.
As you might expect, this takes some time and is therefore not done automatically;
used only for benchmarks and to track stc bugs.
-
compileToMachineCode: aString forClass: aClass selector: selector inCategory: categoryArg notifying: requestorArg install: install skipIfSame: skipIfSame silent: silent
-
this is called to compile primitive code.
It saves the code to a tmporary, calls stc to create C-code, compiles it, links
it to a tiny little dll and loads it.
As you already see, this takes some time and is therefore ONLY done for code containing prims;
all pure smalltalk code is compiled to bytecode and jitted by the VM.
Usage example(s):
|m|
Object subclass:#Test
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'tests'.
m := ByteCodeCompiler
compileToMachineCode:'foo %{ RETURN (_MKSMALLINT(1)); %}'
forClass:Test
inCategory:'tests'
notifying:nil
install:false
skipIfSame:false
silent:false.
m inspect
|
-
compileToMachineCode: aString forClass: aClass selector: selector inCategory: categoryArg notifying: requestorArg install: install skipIfSame: skipIfSame silent: silent generateCOnly: generateCOnly
-
this is called to compile methods with primitive code
(or via the browser's special menu entry 'compile with stc').
It saves the code to a tmporary, calls stc to create C-code, compiles it, links
it to a tiny little dll and loads it.
As you already see, this takes some time and is therefore ONLY done for code containing prims;
all pure smalltalk code is compiled to bytecode and jitted by the VM.
Usage example(s):
|m|
Object subclass:#Test
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'tests'.
m := ByteCodeCompiler
compileToMachineCode:'foo %{ RETURN (_MKSMALLINT(1)); %}'
forClass:Test
inCategory:'tests'
notifying:nil
install:false
skipIfSame:false
silent:false.
m inspect
|
machine code generation-helpers
-
compileToC_onError: aBlock
-
compile st to C using stc.
If any error happens, call aBlock passing it the fileName containing diagnostics
-
compileToExe_onError: aBlock
-
compile C to exe, using cc.
If any error happens, call aBlock passing it the fileName containing diagnostics
-
compileToObj_onError: aBlock
-
compile C to obj, using cc.
If any error happens, call aBlock passing it the fileName containing diagnostics
-
compileToS_onError: aBlock
-
compile C to assembler, using cc.
If any error happens, call aBlock passing it the fileName containing diagnostics
-
ensureExternalToolsArePresent
-
make it absolute, so that we are immune to directory changes
-
ensureModuleDirectoryExists
-
create a small README there ...
-
ensureSuperClassesAreLoadedOf: aClass
-
-
fileOutAllDefinitionsOf: aClass to: aStream rememberIn: definedClasses
-
-
generateSTSource: aString
-
generate a unique name, consisting of my processID and a sequence number
-
reportCompilationErrorFor: aCommand
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
reportCompilationErrorFor: aCommand fromFile: anErrorFilename
-
replace the filename string
-
setupCompilationCommandArguments
-
ParserFlags useBorlandC ifTrue:[
Usage example(s):
self new
stFileName:'foo.st';
setupCompilationCommandArguments;
inspect
|
|