Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Start passing arg list as a parameter.
This is first step in getting rid of the field for passing this.
  • Loading branch information
jnthn committed Mar 2, 2013
1 parent 4f60799 commit 1d30e11
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
6 changes: 5 additions & 1 deletion src/org/perl6/nqp/jast2bc/JASTToJVMBytecode.java
Expand Up @@ -226,7 +226,11 @@ else if (curLine.startsWith(".push_sc ")) {
}
else if (curLine.startsWith(".push_cc ")) {
String className = curLine.substring(".push_sc ".length());
il.append(new LDC(cp.addClass((ObjectType)processType(className))));
Type t = processType(className);
if (t instanceof ArrayType)
il.append(new LDC(cp.addArrayClass((ArrayType)t)));
else
il.append(new LDC(cp.addClass((ObjectType)t)));
}
else if (curLine.startsWith(".push_idx ")) {
Integer value = Integer.parseInt(curLine.substring(".push_idx ".length()));
Expand Down
4 changes: 3 additions & 1 deletion src/org/perl6/nqp/runtime/Ops.java
Expand Up @@ -1243,7 +1243,8 @@ private static void invokeInternal(ThreadContext tc, SixModelObject invokee, Cal

try {
// Do the invocation.
cr.staticInfo.mh.invokeExact(tc, cr, csd);
cr.staticInfo.mh.invokeExact(tc, cr, csd,
tc.curFrame == null ? null : tc.curFrame.args);
}
catch (UnwindException e) {
throw e;
Expand All @@ -1252,6 +1253,7 @@ private static void invokeInternal(ThreadContext tc, SixModelObject invokee, Cal
throw e;
}
catch (Throwable e) {
System.err.println(e.toString());
ExceptionHandling.dieInternal(tc, e.getMessage());
}
}
Expand Down
26 changes: 13 additions & 13 deletions src/org/perl6/nqp/sixmodel/KnowHOWMethods.java
Expand Up @@ -15,7 +15,7 @@
* for code reference like things.
*/
public class KnowHOWMethods extends CompilationUnit {
public void new_type(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
public void new_type(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd, Object[] args) {
/* Get arguments. */
CallFrame cf = new CallFrame(tc, cr);
try {
Expand Down Expand Up @@ -56,7 +56,7 @@ public void new_type(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
}
}

public void add_method(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
public void add_method(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd, Object[] args) {
CallFrame cf = new CallFrame(tc, cr);
try {
csd = Ops.checkarity(cf, csd, 4, 4);
Expand All @@ -76,7 +76,7 @@ public void add_method(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
}
}

public void add_attribute(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
public void add_attribute(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd, Object[] args) {
CallFrame cf = new CallFrame(tc, cr);
try {
csd = Ops.checkarity(cf, csd, 3, 3);
Expand All @@ -97,7 +97,7 @@ public void add_attribute(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd)
}
}

public void compose(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
public void compose(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd, Object[] args) {
CallFrame cf = new CallFrame(tc, cr);
try {
csd = Ops.checkarity(cf, csd, 2, 2);
Expand Down Expand Up @@ -168,7 +168,7 @@ public void compose(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
}
}

public void attributes(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
public void attributes(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd, Object[] args) {
CallFrame cf = new CallFrame(tc, cr);
try {
csd = Ops.checkarity(cf, csd, 2, 2);
Expand All @@ -192,7 +192,7 @@ public void attributes(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
}
}

public void methods(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
public void methods(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd, Object[] args) {
CallFrame cf = new CallFrame(tc, cr);
try {
csd = Ops.checkarity(cf, csd, 2, 2);
Expand All @@ -216,7 +216,7 @@ public void methods(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
}
}

public void name(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
public void name(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd, Object[] args) {
CallFrame cf = new CallFrame(tc, cr);
try {
csd = Ops.checkarity(cf, csd, 2, 2);
Expand All @@ -232,7 +232,7 @@ public void name(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
}
}

public void attr_new(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
public void attr_new(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd, Object[] args) {
CallFrame cf = new CallFrame(tc, cr);
try {
/* Process arguments. */
Expand Down Expand Up @@ -260,7 +260,7 @@ public void attr_new(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
}
}

public void attr_compose(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
public void attr_compose(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd, Object[] args) {
CallFrame cf = new CallFrame(tc, cr);
try {
csd = Ops.checkarity(cf, csd, 1, 1);
Expand All @@ -272,7 +272,7 @@ public void attr_compose(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
}
}

public void attr_name(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
public void attr_name(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd, Object[] args) {
CallFrame cf = new CallFrame(tc, cr);
try {
csd = Ops.checkarity(cf, csd, 1, 1);
Expand All @@ -284,7 +284,7 @@ public void attr_name(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
}
}

public void attr_type(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
public void attr_type(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd, Object[] args) {
CallFrame cf = new CallFrame(tc, cr);
try {
csd = Ops.checkarity(cf, csd, 1, 1);
Expand All @@ -296,7 +296,7 @@ public void attr_type(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
}
}

public void attr_box_target(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd) {
public void attr_box_target(ThreadContext tc, CodeRef cr, CallSiteDescriptor csd, Object[] args) {
CallFrame cf = new CallFrame(tc, cr);
try {
csd = Ops.checkarity(cf, csd, 1, 1);
Expand All @@ -313,7 +313,7 @@ public CodeRef[] getCodeRefs() {
String[] snull = null;
long[][] hnull = new long[0][];
MethodType mt = MethodType.methodType(void.class, ThreadContext.class,
CodeRef.class, CallSiteDescriptor.class);
CodeRef.class, CallSiteDescriptor.class, Object[].class);
Lookup l = MethodHandles.lookup();
try {
refs[0] = new CodeRef(this, l.findVirtual(KnowHOWMethods.class, "new_type", mt).bindTo(this),
Expand Down

0 comments on commit 1d30e11

Please sign in to comment.