Skip to content

Commit

Permalink
Merge pull request #1029 from rochus-keller/busy_frontend
Browse files Browse the repository at this point in the history
Minimal Linux implementation of SharedMemory and fixes to make it work
  • Loading branch information
LADSoft authored May 8, 2024
2 parents 1ef496d + 678b2c9 commit 7a12ea5
Show file tree
Hide file tree
Showing 7 changed files with 179 additions and 84 deletions.
188 changes: 118 additions & 70 deletions BUSY
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,68 @@ let config : Config {
}
}

let orangefront ! : Executable {
.configs += config;
let config2 : Config {
.include_dirs += [ . ./src/occopt ./src/util ./src/ocpp ]
.defines += [ "ORANGE_NO_MSIL" "ORANGE_NO_INASM" ]
}

let common : SourceSet {
.configs += [ config config2 ]
.sources += [
./src/util/CmdFiles.cpp
./src/util/CmdSwitch.cpp
./src/util/crc.cpp
./src/util/NamedPipe.cpp
./src/util/Random.cpp
./src/util/SharedMemory.cpp
./src/util/ToolChain.cpp
./src/util/UTF8.cpp
./src/util/UTF8Table.cpp
./src/util/UTF8Upper.cpp
./src/util/Utils.cpp
./src/util/xml.cpp
./src/util/winsystem.c

./src/util/CmdFiles.h
./src/util/CmdSwitch.h
./src/util/FNV_hash.h
./src/util/LSDateTime.h
./src/util/SharedMemory.h
./src/util/ToolChain.h
./src/util/UTF8.h
./src/util/Utils.h
./src/util/xml.h

./src/occopt/config.cpp
./src/occopt/config.h
./src/occopt/configx86.cpp
./src/occopt/configx86.h
./src/occopt/iblock.cpp
./src/occopt/iblock.h
./src/occopt/ifloatconv.cpp
./src/occopt/ifloatconv.h
./src/occopt/ildata.cpp
./src/occopt/ildata.h
./src/occopt/ilstream.cpp
./src/occopt/ilstream.h
./src/occopt/iout.cpp
./src/occopt/iout.h
./src/occopt/memory.cpp
./src/occopt/memory.h
./src/occopt/optmodules.cpp
./src/occopt/optmodules.h
./src/occopt/OptUtils.cpp
./src/occopt/OptUtils.h
./src/occopt/output.cpp
./src/occopt/output.h
./src/occopt/symfuncs.cpp
./src/occopt/symfuncs.h
]
}

let orangefront : Executable {
.configs += [ config config2 ]
.deps += common;
.sources += [
./src/occparse/beinterf.cpp
./src/occparse/browse.cpp
Expand Down Expand Up @@ -84,19 +142,6 @@ let orangefront ! : Executable {
./src/occparse/types.cpp
./src/occparse/unmangle.cpp
./src/occparse/wseh.cpp
./src/util/CmdFiles.cpp
./src/util/CmdSwitch.cpp
./src/util/crc.cpp
./src/util/NamedPipe.cpp
./src/util/Random.cpp
./src/util/SharedMemory.cpp
./src/util/ToolChain.cpp
./src/util/UTF8.cpp
./src/util/UTF8Table.cpp
./src/util/UTF8Upper.cpp
./src/util/Utils.cpp
./src/util/xml.cpp
./src/util/winsystem.c
./src/ocpp/Errors.cpp
./src/ocpp/Floating.cpp
./src/ocpp/InputFile.cpp
Expand All @@ -114,18 +159,6 @@ let orangefront ! : Executable {
./src/ocpp/PreProcessor.cpp
./src/ocpp/SymbolTable.cpp
./src/ocpp/Token.cpp
./src/occopt/config.cpp
./src/occopt/ildata.cpp
./src/occopt/OptUtils.cpp
./src/occopt/memory.cpp
./src/occopt/ifloatconv.cpp
./src/occopt/iblock.cpp
./src/occopt/configx86.cpp
./src/occopt/output.cpp
./src/occopt/symfuncs.cpp
./src/occopt/optmodules.cpp
./src/occopt/ilstream.cpp
./src/occopt/iout.cpp
]
.sources += [
# Headers
Expand Down Expand Up @@ -179,74 +212,89 @@ let orangefront ! : Executable {
./src/occparse/unmangle.h
./src/occparse/winmode.h
./src/occparse/wseh.h
./src/ocpp/Errors.h
./src/ocpp/Floating.h
./src/ocpp/InputFile.h
./src/ocpp/MakeStubs.h
./src/ocpp/PipeArbitrator.h
./src/ocpp/ppCommon.h
./src/ocpp/ppCond.h
./src/ocpp/ppCtx.h
./src/ocpp/ppDefine.h
./src/ocpp/ppError.h
./src/ocpp/ppExpr.h
./src/ocpp/ppFile.h
./src/ocpp/ppInclude.h
./src/ocpp/ppkw.h
./src/ocpp/ppMacro.h
./src/ocpp/ppMain.h
./src/ocpp/ppPragma.h
./src/ocpp/PreProcessor.h
./src/ocpp/SymbolTable.h
./src/ocpp/Token.h
]
}

let orangeopt : Executable {
.configs += [ config config2 ]
.deps += common;
.sources += [
./src/occopt/beinterfdefs.h
./src/occopt/browsedefs.h
./src/occopt/config.h
./src/occopt/configmsil.h
./src/occopt/configx86.h
./src/occopt/ctypes.h
./src/occopt/ialias.cpp
./src/occopt/ialias.h
./src/occopt/iblock.h
./src/occopt/iconfl.cpp
./src/occopt/iconfl.h
./src/occopt/iconst.cpp
./src/occopt/iconst.h
./src/occopt/ifloatconv.h
./src/occopt/iflow.cpp
./src/occopt/iflow.h
./src/occopt/iinvar.cpp
./src/occopt/iinvar.h
./src/occopt/ilazy.cpp
./src/occopt/ilazy.h
./src/occopt/ildata.h
./src/occopt/ilive.cpp
./src/occopt/ilive.h
./src/occopt/ilocal.cpp
./src/occopt/ilocal.h
./src/occopt/iloop.cpp
./src/occopt/iloop.h
./src/occopt/ilstream.h
./src/occopt/ilunstream.cpp
./src/occopt/ilunstream.h
./src/occopt/iopt.h
./src/occopt/ioptimizer.h
./src/occopt/ioptutil.cpp
./src/occopt/ioptutil.h
./src/occopt/iout.h
./src/occopt/ipeep.cpp
./src/occopt/ipeep.h
./src/occopt/ipinning.cpp
./src/occopt/ipinning.h
./src/occopt/irc.cpp
./src/occopt/irc.h
./src/occopt/ireshape.cpp
./src/occopt/ireshape.h
./src/occopt/irewrite.cpp
./src/occopt/irewrite.h
./src/occopt/issa.cpp
./src/occopt/issa.h
./src/occopt/istren.cpp
./src/occopt/istren.h
./src/occopt/localprotect.cpp
./src/occopt/localprotect.h
./src/occopt/memory.h
./src/occopt/msilprocess.cpp
./src/occopt/optmain.cpp
./src/occopt/optmain.h
./src/occopt/optmodules.h
./src/occopt/OptUtils.h
./src/occopt/output.h
./src/occopt/optmodulerun.cpp
./src/occopt/rewritemsil.cpp
./src/occopt/rewritemsil.h
./src/occopt/rewritex86.cpp
./src/occopt/rewritex86.h
./src/occopt/symfuncs.h
./src/util/CmdFiles.h
./src/util/CmdSwitch.h
./src/util/FNV_hash.h
./src/util/LSDateTime.h
./src/util/SharedMemory.h
./src/util/ToolChain.h
./src/util/UTF8.h
./src/util/Utils.h
./src/util/xml.h
./src/ocpp/Errors.h
./src/ocpp/Floating.h
./src/ocpp/InputFile.h
./src/ocpp/MakeStubs.h
./src/ocpp/PipeArbitrator.h
./src/ocpp/ppCommon.h
./src/ocpp/ppCond.h
./src/ocpp/ppCtx.h
./src/ocpp/ppDefine.h
./src/ocpp/ppError.h
./src/ocpp/ppExpr.h
./src/ocpp/ppFile.h
./src/ocpp/ppInclude.h
./src/ocpp/ppkw.h
./src/ocpp/ppMacro.h
./src/ocpp/ppMain.h
./src/ocpp/ppPragma.h
./src/ocpp/PreProcessor.h
./src/ocpp/SymbolTable.h
./src/ocpp/Token.h
]

./src/ocpp/Floating.cpp
]
}

let all ! : Group {
.deps += [ orangefront orangeopt ]
}
8 changes: 6 additions & 2 deletions src/occopt/ilunstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ static AMODE* UnstreamAssemblyOperand()
static OCODE* UnstreamAssemblyInstruction()
{
OCODE* rv = Allocate<OCODE>();
#ifndef ORANGE_NO_INASM
rv->opcode = (e_opcode)UnstreamIndex();
rv->diag = UnstreamIndex();
rv->noopt = UnstreamIndex();
Expand All @@ -374,6 +375,9 @@ static OCODE* UnstreamAssemblyInstruction()
rv->oper1 = UnstreamAssemblyOperand();
rv->oper2 = UnstreamAssemblyOperand();
rv->oper3 = UnstreamAssemblyOperand();
#else
memset(rv,0,sizeof(OCODE));
#endif
return rv;
}
static Optimizer::IMODE* UnstreamOperand()
Expand Down Expand Up @@ -1269,8 +1273,8 @@ void ReadMappingFile(SharedMemory* mem, FILE* fil)
fseek(fil, 0, SEEK_END);
int end = ftell(fil);
fseek(fil, 0, SEEK_SET);
unsigned char* p = mem->GetMapping();
mem->EnsureCommitted(end);
unsigned char* p = mem->GetMapping();
while (end > 0)
{

Expand All @@ -1283,4 +1287,4 @@ void ReadMappingFile(SharedMemory* mem, FILE* fil)
p = mem->GetMapping(pos);
}
}
} // namespace Optimizer
} // namespace Optimizer
6 changes: 5 additions & 1 deletion src/ocpp/ppInclude.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,11 @@ std::string ppInclude::SrchPath(bool system, const std::string& name, const std:
}
AddName(buf, name);

#ifdef TARGET_OS_WINDOWS
while (char* p = (char*)strchr(buf, '/'))
#else
while (char* p = (char*)strchr(buf, '\\'))
#endif
{
*p = CmdFiles::DIR_SEP[0];
}
Expand Down Expand Up @@ -489,4 +493,4 @@ bool ppInclude::GetLine(std::string& line, int& lineno)
popFile();
}
return false;
}
}
7 changes: 6 additions & 1 deletion src/util/CmdFiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@
using namespace std; // borland puts the io stuff in the std namespace...
// microsoft does not seem to.

#ifdef TARGET_OS_WINDOWS
const char* CmdFiles::DIR_SEP = "\\";
const char* CmdFiles::PATH_SEP = ";";
#else
const char* CmdFiles::DIR_SEP = "/";
const char* CmdFiles::PATH_SEP = ":";
#endif

CmdFiles::~CmdFiles() {}
bool CmdFiles::Add(char** array, bool recurseDirs)
Expand Down Expand Up @@ -211,4 +216,4 @@ void CmdFiles::Remove(const std::string& name)
break;
}
}
}
}
6 changes: 5 additions & 1 deletion src/util/CmdSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,11 @@ bool CmdSwitchParser::Parse(int* argc, char* argv[])
memmove(argv, argv + 1, (*argc + 1 - i) * sizeof(char*));
(*argc)--;
}
else if ((argv[0][0] == '-' || argv[0][0] == '/' || (argv[0][0] == '+' && argv[0][1] != '-')) && argv[0][1] &&
else if ((argv[0][0] == '-' ||
#ifdef TARGET_OS_WINDOWS
argv[0][0] == '/' ||
#endif
(argv[0][0] == '+' && argv[0][1] != '-')) && argv[0][1] &&
(argv[0][1] != '-' || argv[0][2]))
{
const char* swtch = &argv[0][0];
Expand Down
Loading

0 comments on commit 7a12ea5

Please sign in to comment.