Skip to content

Commit

Permalink
more stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
krestenkrab committed Nov 12, 2009
1 parent 137064f commit 9401a93
Show file tree
Hide file tree
Showing 35 changed files with 1,007 additions and 200 deletions.
8 changes: 3 additions & 5 deletions .classpath
Expand Up @@ -6,11 +6,9 @@
<classpathentry kind="lib" path="lib/asm-3.2.jar" sourcepath="lib/src.zip"/>
<classpathentry kind="lib" path="lib/asm-commons-3.2.jar" sourcepath="lib/src.zip"/>
<classpathentry kind="lib" path="/Users/krab/Systems/antlr-3.2/lib/antlr-3.2.jar" sourcepath="/Users/krab/Downloads/antlr-3.2/runtime/Java/src/main/java"/>
<classpathentry kind="lib" path="/erjang/lib/asm-3.2.jar" sourcepath="/Users/krab/Downloads/asm-3.2/src.zip"/>
<classpathentry kind="lib" path="/erjang/lib/asm-analysis-3.2.jar"/>
<classpathentry kind="lib" path="/erjang/lib/asm-commons-3.2.jar"/>
<classpathentry kind="lib" path="/erjang/lib/asm-tree-3.2.jar"/>
<classpathentry kind="lib" path="/erjang/lib/asm-util-3.2.jar"/>
<classpathentry kind="lib" path="lib/OtpErlang.jar" sourcepath="/Users/krab/Systems/otp_src_R13B02-1/lib/jinterface/java_src"/>
<classpathentry kind="lib" path="lib/asm-analysis-3.2.jar"/>
<classpathentry kind="lib" path="lib/asm-util-3.2.jar"/>
<classpathentry kind="lib" path="lib/asm-tree-3.2.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Binary file modified erl/test1.beam
Binary file not shown.
17 changes: 17 additions & 0 deletions src/erjang/ENumber.java
Expand Up @@ -99,4 +99,21 @@ public ENumber add(int i2) {
throw new NotImplemented();
}

/**
* @param v2
* @return
*/
public ENumber divide(EObject v2) {
// TODO Auto-generated method stub
return null;
}

/**
* @param d2
* @return
*/
public ENumber divide(double d2) {
throw new NotImplemented();
}

}
63 changes: 48 additions & 15 deletions src/erjang/beam/analysis/BasicBlock.java
@@ -1,10 +1,28 @@
package org.erlang.beam;
/**
* This file is part of Erjang - A JVM-based Erlang VM
*
* Copyright (c) 2009 by Trifork
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/

package erjang.beam.analysis;

import java.util.Comparator;
import java.util.Set;
import java.util.TreeSet;

import org.erlang.ETuple2;
import erjang.ETuple2;

class BasicBlock {

Expand All @@ -13,16 +31,17 @@ class BasicBlock {

TreeSet<Integer> use = new TreeSet<Integer>();
TreeSet<Integer> kill = new TreeSet<Integer>();

TreeSet<Integer> in = new TreeSet<Integer>();
TreeSet<Integer> out = new TreeSet<Integer>();

Set<BasicBlock> succ = new TreeSet<BasicBlock>(
new Comparator<BasicBlock>() {
@Override
public int compare(BasicBlock o1, BasicBlock o2) {
if (o1==o2) return 0;

if (o1 == o2)
return 0;

int loff = o1.label - o2.label;
if (loff != 0) {
return loff;
Expand All @@ -41,18 +60,32 @@ public void succ(BasicBlock bb) {
succ.add(bb);
}

public void use_x(int reg) { use.add(KEY_X | reg); }
public void use_y(TypeMap map, int reg) { use.add(KEY_X | map.get_ypos(reg)); }
public void use_fr(int reg) { use.add(KEY_X | reg); }
public void use_x(int reg) {
use.add(KEY_X | reg);
}

public void use_y(TypeMap map, int reg) {
use.add(KEY_X | map.get_ypos(reg));
}

public void use_fr(int reg) {
use.add(KEY_X | reg);
}

public void kill_x(int reg) {
kill.add(KEY_X | reg);
}

public void kill_y(TypeMap map, int reg) {
kill.add(KEY_X | map.get_ypos(reg));
}

public void kill_x(int reg) { kill.add(KEY_X | reg); }
public void kill_y(TypeMap map, int reg) { kill.add(KEY_X | map.get_ypos(reg)); }
public void kill_fr(int reg) { kill.add(KEY_X | reg); }
public void kill_fr(int reg) {
kill.add(KEY_X | reg);
}

static final int KEY_X = 0 << 16;
static final int KEY_Y = 1 << 16;
static final int KEY_FR = 2 << 16;


}

}

0 comments on commit 9401a93

Please sign in to comment.