Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up add ref candidates API. Add sysGetBooleanOption(). #12

Merged
merged 2 commits into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MMTk/src/org/mmtk/utility/options/NoReferenceTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public final class NoReferenceTypes extends org.vmutil.options.BooleanOption {
public NoReferenceTypes() {
super(Options.set, "No Reference Types",
"Should reference type processing be disabled?",
true);
false);
}
}
11 changes: 4 additions & 7 deletions rvm/src/org/jikesrvm/mm/mminterface/MemoryManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public static void postBoot() {
VM.sysFail("postBoot() unimplemented");
} else {
Selected.Plan.get().processOptions();
if (Options.noReferenceTypes.getValue()) {
if (Options.noReferenceTypes.getValue() || (VM.BuildWithRustMMTk && sysCall.sysGetBooleanOption(Options.noReferenceTypes.getKey().getBytes()))) {
RVMType.JavaLangRefReferenceReferenceField.makeTraced();
}

Expand Down Expand Up @@ -1176,8 +1176,7 @@ public static Object getFinalizedObject() {
@Interruptible
public static void addSoftReference(SoftReference<?> obj, Object referent) {
if (VM.BuildWithRustMMTk) {
sysCall.add_soft_candidate(Magic.objectAsAddress(obj),
Magic.objectAsAddress(referent));
sysCall.sysAddSoftCandidate(obj, ObjectReference.fromObject(referent));
} else {
ReferenceProcessor.addSoftCandidate(obj, ObjectReference.fromObject(referent));
}
Expand All @@ -1192,8 +1191,7 @@ public static void addSoftReference(SoftReference<?> obj, Object referent) {
@Interruptible
public static void addWeakReference(WeakReference<?> obj, Object referent) {
if (VM.BuildWithRustMMTk) {
sysCall.add_weak_candidate(Magic.objectAsAddress(obj),
Magic.objectAsAddress(referent));
sysCall.sysAddWeakCandidate(obj, ObjectReference.fromObject(referent));
} else {
ReferenceProcessor.addWeakCandidate(obj, ObjectReference.fromObject(referent));
}
Expand All @@ -1208,8 +1206,7 @@ public static void addWeakReference(WeakReference<?> obj, Object referent) {
@Interruptible
public static void addPhantomReference(PhantomReference<?> obj, Object referent) {
if (VM.BuildWithRustMMTk) {
sysCall.add_phantom_candidate(Magic.objectAsAddress(obj),
Magic.objectAsAddress(referent));
sysCall.sysAddPhantomCandidate(obj, ObjectReference.fromObject(referent));
} else {
ReferenceProcessor.addPhantomCandidate(obj, ObjectReference.fromObject(referent));
}
Expand Down
10 changes: 0 additions & 10 deletions rvm/src/org/jikesrvm/options/OptionSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,6 @@ public boolean process(String arg) {
byte[] valueBytes = stringToBytes("converting value", value);

if (VM.BuildWithRustMMTk) {
if (name.equals("noReferenceTypes")) {
Option o = getOption(name);
if (o != null) {
if (value.equals("true")) {
((BooleanOption) o).setValue(true);
} else if (value.equals("false")) {
((BooleanOption) o).setValue(false);
}
}
}
if (SysCall.sysCall.sysProcess(nameBytes, valueBytes)) {
return true;
}
Expand Down
1 change: 1 addition & 0 deletions rvm/src/org/jikesrvm/runtime/BootRecord.java
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ public void setHeapRange(int id, Address start, Address end) {
public Address add_weak_candidateRIP;
public Address add_soft_candidateRIP;
public Address add_phantom_candidateRIP;
public Address get_boolean_optionRIP;
public Address jikesrvm_handle_user_collection_requestRIP;
public Address harness_beginRIP;
public Address harness_endRIP;
Expand Down
29 changes: 26 additions & 3 deletions rvm/src/org/jikesrvm/runtime/SysCall.java
Original file line number Diff line number Diff line change
Expand Up @@ -371,17 +371,40 @@ public boolean sysIsMappedAddress(Address address) {
@SysCallAlignedTemplate
public abstract boolean is_mapped_address(Address address);

@Inline
public void sysAddWeakCandidate(Object ref, ObjectReference referent) {
add_weak_candidate(ObjectReference.fromObject(ref), referent);
}

@RustSysCall
@SysCallAlignedTemplate
public abstract void add_weak_candidate(ObjectReference ref, ObjectReference referent);

@Inline
public void sysAddSoftCandidate(Object ref, ObjectReference referent) {
add_soft_candidate(ObjectReference.fromObject(ref), referent);
}

@RustSysCall
@SysCallAlignedTemplate
public abstract void add_weak_candidate(Address ref, Address referent);
public abstract void add_soft_candidate(ObjectReference ref, ObjectReference referent);

@Inline
public void sysAddPhantomCandidate(Object ref, ObjectReference referent) {
add_phantom_candidate(ObjectReference.fromObject(ref), referent);
}

@RustSysCall
@SysCallAlignedTemplate
public abstract void add_soft_candidate(Address ref, Address referent);
public abstract void add_phantom_candidate(ObjectReference ref, ObjectReference referent);

@Inline
public boolean sysGetBooleanOption(byte[] option) {
return get_boolean_option(option);
}
@RustSysCall
@SysCallAlignedTemplate
public abstract void add_phantom_candidate(Address ref, Address referent);
public abstract boolean get_boolean_option(byte[] option);

@Inline
public void sysAddFinalizer(Object object) {
Expand Down
1 change: 1 addition & 0 deletions tools/bootloader/sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ EXTERNAL void* last_heap_address();
EXTERNAL void add_weak_candidate(void* ref, void* referent);
EXTERNAL void add_soft_candidate(void* ref, void* referent);
EXTERNAL void add_phantom_candidate(void* ref, void* referent);
EXTERNAL bool get_boolean_option(char* option);
EXTERNAL void harness_begin(void *tls);
EXTERNAL void harness_end();
EXTERNAL void release_buffer(void* buffer);
Expand Down