-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make argument subtypes public, add type exposure
- Loading branch information
Showing
6 changed files
with
61 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 11 additions & 1 deletion
12
ssvm-invoke/src/main/java/dev/xdark/ssvm/invoke/DoubleArgument.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,32 @@ | ||
package dev.xdark.ssvm.invoke; | ||
|
||
import dev.xdark.ssvm.execution.Locals; | ||
import org.objectweb.asm.Type; | ||
|
||
/** | ||
* Int argument. | ||
* | ||
* @author xDark | ||
*/ | ||
final class DoubleArgument implements Argument { | ||
public final class DoubleArgument implements Argument { | ||
private final double value; | ||
|
||
DoubleArgument(double value) { | ||
this.value = value; | ||
} | ||
|
||
public double getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public int store(Locals locals, int index) { | ||
locals.setDouble(index, value); | ||
return 2; | ||
} | ||
|
||
@Override | ||
public Type getType() { | ||
return Type.DOUBLE_TYPE; | ||
} | ||
} |
12 changes: 11 additions & 1 deletion
12
ssvm-invoke/src/main/java/dev/xdark/ssvm/invoke/FloatArgument.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,32 @@ | ||
package dev.xdark.ssvm.invoke; | ||
|
||
import dev.xdark.ssvm.execution.Locals; | ||
import org.objectweb.asm.Type; | ||
|
||
/** | ||
* Float argument. | ||
* | ||
* @author xDark | ||
*/ | ||
final class FloatArgument implements Argument { | ||
public final class FloatArgument implements Argument { | ||
private final float value; | ||
|
||
FloatArgument(float value) { | ||
this.value = value; | ||
} | ||
|
||
public float getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public int store(Locals locals, int index) { | ||
locals.setFloat(index, value); | ||
return 1; | ||
} | ||
|
||
@Override | ||
public Type getType() { | ||
return Type.FLOAT_TYPE; | ||
} | ||
} |
12 changes: 11 additions & 1 deletion
12
ssvm-invoke/src/main/java/dev/xdark/ssvm/invoke/IntArgument.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,32 @@ | ||
package dev.xdark.ssvm.invoke; | ||
|
||
import dev.xdark.ssvm.execution.Locals; | ||
import org.objectweb.asm.Type; | ||
|
||
/** | ||
* Int argument. | ||
* | ||
* @author xDark | ||
*/ | ||
final class IntArgument implements Argument { | ||
public final class IntArgument implements Argument { | ||
private final int value; | ||
|
||
IntArgument(int value) { | ||
this.value = value; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public int store(Locals locals, int index) { | ||
locals.setInt(index, value); | ||
return 1; | ||
} | ||
|
||
@Override | ||
public Type getType() { | ||
return Type.INT_TYPE; | ||
} | ||
} |
12 changes: 11 additions & 1 deletion
12
ssvm-invoke/src/main/java/dev/xdark/ssvm/invoke/LongArgument.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,32 @@ | ||
package dev.xdark.ssvm.invoke; | ||
|
||
import dev.xdark.ssvm.execution.Locals; | ||
import org.objectweb.asm.Type; | ||
|
||
/** | ||
* Long argument. | ||
* | ||
* @author xDark | ||
*/ | ||
final class LongArgument implements Argument { | ||
public final class LongArgument implements Argument { | ||
private final long value; | ||
|
||
LongArgument(long value) { | ||
this.value = value; | ||
} | ||
|
||
public long getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public int store(Locals locals, int index) { | ||
locals.setLong(index, value); | ||
return 2; | ||
} | ||
|
||
@Override | ||
public Type getType() { | ||
return Type.LONG_TYPE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters