Interface JitCompiledPassage
JitCompiler
.
This also serves as a run-time library of routines that implement p-code ops not trivially implemented by the JVM or its run-time library. In theory, they can be inlined by the JVM's JIT at its discretion.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final record
An entry point into a translated passagestatic class
An entry point that is not yet bound to a specific threadstatic class
A cache slot for a chained entry point -
Method Summary
Modifier and TypeMethodDescriptionstatic long
conv2IntToLong
(int msl, int lsl) Convert two integers into a single longdefault void
count
(int instructions, int trailingOps) InvokeJitPcodeThread.count(int, int)
for the bound threadstatic RegisterValue
createContext
(Language language, String value) Construct a contextreg value from the given language and hex valuedefault DecodePcodeExecutionException
createDecodeError
(String message, long counter) Construct an exception when attempting to execute an "instruction" that could not be decoded.default JitCompiledPassage.ExitSlot
createExitSlot
(long target, RegisterValue ctx) Construct an exit slot for the given branch targetstatic Varnode
createVarnode
(AddressFactory factory, String space, long offset, int size) Construct a varnodeGet the chained entry point for the given exit point's targetstatic Language
getLanguage
(String languageID) Get the language for the given string language IDdefault PcodeUseropLibrary.PcodeUseropDefinition
<byte[]> getUseropDefinition
(String name) Retrieve a userop definition from the bound thread.static int
intLeft
(int val, int amt) The implementation ofint_left
on JVM ints.static int
intLeft
(int val, long amt) The implementation ofint_left
on JVM int with long amt.static long
intLeft
(long val, int amt) The implementation ofint_left
on JVM long with int amt.static long
intLeft
(long val, long amt) The implementation ofint_left
on JVM longs.static int
intRight
(int val, int amt) The implementation ofint_right
on JVM ints.static int
intRight
(int val, long amt) The implementation ofint_right
on JVM int with long amt.static long
intRight
(long val, int amt) The implementation ofint_right
on JVM long with int amt.static long
intRight
(long val, long amt) The implementation ofint_right
on JVM longs.static int
intSRight
(int val, int amt) The implementation ofint_sright
on JVM ints.static int
intSRight
(int val, long amt) The implementation ofint_sright
on JVM int with long amt.static long
intSRight
(long val, int amt) The implementation ofint_sright
on JVM long with int amt.static long
intSRight
(long val, long amt) The implementation ofint_sright
on JVM longs.default void
invokeUserop
(PcodeUseropLibrary.PcodeUseropDefinition<byte[]> userop, Varnode output, Varnode[] inputs) Invoke the given userop on the bound thread with the given operandsstatic int
readInt1
(byte[] arr, int offset) Read anint1
from the given array at the given offsetstatic int
readIntBE2
(byte[] arr, int offset) Read anint2
from the given array at the given offset in big endianstatic int
readIntBE3
(byte[] arr, int offset) Read anint3
from the given array at the given offset in big endianstatic int
readIntBE4
(byte[] arr, int offset) Read anint4
from the given array at the given offset in big endianstatic int
readIntLE2
(byte[] arr, int offset) Read anint2
from the given array at the given offset in little endianstatic int
readIntLE3
(byte[] arr, int offset) Read anint3
from the given array at the given offset in little endianstatic int
readIntLE4
(byte[] arr, int offset) Read anint4
from the given array at the given offset in little endianstatic long
readLong1
(byte[] arr, int offset) Read anint1
from the given array at the given offset.static long
readLongBE2
(byte[] arr, int offset) Read anint2
from the given array at the given offset in big endian.static long
readLongBE3
(byte[] arr, int offset) Read anint3
from the given array at the given offset in big endian.static long
readLongBE4
(byte[] arr, int offset) Read anint4
from the given array at the given offset in big endian.static long
readLongBE5
(byte[] arr, int offset) Read anint5
from the given array at the given offset in big endian.static long
readLongBE6
(byte[] arr, int offset) Read anint6
from the given array at the given offset in big endian.static long
readLongBE7
(byte[] arr, int offset) Read anint7
from the given array at the given offset in big endian.static long
readLongBE8
(byte[] arr, int offset) Read anint8
from the given array at the given offset in big endian.static long
readLongLE2
(byte[] arr, int offset) Read anint2
from the given array at the given offset in little endian.static long
readLongLE3
(byte[] arr, int offset) Read anint3
from the given array at the given offset in little endian.static long
readLongLE4
(byte[] arr, int offset) Read anint4
from the given array at the given offset in little endian.static long
readLongLE5
(byte[] arr, int offset) Read anint5
from the given array at the given offset in little endian.static long
readLongLE6
(byte[] arr, int offset) Read anint6
from the given array at the given offset in little endian.static long
readLongLE7
(byte[] arr, int offset) Read anint7
from the given array at the given offset in little endian.static long
readLongLE8
(byte[] arr, int offset) Read anint8
from the given array at the given offset in little endian.default void
retireCounterAndContext
(long counter, RegisterValue context) Set the bound thread's program counter and decode context.run
(int blockId) Run the compiled passage of codestatic int
sBorrowIntRaw
(int a, int b) The implementation ofint_sborrow
on JVM ints.static long
sBorrowLongRaw
(long a, long b) The implementation ofint_sborrow
on JVM longs.static int
sCarryIntRaw
(int a, int b) The implementation ofint_scarry
on JVM ints.static long
sCarryLongRaw
(long a, long b) The implementation ofint_scarry
on JVM longs.thread()
Get this instance's bound thread.static void
writeInt1
(int value, byte[] arr, int offset) Write anint1
into the given array at the given offsetstatic void
writeIntBE2
(int value, byte[] arr, int offset) Write anint2
into the given array at the given offset in big endianstatic void
writeIntBE3
(int value, byte[] arr, int offset) Write anint3
into the given array at the given offset in big endianstatic void
writeIntBE4
(int value, byte[] arr, int offset) Write anint4
into the given array at the given offset in big endianstatic void
writeIntLE2
(int value, byte[] arr, int offset) Write anint2
into the given array at the given offset in litte endianstatic void
writeIntLE3
(int value, byte[] arr, int offset) Write anint3
into the given array at the given offset in litte endianstatic void
writeIntLE4
(int value, byte[] arr, int offset) Write anint4
into the given array at the given offset in litte endianstatic void
writeLong1
(long value, byte[] arr, int offset) Write anint1
into the given array at the given offset.static void
writeLongBE2
(long value, byte[] arr, int offset) Write anint2
into the given array at the given offset in big endian.static void
writeLongBE3
(long value, byte[] arr, int offset) Write anint3
into the given array at the given offset in big endian.static void
writeLongBE4
(long value, byte[] arr, int offset) Write anint4
into the given array at the given offset in big endian.static void
writeLongBE5
(long value, byte[] arr, int offset) Write anint5
into the given array at the given offset in big endian.static void
writeLongBE6
(long value, byte[] arr, int offset) Write anint6
into the given array at the given offset in big endian.static void
writeLongBE7
(long value, byte[] arr, int offset) Write anint7
into the given array at the given offset in big endian.static void
writeLongBE8
(long value, byte[] arr, int offset) Write anint8
into the given array at the given offset in big endian.static void
writeLongLE2
(long value, byte[] arr, int offset) Write anint2
into the given array at the given offset in little endian.static void
writeLongLE3
(long value, byte[] arr, int offset) Write anint3
into the given array at the given offset in little endian.static void
writeLongLE4
(long value, byte[] arr, int offset) Write anint4
into the given array at the given offset in little endian.static void
writeLongLE5
(long value, byte[] arr, int offset) Write anint5
into the given array at the given offset in little endian.static void
writeLongLE6
(long value, byte[] arr, int offset) Write anint6
into the given array at the given offset in little endian.static void
writeLongLE7
(long value, byte[] arr, int offset) Write anint7
into the given array at the given offset in little endian.static void
writeLongLE8
(long value, byte[] arr, int offset) Write anint8
into the given array at the given offset in little endian.
-
Method Details
-
run
Run the compiled passage of codeExcept during testing, this is ordinarily called by
JitCompiledPassage.EntryPoint.run()
. Too see how this fits into the overall JIT-accelerated execution loop, seeJitPcodeThread
. All implementations of this interface are generated dynamically. To understand that process and how the entry points are generated and exported, seeJitCompiler
.This method may or may not return a chained entry point. Each passage caches a chained entry point for each of its direct branch targets. This averts a map lookup on subsequent exits via the same branch. If a chained entry point is returned, the thread ought to execute it immediately, unless it has become suspended. Otherwise, the thread must repeat its execution loop at the Fetch step.
- Parameters:
blockId
- an index identifying the target address and contextreg where execution should enter- Returns:
- a chained entry point, or
null
-
readInt1
static int readInt1(byte[] arr, int offset) Read anint1
from the given array at the given offsetThis is invoked by dynamically generated code.
- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM int
-
readIntBE2
static int readIntBE2(byte[] arr, int offset) Read anint2
from the given array at the given offset in big endianThis is invoked by dynamically generated code.
- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM int
-
readIntBE3
static int readIntBE3(byte[] arr, int offset) Read anint3
from the given array at the given offset in big endianThis is invoked by dynamically generated code.
- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM int
-
readIntBE4
static int readIntBE4(byte[] arr, int offset) Read anint4
from the given array at the given offset in big endianThis is invoked by dynamically generated code.
- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM int
-
readIntLE2
static int readIntLE2(byte[] arr, int offset) Read anint2
from the given array at the given offset in little endianThis is invoked by dynamically generated code.
- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM int
-
readIntLE3
static int readIntLE3(byte[] arr, int offset) Read anint3
from the given array at the given offset in little endianThis is invoked by dynamically generated code.
- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM int
-
readIntLE4
static int readIntLE4(byte[] arr, int offset) Read anint4
from the given array at the given offset in little endianThis is invoked by dynamically generated code.
- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM int
-
writeInt1
static void writeInt1(int value, byte[] arr, int offset) Write anint1
into the given array at the given offsetThis is invoked by dynamically generated code.
- Parameters:
value
- the value as a JVM intarr
- the arrayoffset
- the offset
-
writeIntBE2
static void writeIntBE2(int value, byte[] arr, int offset) Write anint2
into the given array at the given offset in big endianThis is invoked by dynamically generated code.
- Parameters:
value
- the value as a JVM intarr
- the arrayoffset
- the offset
-
writeIntBE3
static void writeIntBE3(int value, byte[] arr, int offset) Write anint3
into the given array at the given offset in big endianThis is invoked by dynamically generated code.
- Parameters:
value
- the value as a JVM intarr
- the arrayoffset
- the offset
-
writeIntBE4
static void writeIntBE4(int value, byte[] arr, int offset) Write anint4
into the given array at the given offset in big endianThis is invoked by dynamically generated code.
- Parameters:
value
- the value as a JVM intarr
- the arrayoffset
- the offset
-
writeIntLE2
static void writeIntLE2(int value, byte[] arr, int offset) Write anint2
into the given array at the given offset in litte endianThis is invoked by dynamically generated code.
- Parameters:
value
- the value as a JVM intarr
- the arrayoffset
- the offset
-
writeIntLE3
static void writeIntLE3(int value, byte[] arr, int offset) Write anint3
into the given array at the given offset in litte endianThis is invoked by dynamically generated code.
- Parameters:
value
- the value as a JVM intarr
- the arrayoffset
- the offset
-
writeIntLE4
static void writeIntLE4(int value, byte[] arr, int offset) Write anint4
into the given array at the given offset in litte endianThis is invoked by dynamically generated code.
- Parameters:
value
- the value as a JVM intarr
- the arrayoffset
- the offset
-
readLong1
static long readLong1(byte[] arr, int offset) Read anint1
from the given array at the given offset.This is invoked by dynamically generated code. While an
int1
can fit in a JVM int, this method is used when reading 1 byte of alarger int
that spans a page boundary.- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM long
-
readLongBE2
static long readLongBE2(byte[] arr, int offset) Read anint2
from the given array at the given offset in big endian.This is invoked by dynamically generated code. While an
int2
can fit in a JVM int, this method is used when reading 2 bytes of alarger int
that spans a page boundary.- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM long
-
readLongBE3
static long readLongBE3(byte[] arr, int offset) Read anint3
from the given array at the given offset in big endian.This is invoked by dynamically generated code. While an
int3
can fit in a JVM int, this method is used when reading 3 bytes of alarger int
that spans a page boundary.- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM long
-
readLongBE4
static long readLongBE4(byte[] arr, int offset) Read anint4
from the given array at the given offset in big endian.This is invoked by dynamically generated code. While an
int4
can fit in a JVM int, this method is used when reading 4 bytes of alarger int
that spans a page boundary.- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM long
-
readLongBE5
static long readLongBE5(byte[] arr, int offset) Read anint5
from the given array at the given offset in big endian.This is invoked by dynamically generated code.
- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM long
-
readLongBE6
static long readLongBE6(byte[] arr, int offset) Read anint6
from the given array at the given offset in big endian.This is invoked by dynamically generated code.
- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM long
-
readLongBE7
static long readLongBE7(byte[] arr, int offset) Read anint7
from the given array at the given offset in big endian.This is invoked by dynamically generated code.
- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM long
-
readLongBE8
static long readLongBE8(byte[] arr, int offset) Read anint8
from the given array at the given offset in big endian.This is invoked by dynamically generated code.
- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM long
-
readLongLE2
static long readLongLE2(byte[] arr, int offset) Read anint2
from the given array at the given offset in little endian.This is invoked by dynamically generated code. While an
int2
can fit in a JVM int, this method is used when reading 2 bytes of alarger int
that spans a page boundary.- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM long
-
readLongLE3
static long readLongLE3(byte[] arr, int offset) Read anint3
from the given array at the given offset in little endian.This is invoked by dynamically generated code. While an
int3
can fit in a JVM int, this method is used when reading 3 bytes of alarger int
that spans a page boundary.- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM long
-
readLongLE4
static long readLongLE4(byte[] arr, int offset) Read anint4
from the given array at the given offset in little endian.This is invoked by dynamically generated code. While an
int4
can fit in a JVM int, this method is used when reading 4 bytes of alarger int
that spans a page boundary.- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM long
-
readLongLE5
static long readLongLE5(byte[] arr, int offset) Read anint5
from the given array at the given offset in little endian.This is invoked by dynamically generated code.
- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM long
-
readLongLE6
static long readLongLE6(byte[] arr, int offset) Read anint6
from the given array at the given offset in little endian.This is invoked by dynamically generated code.
- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM long
-
readLongLE7
static long readLongLE7(byte[] arr, int offset) Read anint7
from the given array at the given offset in little endian.This is invoked by dynamically generated code.
- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM long
-
readLongLE8
static long readLongLE8(byte[] arr, int offset) Read anint8
from the given array at the given offset in little endian.This is invoked by dynamically generated code.
- Parameters:
arr
- the arrayoffset
- the offset- Returns:
- the value as a JVM long
-
writeLong1
static void writeLong1(long value, byte[] arr, int offset) Write anint1
into the given array at the given offset.This is invoked by dynamically generated code. While an
int1
can fit in a JVM int, this method is used when writing 1 byte of alarger int
that spans a page boundary.- Parameters:
value
- the value as a JVM longarr
- the arrayoffset
- the offset
-
writeLongBE2
static void writeLongBE2(long value, byte[] arr, int offset) Write anint2
into the given array at the given offset in big endian.This is invoked by dynamically generated code. While an
int2
can fit in a JVM int, this method is used when writing 2 bytes of alarger int
that spans a page boundary.- Parameters:
value
- the value as a JVM longarr
- the arrayoffset
- the offset
-
writeLongBE3
static void writeLongBE3(long value, byte[] arr, int offset) Write anint3
into the given array at the given offset in big endian.This is invoked by dynamically generated code. While an
int3
can fit in a JVM int, this method is used when writing 3 bytes of alarger int
that spans a page boundary.- Parameters:
value
- the value as a JVM longarr
- the arrayoffset
- the offset
-
writeLongBE4
static void writeLongBE4(long value, byte[] arr, int offset) Write anint4
into the given array at the given offset in big endian.This is invoked by dynamically generated code. While an
int4
can fit in a JVM int, this method is used when writing 4 bytes of alarger int
that spans a page boundary.- Parameters:
value
- the value as a JVM longarr
- the arrayoffset
- the offset
-
writeLongBE5
static void writeLongBE5(long value, byte[] arr, int offset) Write anint5
into the given array at the given offset in big endian.This is invoked by dynamically generated code.
- Parameters:
value
- the value as a JVM longarr
- the arrayoffset
- the offset
-
writeLongBE6
static void writeLongBE6(long value, byte[] arr, int offset) Write anint6
into the given array at the given offset in big endian.This is invoked by dynamically generated code.
- Parameters:
value
- the value as a JVM longarr
- the arrayoffset
- the offset
-
writeLongBE7
static void writeLongBE7(long value, byte[] arr, int offset) Write anint7
into the given array at the given offset in big endian.This is invoked by dynamically generated code.
- Parameters:
value
- the value as a JVM longarr
- the arrayoffset
- the offset
-
writeLongBE8
static void writeLongBE8(long value, byte[] arr, int offset) Write anint8
into the given array at the given offset in big endian.This is invoked by dynamically generated code.
- Parameters:
value
- the value as a JVM longarr
- the arrayoffset
- the offset
-
writeLongLE2
static void writeLongLE2(long value, byte[] arr, int offset) Write anint2
into the given array at the given offset in little endian.This is invoked by dynamically generated code. While an
int2
can fit in a JVM int, this method is used when writing 2 bytes of alarger int
that spans a page boundary.- Parameters:
value
- the value as a JVM longarr
- the arrayoffset
- the offset
-
writeLongLE3
static void writeLongLE3(long value, byte[] arr, int offset) Write anint3
into the given array at the given offset in little endian.This is invoked by dynamically generated code. While an
int3
can fit in a JVM int, this method is used when writing 3 bytes of alarger int
that spans a page boundary.- Parameters:
value
- the value as a JVM longarr
- the arrayoffset
- the offset
-
writeLongLE4
static void writeLongLE4(long value, byte[] arr, int offset) Write anint4
into the given array at the given offset in little endian.This is invoked by dynamically generated code. While an
int4
can fit in a JVM int, this method is used when writing 4 bytes of alarger int
that spans a page boundary.- Parameters:
value
- the value as a JVM longarr
- the arrayoffset
- the offset
-
writeLongLE5
static void writeLongLE5(long value, byte[] arr, int offset) Write anint5
into the given array at the given offset in little endian.This is invoked by dynamically generated code.
- Parameters:
value
- the value as a JVM longarr
- the arrayoffset
- the offset
-
writeLongLE6
static void writeLongLE6(long value, byte[] arr, int offset) Write anint6
into the given array at the given offset in little endian.This is invoked by dynamically generated code.
- Parameters:
value
- the value as a JVM longarr
- the arrayoffset
- the offset
-
writeLongLE7
static void writeLongLE7(long value, byte[] arr, int offset) Write anint7
into the given array at the given offset in little endian.This is invoked by dynamically generated code.
- Parameters:
value
- the value as a JVM longarr
- the arrayoffset
- the offset
-
writeLongLE8
static void writeLongLE8(long value, byte[] arr, int offset) Write anint8
into the given array at the given offset in little endian.This is invoked by dynamically generated code.
- Parameters:
value
- the value as a JVM longarr
- the arrayoffset
- the offset
-
conv2IntToLong
static long conv2IntToLong(int msl, int lsl) Convert two integers into a single longIn terms of the JVM stack, this simply converts the top two ints to an equivalent long. TODO: This no longer appears to be used, but may be in anticipation of multi-precision integer support.
- Parameters:
msl
- the more significant leglsl
- the less significant leg- Returns:
- the long
-
sBorrowIntRaw
static int sBorrowIntRaw(int a, int b) The implementation ofint_sborrow
on JVM ints.This actually computes all the borrow bits. To extract a specific one, the generator should emit a shift and mask.
- Parameters:
a
- the first operand as ina - b
b
- the second operand as ina - b
- Returns:
- the register of borrow bits
-
sBorrowLongRaw
static long sBorrowLongRaw(long a, long b) The implementation ofint_sborrow
on JVM longs.This actually computes all the borrow bits. To extract a specific one, the generator should emit a shift and mask.
- Parameters:
a
- the first operand as ina - b
b
- the second operand as ina - b
- Returns:
- the register of borrow bits
-
sCarryIntRaw
static int sCarryIntRaw(int a, int b) The implementation ofint_scarry
on JVM ints.This actually computes all the carry bits. To extract a specific one, the generator should emit a shift and mask.
- Parameters:
a
- the first operand as ina + b
b
- the second operand as ina + b
- Returns:
- the register of carry bits
-
sCarryLongRaw
static long sCarryLongRaw(long a, long b) The implementation ofint_scarry
on JVM longs.This actually computes all the carry bits. To extract a specific one, the generator should emit a shift and mask.
- Parameters:
a
- the first operand as ina + b
b
- the second operand as ina + b
- Returns:
- the register of carry bits
-
intLeft
static long intLeft(long val, long amt) The implementation ofint_left
on JVM longs.The semantics here are subtly different than the JVM's
ishl
: 1) The amount must be treated as unsigned. 2) Shifts in excess of val's size clear the register.- Parameters:
val
- the value as inval << amt
amt
- the amt as inval << amt
- Returns:
- the value
-
intLeft
static long intLeft(long val, int amt) The implementation ofint_left
on JVM long with int amt.The semantics here are subtly different than the JVM's
ishl
: 1) The amount must be treated as unsigned. 2) Shifts in excess of val's size clear the register.- Parameters:
val
- the value as inval << amt
amt
- the amt as inval << amt
- Returns:
- the value
-
intLeft
static int intLeft(int val, long amt) The implementation ofint_left
on JVM int with long amt.The semantics here are subtly different than the JVM's
ishl
: 1) The amount must be treated as unsigned. 2) Shifts in excess of val's size clear the register.- Parameters:
val
- the value as inval << amt
amt
- the amt as inval << amt
- Returns:
- the value
-
intLeft
static int intLeft(int val, int amt) The implementation ofint_left
on JVM ints.The semantics here are subtly different than the JVM's
ishl
: 1) The amount must be treated as unsigned. 2) Shifts in excess of val's size clear the register.- Parameters:
val
- the value as inval << amt
amt
- the amt as inval << amt
- Returns:
- the value
-
intRight
static long intRight(long val, long amt) The implementation ofint_right
on JVM longs.The semantics here are subtly different than the JVM's
iushr
: 1) The amount must be treated as unsigned. 2) Shifts in excess of val's size clear the register.- Parameters:
val
- the value as inval >> amt
amt
- the amt as inval >> amt
- Returns:
- the value
-
intRight
static long intRight(long val, int amt) The implementation ofint_right
on JVM long with int amt.The semantics here are subtly different than the JVM's
iushr
: 1) The amount must be treated as unsigned. 2) Shifts in excess of val's size clear the register.- Parameters:
val
- the value as inval >> amt
amt
- the amt as inval >> amt
- Returns:
- the value
-
intRight
static int intRight(int val, long amt) The implementation ofint_right
on JVM int with long amt.The semantics here are subtly different than the JVM's
iushr
: 1) The amount must be treated as unsigned. 2) Shifts in excess of val's size clear the register.- Parameters:
val
- the value as inval >> amt
amt
- the amt as inval >> amt
- Returns:
- the value
-
intRight
static int intRight(int val, int amt) The implementation ofint_right
on JVM ints.The semantics here are subtly different than the JVM's
iushr
: 1) The amount must be treated as unsigned. 2) Shifts in excess of val's size clear the register.- Parameters:
val
- the value as inval >> amt
amt
- the amt as inval >> amt
- Returns:
- the value
-
intSRight
static long intSRight(long val, long amt) The implementation ofint_sright
on JVM longs.The semantics here are subtly different than the JVM's
ishr
: 1) The amount must be treated as unsigned. 2) Shifts in excess of val's size fill the register with the sign bit.- Parameters:
val
- the value as inval s>> amt
amt
- the amt as inval s>> amt
- Returns:
- the value
-
intSRight
static long intSRight(long val, int amt) The implementation ofint_sright
on JVM long with int amt.The semantics here are subtly different than the JVM's
ishr
: 1) The amount must be treated as unsigned. 2) Shifts in excess of val's size fill the register with the sign bit.- Parameters:
val
- the value as inval s>> amt
amt
- the amt as inval s>> amt
- Returns:
- the value
-
intSRight
static int intSRight(int val, long amt) The implementation ofint_sright
on JVM int with long amt.The semantics here are subtly different than the JVM's
ishr
: 1) The amount must be treated as unsigned. 2) Shifts in excess of val's size fill the register with the sign bit.- Parameters:
val
- the value as inval s>> amt
amt
- the amt as inval s>> amt
- Returns:
- the value
-
intSRight
static int intSRight(int val, int amt) The implementation ofint_sright
on JVM ints.The semantics here are subtly different than the JVM's
ishr
: 1) The amount must be treated as unsigned. 2) Shifts in excess of val's size fill the register with the sign bit.- Parameters:
val
- the value as inval s>> amt
amt
- the amt as inval s>> amt
- Returns:
- the value
-
getLanguage
Get the language for the given string language IDThis is called by generated static initializers.
- Parameters:
languageID
- the language ID- Returns:
- the language
- Throws:
LanguageNotFoundException
- if the language is not found
-
createContext
Construct a contextreg value from the given language and hex valueThis is called by generated static initializers to pre-construct context values.
- Parameters:
language
- the languagevalue
- the value as a string of hexadecimal digits- Returns:
- the value
-
createVarnode
Construct a varnodeThis is called by generated static initializers to pre-construct any varnodes it needs to re-create, mostly for invoking userops with the Standard strategy.
- Parameters:
factory
- the language's address factoryspace
- the name of the spaceoffset
- the byte offsetsize
- the size (in bytes)- Returns:
- the varnode
-
thread
JitPcodeThread thread()Get this instance's bound thread.The generator implements a standard getter. This is frequently used by other default methods of this interface, which are in turn invoked by generated code.
- Returns:
- the thread
-
retireCounterAndContext
Set the bound thread's program counter and decode context.This is called during retirement, i.e., upon exiting a passage or entering a hazard. This just converts things to the right type and invokes
PcodeThread.overrideCounter(Address)
andPcodeThread.overrideContext(RegisterValue)
.- Parameters:
counter
- the offset of the next instruction to executecontext
- the decode context for the next instruction
-
getUseropDefinition
Retrieve a userop definition from the bound thread.This is invoked by generated constructors to retain a userop reference for later invocation. Note that it is the userop as defined by the user or emulator, not any wrapper used during decode or translation. Depending on the invocation strategy, this reference may be saved and later used with
invokeUserop(PcodeUseropDefinition, Varnode, Varnode[])
, or its method and instance may be extracted and saved for Direct invocation later.- Parameters:
name
- the name of the userop- Returns:
- the userop or
null
- See Also:
-
invokeUserop
default void invokeUserop(PcodeUseropLibrary.PcodeUseropDefinition<byte[]> userop, Varnode output, Varnode[] inputs) Invoke the given userop on the bound thread with the given operandsThis is invoked by generated code in
run(int)
to invoke a userop via the Standard strategy.- Parameters:
userop
- the userop definitionoutput
- an optional output operandinputs
- the input operands- See Also:
-
createDecodeError
Construct an exception when attempting to execute an "instruction" that could not be decoded.When the decoder encounters an error, instead of crashing immediately, it must consider that execution may not actually reach the error, so it instead emits pseudo-instructions describing the error. The translator then emits code that will invoke this method and throw the result. Thus, we only crash if the erroneous condition is actually met.
- Parameters:
message
- the human-readable messagecounter
- the program counter where the decode error was encountered- Returns:
- the exception, which should be thrown immediately
-
createExitSlot
Construct an exit slot for the given branch targetThis is invoked by generated constructors for each branch target that exits the passage. Each is saved as a field and will be filled lazily with its chained entry point the first time the branch is taken.
- Parameters:
target
- the target program counterctx
- the target decode context- Returns:
- the exit slot
-
getChained
Get the chained entry point for the given exit point's targetThis is invoked by generated code in
run(int)
to take a branch exiting the passage. The first time, the exit slot is lazily filled, possibly requiring further JIT translation.- Parameters:
slot
- the slot for the target of the branch we're taking- Returns:
- the chained entry point
-
count
default void count(int instructions, int trailingOps) InvokeJitPcodeThread.count(int, int)
for the bound thread- Parameters:
instructions
- as inJitPcodeThread.count(int, int)
trailingOps
- as inJitPcodeThread.count(int, int)
-