/
CallNormalOp.java
76 lines (64 loc) · 1.99 KB
/
CallNormalOp.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* This file is part of the Jikes RVM project (http://jikesrvm.org).
*
* This file is licensed to You under the Common Public License (CPL);
* You may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.opensource.org/licenses/cpl1.0.php
*
* See the COPYRIGHT.txt file distributed with this work for information
* regarding copyright ownership.
*/
package org.mmtk.harness.lang.pcode;
import java.util.List;
import org.mmtk.harness.lang.Env;
import org.mmtk.harness.lang.Trace;
import org.mmtk.harness.lang.Trace.Item;
import org.mmtk.harness.lang.ast.AST;
import org.mmtk.harness.lang.compiler.CompiledMethod;
import org.mmtk.harness.lang.compiler.Register;
/**
* A pseudo-op that calls a method written in the script language.
*/
public final class CallNormalOp extends CallOp implements ResolvableOp {
private CompiledMethod method;
/** A method call that returns a result */
public CallNormalOp(AST source, Register resultTemp, CompiledMethod method, List<Register> params) {
super(source,resultTemp, params);
this.method = method;
}
/** A method call without a return value */
public CallNormalOp(AST source, CompiledMethod method, List<Register> params) {
super(source,params);
this.method = method;
}
/** Accessor for the enclosed method */
public CompiledMethod getMethod() {
return method;
}
/**
* Replace compiled-method-proxies with their resolved versions.
*/
@Override
public void resolve() {
if (!method.isResolved()) {
Trace.trace(Item.COMPILER,"Resolving call to method %s%n", method.getName());
method = method.resolve();
}
}
/**
* All the fun happens in @link{org.mmtk.harness.lang.runtime.PcodeInterpreter}
*/
@Override
public void exec(Env env) {
}
@Override
public boolean isCall() {
return true;
}
@Override
public String toString() {
return super.toString().replace("call","call "+method.getName());
}
}