Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[java] compiling but non working addition of 5 more classes into the …
…dependency circle
  • Loading branch information
Martin Berends committed Aug 27, 2010
1 parent e0399b0 commit 1de869a
Show file tree
Hide file tree
Showing 6 changed files with 421 additions and 41 deletions.
123 changes: 82 additions & 41 deletions java/runtime/Makefile
@@ -1,16 +1,23 @@
# Makefile for 6model/java/runtime

ALL_CLASSES = \
ALL_BUILD_TARGETS = \
Rakudo/Metamodel/Hints.class \
Rakudo/Serialization/SerializationContext.class \
Rakudo/Metamodel/RakudoObject.class \
Rakudo/Metamodel/Representation.class \
Rakudo/Metamodel/REPRRegistry.class
Rakudo/Runtime/ExecutionDomain.class \
Rakudo/Metamodel/RakudoObject.class

# Rakudo/Metamodel/SharedTable.class
# Rakudo/Metamodel/KnowHOW/KnowHOWREPR.class

all: $(ALL_CLASSES)
OTHER_DEPENDENT_TARGETS = \
Rakudo/Runtime/Lexpad.class \
Rakudo/Runtime/Parameter.class \
Rakudo/Runtime/Signature.class \
Rakudo/Metamodel/Representation.class \
Rakudo/Metamodel/REPRRegistry.class \
Rakudo/Metamodel/Representations/RakudoCodeRef.class \
Rakudo/Metamodel/SharedTable.class

all: $(ALL_BUILD_TARGETS)

# compiles ok: (listed in dependency order)
Rakudo/Metamodel/Hints.class: Rakudo/Metamodel/Hints.java
Expand All @@ -19,18 +26,29 @@ Rakudo/Metamodel/Hints.class: Rakudo/Metamodel/Hints.java
Rakudo/Serialization/SerializationContext.class: Rakudo/Serialization/SerializationContext.java
javac Rakudo/Serialization/SerializationContext.java

Rakudo/Runtime/ExecutionDomain.class: Rakudo/Runtime/ExecutionDomain.java
javac Rakudo/Runtime/ExecutionDomain.java

# There is a long circular dependency from RakudoObject to SharedTable.
# Handle it by compiling all the files involved in a single step.
# Thanks jnthn++ for the suggestion.
Rakudo/Metamodel/RakudoObject.class: Rakudo/Metamodel/RakudoObject.java \
Rakudo/Serialization/SerializationContext.class \
Rakudo/Metamodel/Representation.java \
Rakudo/Metamodel/REPRRegistry.java \
Rakudo/Runtime/Lexpad.java \
Rakudo/Runtime/Parameter.java \
Rakudo/Runtime/Signature.java \
Rakudo/Metamodel/Representations/RakudoCodeRef.java \
Rakudo/Metamodel/SharedTable.java
javac \
Rakudo/Metamodel/RakudoObject.java \
Rakudo/Metamodel/Representation.java \
Rakudo/Metamodel/REPRRegistry.java \
Rakudo/Runtime/Lexpad.java \
Rakudo/Runtime/Parameter.java \
Rakudo/Runtime/Signature.java \
Rakudo/Metamodel/Representations/RakudoCodeRef.java \
Rakudo/Metamodel/SharedTable.java

Rakudo/Metamodel/Representations/RakudoCodeRef.class: Rakudo/Metamodel/Representations/RakudoCodeRef.java \
Expand All @@ -47,29 +65,29 @@ Rakudo/Runtime/ThreadContext.class: Rakudo/Runtime/ThreadContext.java \
Rakudo/Metamodel/RakudoObject.class
javac Rakudo/Runtime/ThreadContext.java

# Dependency critical paths (1 and 2 are circular)
# (less significant dependencies omitted for simplicity)
# Dependency critical paths (1 2 and 3 are circular)
# (partial diagram - less significant dependencies omitted for simplicity)
#
# Hints
# |
# Serialization
# SerializationContext ExecutionDomain
# |
# +-----------> RakudoObject
# | | |
# | Parameter |
# | | |
# | Signature Representation
# | | | | |
# | +-+---> RakudoCodeRef | REPRRegistry
# | | | | |
# 1 2 3 Context |
# | | | | |
# | | +--- ThreadContext |
# | | | |
# | | IFindMethod |
# | | | |
# +-+-------------- SharedTable
# |
# +--------------> RakudoObject
# | |
# | SerializationContext
# | |
# | Representation
# | | | |
# | +--> RakudoCodeRef | REPRRegistry
# | | | |
# 1 2 Context |
# | | | |
# | +--- ThreadContext |
# | | |
# | IFindMethod |
# | | |
# +---------------- SharedTable
# |

Rakudo/Metamodel/IFindMethod.class: Rakudo/Metamodel/IFindMethod.java
Rakudo/Metamodel/RakudoObject.class \
Expand All @@ -93,38 +111,61 @@ Rakudo/Metamodel/KnowHOW/KnowHOWREPR.class: Rakudo/Metamodel/KnowHOW/KnowHOWREPR
Rakudo/Metamodel/Hints.class
javac Rakudo/Metamodel/KnowHOW/KnowHOWREPR.java

Rakudo/Runtime/Parameter.class: Rakudo/Runtime/Parameter.java \
Rakudo/Metamodel/RakudoObject.class
javac Rakudo/Runtime/Parameter.java

Rakudo/Runtime/Signature.class: Rakudo/Runtime/Signature.java \
Rakudo/Runtime/Parameter.class
javac Rakudo/Runtime/Signature.java

# System to report which files are older than their dotnet equivalents.
# Compare the reported files manually, and refresh the java file.
PORTED_SOURCE_FILES = \
TRANSLATED_SOURCE_FILES = \
Rakudo/Metamodel/Hints.java \
Rakudo/Serialization/SerializationContext.java \
Rakudo/Metamodel/RakudoObject.java \
Rakudo/Metamodel/Representation.java

Rakudo/Runtime/Parameter.java \
Rakudo/Runtime/Signature.java \
Rakudo/Metamodel/Representation.java \
Rakudo/Metamodel/Representations/RakudoCodeRef.java
# Java source code files "depend" on files in the dotnet/ directories,
# in the sense that they are manual translations. The following
# dependencies cause on C# that can only be satisfied by
# manual editing.
# in the sense that they are manual translations.
# The following definitions cause make to exit with an todo message if
# a dotnet/ file becomes newer than a java/ file.
# The way to clear the error is to compare the files in question, and
# then to refresh the java/ file to be newer than the dotnet/ one.
Rakudo/Metamodel/Hints.java: ../../dotnet/runtime/Metamodel/Representation.cs
@echo "warning: Rakudo/Metamodel/Hints.java is older than ../../dotnet/runtime/Metamodel/Representation.cs"
@echo "todo: Rakudo/Metamodel/Hints.java is older than ../../dotnet/runtime/Metamodel/Representation.cs"

Rakudo/Serialization/SerializationContext.java: ../../dotnet/runtime/Serialization/SerializationContext.cs
@echo "warning: Rakudo/Serialization/SerializationContext.java is older than ../../dotnet/runtime/Serialization/SerializationContext.cs"
@echo "todo: Rakudo/Serialization/SerializationContext.java is older than ../../dotnet/runtime/Serialization/SerializationContext.cs"

Rakudo/Metamodel/RakudoObject.java: ../../dotnet/runtime/Metamodel/RakudoObject.cs
@echo "warning: Rakudo/Metamodel/RakudoObject.java is older than ../../dotnet/runtime/Metamodel/RakudoObject.cs"
@echo "todo: Rakudo/Metamodel/RakudoObject.java is older than ../../dotnet/runtime/Metamodel/RakudoObject.cs"

Rakudo/Runtime/Parameter.java: ../../dotnet/runtime/Runtime/Signatures/Parameter.cs
@echo "todo: Rakudo/Runtime/Parameter.java is older than ../../dotnet/runtime/Runtime/Signatures/Parameter.cs"

Rakudo/Runtime/Signature.java: ../../dotnet/runtime/Runtime/Signatures/Signature.cs
@echo "todo: Rakudo/Runtime/Signature.java is older than ../../dotnet/runtime/Metamodel/Signatures/Signature.cs"

Rakudo/Metamodel/Representation.java: ../../dotnet/runtime/Metamodel/Representation.cs
@echo "warning: Rakudo/Metamodel/Representation.java is older than ../../dotnet/runtime/Metamodel/Representation.cs"
@echo "todo: Rakudo/Metamodel/Representation.java is older than ../../dotnet/runtime/Metamodel/Representation.cs"

Rakudo/Metamodel/Representations/RakudoCodeRef.java: ../../dotnet/runtime/Metamodel/Representations/RakudoCodeRef.cs
@echo "todo: $@ is older than $<"

todoreport: $(PORTED_SOURCE_FILES)
# To show java files that are older than their dotnet equivalents, run:
# make todolist
todolist: $(TRANSLATED_SOURCE_FILES)

clean:
perl -MExtUtils::Command -e rm_f $(ALL_CLASSES)
perl -MExtUtils::Command -e rm_f $(ALL_BUILD_TARGETS) $(OTHER_DEPENDENT_TARGETS)

help:
@echo "In 6model/java/runtime you can make the following:"
@echo "all (default) compile everything"
@echo "clean remove compiled class files"
@echo "todoreport list files where dotnet version is newer than java"
@echo "help this summary"
@echo "all (default) compile everything"
@echo "clean remove compiled class files"
@echo "todolist show files where java version is older than dotnet"
@echo "help this summary"
173 changes: 173 additions & 0 deletions java/runtime/Rakudo/Metamodel/Representations/RakudoCodeRef.java
@@ -0,0 +1,173 @@
package Rakudo.Metamodel.Representations;

import java.util.HashMap; // HashMap
//import Rakudo.Runtime.Context;
//import Rakudo.Runtime.ThreadContext;
import Rakudo.Runtime.Lexpad;
import Rakudo.Runtime.Parameter;
import Rakudo.Runtime.Signature;
import Rakudo.Metamodel.SharedTable;
import Rakudo.Metamodel.Hints;
import Rakudo.Metamodel.Representation;
import Rakudo.Metamodel.RakudoObject;
import Rakudo.Serialization.SerializationContext;

/// <summary>
/// A representation for low-level code references. This is something
/// specific to this Rakudo backend, not something standard accross all
/// Rakudo backends.
/// </summary>
public final class RakudoCodeRef implements Representation
{

/// <summary>
/// This is how the boxed form of a P6str looks.
/// </summary>
public final class Instance implements RakudoObject
{
private SerializationContext sc;
public SerializationContext getSC() { return new SerializationContext(); }
public void setSC( SerializationContext sc ) {;}
/*
/// <summary>
/// The code body - the thing that actually runs instructions.
/// </summary>
// public Func<ThreadContext, RakudoObject, RakudoObject, RakudoObject> Body;
*/

/// <summary>
/// The static lexpad.
/// </summary>
public Lexpad StaticLexPad;

/// <summary>
/// Our static outer block.
/// </summary>
public Instance OuterBlock;

/// <summary>
/// Signature object.
/// </summary>
public Signature Sig;
/*
/// <summary>
/// The context currently using this sub.
/// </summary>
public Context CurrentContext;
/// <summary>
/// Constructor.
/// </summary>
public Instance(SharedTable sharedTable)
{
this.STable = sharedTable;
}
*/
}
public RakudoObject type_object_for(RakudoObject how){return new Instance();}
public RakudoObject instance_of(RakudoObject what){return new Instance();}
public boolean defined(RakudoObject obj){return false;}
/*
/// <summary>
/// Create a new type object.
/// </summary>
/// <param name="MetaPackage"></param>
/// <returns></returns>
public RakudoObject type_object_for(RakudoObject MetaPackage)
{
// Do the usual bits of setup for the type-object.
SharedTable STable = new SharedTable();
STable.HOW = MetaPackage;
STable.REPR = this;
// STable.WHAT = new Instance(STable);
// Also twiddle the S-Table's Invoke to invoke the contained
// function.
STable.Invoke = new IRakudoObject_Invokable() {
// public RakudoObject Invoke( TC, Obj, Cap ) {
// ((RakudoCodeRef.Instance)Obj).Body(TC, Obj, Cap);
// }
};
// STable.Invoke = (TC, Obj, Cap) =>
// ((RakudoCodeRef.Instance)Obj).Body(TC, Obj, Cap);
return STable.WHAT;
}
/// <summary>
/// Creates an instance of the type with the given type object.
/// </summary>
/// <param name="WHAT"></param>
/// <returns></returns>
public RakudoObject instance_of(RakudoObject rakudoobject)
{
return new Instance(rakudoobject.STable);
}
/// <summary>
/// Determines if the representation is defined or not.
/// </summary>
/// <param name="Obj"></param>
/// <returns></returns>
public boolean defined(RakudoObject rakudoobject)
{
return ((Instance)rakudoobject).Body != null;
}
*/

public RakudoObject get_attribute(RakudoObject Object, RakudoObject ClassHandle, String Name)
{
throw new UnsupportedOperationException("RakudoCodeRef objects cannot store additional attributes.");
}

public RakudoObject get_attribute_with_hint(RakudoObject Object, RakudoObject ClassHandle, String Name, int Hint)
{
throw new UnsupportedOperationException("RakudoCodeRef objects cannot store additional attributes.");
}

public void bind_attribute(RakudoObject Object, RakudoObject ClassHandle, String Name, RakudoObject Value)
{
throw new UnsupportedOperationException("RakudoCodeRef objects cannot store additional attributes.");
}

public void bind_attribute_with_hint(RakudoObject Object, RakudoObject ClassHandle, String Name, int Hint, RakudoObject Value)
{
throw new UnsupportedOperationException("RakudoCodeRef objects cannot store additional attributes.");
}

public int hint_for(RakudoObject ClassHandle, String Name)
{
return Hints.NO_HINT;
}

public void set_int(RakudoObject Object, int Value)
{
throw new UnsupportedOperationException("This type of representation cannot box a native int");
}

public int get_int(RakudoObject Object)
{
throw new UnsupportedOperationException("This type of representation cannot unbox to a native int");
}

public void set_num(RakudoObject Object, double Value)
{
throw new UnsupportedOperationException("This type of representation cannot box a native num");
}

public double get_num(RakudoObject Object)
{
throw new UnsupportedOperationException("This type of representation cannot unbox to a native num");
}

public void set_str(RakudoObject Object, String Value)
{
throw new UnsupportedOperationException("This type of representation cannot box a native string");
}

public String get_str(RakudoObject Object)
{
throw new UnsupportedOperationException("This type of representation cannot unbox to a native string");
}
}

12 changes: 12 additions & 0 deletions java/runtime/Rakudo/Runtime/ExecutionDomain.java
@@ -0,0 +1,12 @@
package Rakudo.Runtime;

/// <summary>
/// An execution domain is the root of all state we keep around for a
/// running Perl 6 program. We may manage to have multiple of these in
/// memory, and they'd be isolated from each other.
/// </summary>
public class ExecutionDomain
{

}

13 changes: 13 additions & 0 deletions java/runtime/Rakudo/Runtime/Lexpad.java
@@ -0,0 +1,13 @@
package Rakudo.Runtime;

//import Rakudo.Metamodel.RakudoObject;
//import Rakudo.Runtime.Context;

/// <summary>
///
/// </summary>
public class Lexpad
{

}

0 comments on commit 1de869a

Please sign in to comment.