Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
prdoyle committed Dec 24, 2023
1 parent 7991d7e commit 4e057d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
18 changes: 5 additions & 13 deletions bosk-core/src/main/java/io/vena/bosk/bytecode/ClassBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
Expand Down Expand Up @@ -65,8 +63,6 @@ public final class ClassBuilder<T> {
private ClassWriter classWriter = null;
private MethodBuilder currentMethod = null;

private final List<CurriedValue> curriedValues = new ArrayList<>();

/**
* @param className The simple name of the generated class;
* the actual name will be given the prefix <code>GENERATED_</code> to identify it as not corresponding to any source file
Expand Down Expand Up @@ -183,17 +179,13 @@ public LocalVariable popToLocal(Type type) {
* Emit code to push the given object on the operand stack.
*
* @param name purely descriptive; doesn't need to be unique
* @param type
* @param type the static type of the value (because the dynamic type might not
* be accessible from the generated class)
*/
public void pushObject(String name, Object object, Class<?> type) {
type.cast(object);

String fullName = "CallSite_" + CALL_SITE_COUNT.incrementAndGet() + "_" + name;
CurriedValue result = new CurriedValue(
fullName,
Type.getDescriptor(type),
object);
curriedValues.add(result);

CALL_SITES_BY_NAME.put(fullName, new ConstantCallSite(MethodHandles.constant(type, object)));
LOGGER.warn("{} = {} {}", fullName, type.getSimpleName(), object);
Expand All @@ -208,8 +200,8 @@ public void pushObject(String name, Object object, Class<?> type) {
));
*/
methodVisitor().visitInvokeDynamicInsn(
result.name(),
"()" + result.typeDescriptor(),
fullName,
"()" + Type.getDescriptor(type),
CONSTANT_CALL_SITE
);
}
Expand Down Expand Up @@ -392,7 +384,7 @@ public Class<?> loadThemBytes(String dottyName, byte[] b) {
private static final AtomicLong CALL_SITE_COUNT = new AtomicLong(0);
private static final Map<String, CallSite> CALL_SITES_BY_NAME = new ConcurrentHashMap<>();

public static CallSite constantCallSite(MethodHandles.Lookup lookup, String name, MethodType methodType) {
public static CallSite constantCallSite(MethodHandles.Lookup __, String name, MethodType ___) {
LOGGER.warn("constantCallSite({})", name);
return CALL_SITES_BY_NAME.remove(name);
}
Expand Down
10 changes: 0 additions & 10 deletions bosk-core/src/main/java/io/vena/bosk/bytecode/CurriedValue.java

This file was deleted.

0 comments on commit 4e057d1

Please sign in to comment.