Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
SquirrelJME
Commits
a683a499
Commit
a683a499
authored
Mar 31, 2017
by
Stephanie Gawroriski
Browse files
Handle writing of return value.
parent
e6484e19
Changes
3
Hide whitespace changes
Inline
Side-by-side
libs/squirreljme-jit/net/multiphasicapps/squirreljme/jit/ArgumentAllocation.java
View file @
a683a499
...
...
@@ -13,6 +13,8 @@ package net.multiphasicapps.squirreljme.jit;
import
java.lang.ref.Reference
;
import
java.lang.ref.WeakReference
;
import
java.util.Arrays
;
import
java.util.List
;
import
net.multiphasicapps.util.unmodifiable.UnmodifiableList
;
/**
* This is used to store the information such as which registers and the stack
...
...
@@ -35,6 +37,9 @@ public final class ArgumentAllocation
/** String representation. */
private
volatile
Reference
<
String
>
_string
;
/** List of registers. */
private
volatile
Reference
<
List
<
Register
>>
_lregs
;
/**
* Initializes the argument allocation with the specified registers.
*
...
...
@@ -185,6 +190,26 @@ public final class ArgumentAllocation
return
(
registers
==
null
?
0
:
registers
.
length
);
}
/**
* Returns the list of registers that are available for usage.
*
* @return The list of registers, this list is not modifiable.
* @since 2017/03/31
*/
public
List
<
Register
>
registerList
()
{
Reference
<
List
<
Register
>>
ref
=
this
.
_lregs
;
List
<
Register
>
rv
;
// Cache?
if
(
ref
==
null
||
null
==
(
rv
=
ref
.
get
()))
this
.
_lregs
=
new
WeakReference
<>((
rv
=
UnmodifiableList
.<
Register
>
of
(
Arrays
.<
Register
>
asList
(
this
.
_registers
))));
return
rv
;
}
/**
* Returns all of the allocated registers.
*
...
...
libs/squirreljme-jit/net/multiphasicapps/squirreljme/jit/CacheState.java
View file @
a683a499
...
...
@@ -236,6 +236,17 @@ public abstract class CacheState
new
Register
[
registers
.
size
()]));
}
/**
* Are registers used in this slot?
*
* @return {@code true} if registers are used in the slot.
* @since 2017/03/31
*/
public
final
boolean
thisHasRegisters
()
{
return
!
thisRegisters
().
isEmpty
();
}
/**
* Returns the registers using the given type.
*
...
...
@@ -315,6 +326,17 @@ public abstract class CacheState
return
value
().
thisAllocation
(
__a
);
}
/**
* Are registers used in the value?
*
* @return {@code true} if registers are used in the value.
* @since 2017/03/31
*/
public
final
boolean
valueHasRegisters
()
{
return
value
().
thisHasRegisters
();
}
/**
* Returns the value index of this slot.
*
...
...
libs/squirreljme-jit/net/multiphasicapps/squirreljme/jit/__JITCodeStream__.java
View file @
a683a499
...
...
@@ -455,7 +455,15 @@ class __JITCodeStream__
// If a return value is used then handle moving it
if
(
__rv
!=
null
)
{
throw
new
todo
.
TODO
();
// Return to registers
DataType
rt
=
rvalloc
.
type
();
List
<
Register
>
rl
=
rvalloc
.
registerList
();
if
(
rv
.
thisHasRegisters
())
engine
.
moveRegister
(
rt
,
rl
,
rv
.
thisRegisters
());
// Return to stack
else
engine
.
storeRegister
(
rt
,
rl
,
rv
.
thisStackOffset
(),
fp
);
}
// Because the values are stack cached they do not need to be read from
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment