Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use UUIDs instead of Run. to segragate runtime and compiler module ve…
…rsions; build is quite shot at this point
  • Loading branch information
sorear committed Nov 21, 2012
1 parent da13155 commit 9ce3bae
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 21 deletions.
6 changes: 3 additions & 3 deletions Makefile
Expand Up @@ -22,13 +22,13 @@ srcunits=CClass CgOp Op OpHelpers Sig RxOp STD NieczaGrammar OptRxSimple \
Operator NieczaActions NieczaFrontendSTD NieczaPassSimplifier \
OptBeta NieczaPathSearch NieczaBackendDotnet NieczaCompiler GetOptLong

all: run/Niecza.exe run/Run.Kernel.dll obj/Run.CORE.dll
all: run/Niecza.exe run/Run.Kernel.dll obj/CORE.dll

$(patsubst %,boot/obj/Run.%.ser,$(srcunits)): boot/obj/Run.%.ser: .fetch-stamp src/%.pm6 boot/obj/Run.CORE.ser
cd src && NIECZA_KEEP_IL=1 $(RUN_CLR) ../boot/run/Niecza.exe --obj-dir ../boot/obj -C $*

# hack - put VERSION info in place so the setting build can embed it
obj/Run.CORE.dll: run/Niecza.exe obj/Run.Kernel.dll lib/CORE.setting
obj/CORE.dll: run/Niecza.exe obj/Run.Kernel.dll lib/CORE.setting
@git describe --tags > VERSION
$(RUN_CLR) run/Niecza.exe --obj-dir obj -C CORE

Expand Down Expand Up @@ -78,7 +78,7 @@ aot: all

test: all
$(RUN_CLR) run/Niecza.exe --obj-dir obj -c test.pl
prove -e "$(RUN_CLR)" obj/Run.MAIN.exe
prove -e "$(RUN_CLR)" obj/MAIN.exe

spectest: all
@t/run_spectests
Expand Down
8 changes: 0 additions & 8 deletions lib/CodeGen.cs
Expand Up @@ -3002,12 +3002,6 @@ class NamProcessor {
return CpsOp.MethodCall(mi, rst); };
handlers["rawscall"] = delegate(NamProcessor th, object[] z) {
string name = JScalar.S(z[1]);
// Horrible, horrible hack. We need to redirect references
// to CompilerBlob while compiling the compiler because
// otherwise they will be resolved to the compiler compiler's
// copy.
if (Backend.prefix == "Run.")
name = name.Replace("CompilerBlob", "Run.CompilerBlob");
int ixn = name.LastIndexOf(':');
Type cpsrt = null;
if (ixn >= 0) {
Expand Down Expand Up @@ -3418,8 +3412,6 @@ class NamProcessor {
}

public class Backend {
[TrueGlobal]
public static string prefix = (typeof(Backend).Assembly.GetName().Name == "Kernel") ? "" : "Run.";
[TrueGlobal]
public static bool cross_level_load;

Expand Down
11 changes: 3 additions & 8 deletions lib/Kernel.cs
Expand Up @@ -734,8 +734,8 @@ public sealed class RuntimeUnit : IFreeze {
if (name == "CORE")
Kernel.CreateBasicTypes(setting);

this.asm_name = Backend.prefix + name.Replace("::", ".");
this.dll_name = asm_name + (main ? ".exe" : ".dll");
this.asm_name = name.Replace("::", ".") + "." + Guid.NewGuid(); // force unique assembly names so that we can load multiple versions in a process
this.dll_name = name.Replace("::", ".") + (main ? ".exe" : ".dll");
our_subs = new List<SubInfo>();
}

Expand Down Expand Up @@ -6766,26 +6766,21 @@ class LastFrameNode {
// procedure, because initial code generation makes Run.CORE
// and we need to turn it into CORE for the compiler proper.

if (Backend.prefix != "") {
Console.Error.WriteLine("-gen-app may only be used with Kernel.dll");
Environment.Exit(1);
}
// this needs to be rethought for the new segregation model

string exename = args[1];
string fromdir = args[2];

// allow loading of Run. files, but don't try to load the
// assemblies, since we're not Run.Kernel
comp.obj_dir = fromdir;
Backend.prefix = "Run.";
Backend.cross_level_load = true;

RuntimeUnit root = (RuntimeUnit)
comp.reg.LoadUnit("MAIN").root;

// reset for writing
comp.obj_dir = AppDomain.CurrentDomain.BaseDirectory;
Backend.prefix = "";

RewriteUnits(root, root, new HashSet<RuntimeUnit>());

Expand Down
4 changes: 2 additions & 2 deletions lib/Serialize.cs
Expand Up @@ -151,7 +151,7 @@ struct ObjRef {
return units[name];
}

string file = Path.Combine(setting.obj_dir, Backend.prefix +
string file = Path.Combine(setting.obj_dir,
name.Replace("::",".") + ".ser");
byte[] bytes = File.ReadAllBytes(file);

Expand Down Expand Up @@ -203,7 +203,7 @@ struct ObjRef {
throw new InvalidOperationException("unit " +name+ " exists");

bool success = false;
string file = Path.Combine(setting.obj_dir, Backend.prefix +
string file = Path.Combine(setting.obj_dir,
name.Replace("::",".") + ".ser");

FreezeBuffer fb = new FreezeBuffer(this, su);
Expand Down

0 comments on commit 9ce3bae

Please sign in to comment.