Sitelet https://github.com/jruby/jruby/pull/6422/files
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
ab2ccf6
WIP: first demo of 0-arg ctor callable from java getClass().newInstan…
byteit101 Oct 2, 2020
fa00023
WIP: Moving Concrete extension code into Reification code to add ctor…
byteit101 Oct 22, 2020
5c04320
More WIP constructor code. Multi-constructors should function, and no…
byteit101 Oct 24, 2020
2998f72
Remove test class reference
byteit101 Oct 24, 2020
4c61162
Reasonable multi-signature support (codegen, helpers missing) and hor…
byteit101 Nov 1, 2020
d1f30e0
Refactorings & actually detect which ctor to call. Also supports supe…
byteit101 Nov 12, 2020
9cd6bb3
Merge branch 'master' of https://github.com/jruby/jruby into wip_newi…
byteit101 Nov 12, 2020
99239f0
Update hack to use most recent api
byteit101 Nov 12, 2020
5f9b618
Make more tests work and be less verbose
byteit101 Nov 12, 2020
996197f
Minor cleanups of type safety and move AST transform to new file
byteit101 Nov 15, 2020
c0995d5
missed a file
byteit101 Nov 15, 2020
89f90db
General cleanup, fixes, and flailing around trying to get the scope w…
byteit101 Nov 15, 2020
be1653a
Add support for split allocate+initialize and arbitrary ruby argument…
byteit101 Nov 17, 2020
ef43757
Working scoping for most code. Missing some elements still
byteit101 Nov 17, 2020
eb1ecdb
Start fixing some easy test failures
byteit101 Nov 18, 2020
cfcc2fd
Several test fixes
byteit101 Nov 18, 2020
3b181d8
Update for import/style consistency
enebo Nov 25, 2020
913736c
Super bridges, partial work on ruby<ruby<java heirarchy, other assort…
byteit101 Nov 25, 2020
cf4adfe
Move some gen code into split/finish Init pair
byteit101 Nov 25, 2020
e0d2ddb
Down to 1+4+ant failures
byteit101 Nov 27, 2020
52dd70f
Very questionable implementation of ruby < ruby < java hierarchy
byteit101 Nov 27, 2020
7859cd5
Method overrides on the java side
byteit101 Nov 27, 2020
7f2058c
Class#clone should copy local reify state
byteit101 Nov 27, 2020
08ae7dd
Add WIP unconnected interpreter which will allow stopping and continuing
enebo Nov 30, 2020
1322977
Filled out to the point I believe RubyClass can ask for the interpreter
enebo Nov 30, 2020
3311fa0
Add depth logic to IR super splitting.
enebo Dec 1, 2020
5fe86f0
Revert "Update for import/style consistency"
byteit101 Dec 3, 2020
945f66e
Merge branch 'enebo_newinstance' into wip_newinstance
byteit101 Dec 3, 2020
1519da7
Assign superCall when found
byteit101 Dec 3, 2020
5e8c211
Tie in new IR work
byteit101 Dec 3, 2020
90fb7cf
Add proper scopes to fix errors, and guesses at frames.
byteit101 Dec 4, 2020
8d6d424
proper zsuper support from @enebo
byteit101 Dec 6, 2020
d2fb097
Reorganize and clean up split invocations; add support for custom names
byteit101 Dec 6, 2020
8fa6ba1
All are compileable, for some reason
byteit101 Dec 6, 2020
73b6e89
Cleanup and bug fixes
byteit101 Dec 9, 2020
5bddf82
More tests and fixes for nested classes
byteit101 Dec 12, 2020
abb05c1
Merge branch 'master' of https://github.com/jruby/jruby into wip_newi…
byteit101 Dec 12, 2020
53d7eff
Fix merge issues & add new test
byteit101 Dec 12, 2020
d27fab3
module support, split new support, nicer ruby api
byteit101 Dec 12, 2020
39adc70
More tests & updated configure
byteit101 Dec 12, 2020
ce66437
Lots of cleanup and refactoring
byteit101 Feb 15, 2021
9ae5915
Merge remote-tracking branch 'origin/master' into wip_newinstance
byteit101 Feb 17, 2021
e51ce30
Formatting, cleanup, licence blocks
byteit101 Feb 21, 2021
091c868
More cleanup
byteit101 Feb 23, 2021
18dfe11
(non-working) test for interface default super
byteit101 Feb 23, 2021
5860ce9
Mark failing tests, fix 1 test, add 1 test for negative super looping…
byteit101 Mar 5, 2021
da2bc4e
Missed update for prior commit
byteit101 Mar 6, 2021
67f03ae
Merge master and update to Signature
byteit101 Mar 6, 2021
300005f
Refactor RCG to pass index and converted args from splitInit
byteit101 Mar 6, 2021
2eed247
Re-reify if we are an unreified child
byteit101 Mar 6, 2021
d68357e
Don't hide static int exceptions?
byteit101 Mar 6, 2021
03b5554
Only the last half of java integration is pending
byteit101 Mar 6, 2021
b12e5a6
Merge remote-tracking branch 'origin/master' into wip_newinstance
byteit101 May 13, 2021
a5b1b8d
This PR still needs a public ctor
byteit101 May 14, 2021
dc3f34f
Doc & remove puts in class configurator
byteit101 May 17, 2021
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
11 changes: 0 additions & 11 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
import org.jruby.ir.persistence.IRReader;
import org.jruby.ir.persistence.IRReaderStream;
import org.jruby.ir.persistence.util.IRFileExpert;
import org.jruby.javasupport.proxy.JavaProxyClassFactory;
import org.jruby.management.BeanManager;
import org.jruby.management.BeanManagerFactory;
import org.jruby.management.Config;
Expand Down Expand Up @@ -2986,14 +2985,6 @@ public Map<String, Map<String, String>> getBoundMethods() {
return boundMethods;
}

public void setJavaProxyClassFactory(JavaProxyClassFactory factory) {
this.javaProxyClassFactory = factory;
}

public JavaProxyClassFactory getJavaProxyClassFactory() {
return javaProxyClassFactory;
}

private static final EnumSet<RubyEvent> interest =
EnumSet.of(
RubyEvent.C_CALL,
Expand Down Expand Up @@ -5622,8 +5613,6 @@ public void warn(String message) {

private FFI ffi;

private JavaProxyClassFactory javaProxyClassFactory;

/** Used to find the ProfilingService implementation to use. If profiling is disabled it's null */
private final ProfilingServiceLookup profilingServiceLookup;

Expand Down
1,071 changes: 812 additions & 259 deletions core/src/main/java/org/jruby/RubyClass.java

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions core/src/main/java/org/jruby/RubyModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -1812,6 +1812,25 @@ public CacheEntry searchMethodEntryInner(String id) {
return null;
}

/**
* Searches for a method up until the superclass, but include modules. This is
* for Concrete java ctor initialization
* TODO: add a cache?
*/
public DynamicMethod searchMethodLateral(String id) {
// int token = generation;
// This flattens some of the recursion that would be otherwise be necessary.
// Used to recurse up the class hierarchy which got messy with prepend.
for (RubyModule module = this; module != null && (module == this || (module instanceof IncludedModuleWrapper)); module = module.getSuperClass()) {
// Only recurs if module is an IncludedModuleWrapper.
// This way only the recursion needs to be handled differently on
// IncludedModuleWrapper.
DynamicMethod method = module.searchMethodCommon(id);
if (method != null) return method.isNull() ? null : method;
}
return null;
}

// MRI: resolve_refined_method
public CacheEntry resolveRefinedMethod(Map<RubyModule, RubyModule> refinements, CacheEntry entry, String id, boolean cacheUndef) {
if (entry != null && entry.method.isRefined()) {
Expand Down Expand Up @@ -2482,6 +2501,8 @@ public IRubyObject initialize_copy(IRubyObject original) {
syncConstants(originalModule);

originalModule.cloneMethods(this);

this.javaProxy = originalModule.javaProxy;

return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,19 @@ public final class SkinnyMethodAdapter extends MethodVisitor {
private final ClassVisitor cv;
private final Label start;
private final Label end;
private final String signature;

private MethodVisitor method;
private Printer printer;

public SkinnyMethodAdapter(ClassVisitor cv, int flags, String name, String signature, String something, String[] exceptions) {
public SkinnyMethodAdapter(ClassVisitor cv, int flags, String name, String signature, String genericTypeInformation, String[] exceptions) {
super(ASM4);
setMethodVisitor(cv.visitMethod(flags, name, signature, something, exceptions));
setMethodVisitor(cv.visitMethod(flags, name, signature, genericTypeInformation, exceptions));
this.cv = cv;
this.name = name;
this.start = new Label();
this.end = new Label();
this.signature = signature;
}

public ClassVisitor getClassVisitor() {
Expand All @@ -102,6 +104,10 @@ public void setMethodVisitor(MethodVisitor mv) {
this.method = mv;
}
}

public String getSignature() {
return signature;
}

/**
* Short-hand for specifying a set of aloads
Expand Down
14 changes: 7 additions & 7 deletions core/src/main/java/org/jruby/ext/ffi/ReifyingAllocator.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import java.lang.reflect.InvocationTargetException;

class ReifyingAllocator implements ObjectAllocator {
private final Class klass;
private final Constructor cons;
private final Class<? extends IRubyObject> klass;
private final Constructor<? extends IRubyObject> cons;

public ReifyingAllocator(Class klass) {
public ReifyingAllocator(Class<? extends IRubyObject> klass) {
this.klass = klass;
try {
this.cons = klass.getDeclaredConstructor(Ruby.class, RubyClass.class);
Expand All @@ -24,8 +24,8 @@ public ReifyingAllocator(Class klass) {

public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
try {
if (klazz.getReifiedClass() == this.klass) {
return (IRubyObject) cons.newInstance(runtime, klazz);
if (klazz.getReifiedRubyClass() == this.klass) {
return cons.newInstance(runtime, klazz);
}

reifyWithAncestors(klazz);
Expand All @@ -44,10 +44,10 @@ private static void reifyWithAncestors(RubyClass klazz) {

RubyClass realSuper = klazz.getSuperClass().getRealClass();

if (realSuper.getReifiedClass() == null) reifyWithAncestors(realSuper);
if (realSuper.getReifiedRubyClass() == null) reifyWithAncestors(realSuper);
synchronized (klazz) {
klazz.reify();
klazz.setAllocator(new ReifyingAllocator(klazz.getReifiedClass()));
klazz.setAllocator(new ReifyingAllocator(klazz.getReifiedRubyClass()));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
/***** BEGIN LICENSE BLOCK *****
* Version: EPL 2.0/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Eclipse Public
* License Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.eclipse.org/legal/epl-v20.html
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the EPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the EPL, the GPL or the LGPL.
***** END LICENSE BLOCK *****/

package org.jruby.internal.runtime;

import java.util.Collection;

import org.jruby.Ruby;
import org.jruby.RubyModule;
import org.jruby.compiler.Compilable;
Expand All @@ -13,15 +41,15 @@
import org.jruby.parser.StaticScope;
import org.jruby.runtime.ArgumentDescriptor;
import org.jruby.runtime.Arity;
import org.jruby.runtime.Block;
import org.jruby.runtime.PositionAware;
import org.jruby.runtime.Signature;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.Visibility;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.ivars.MethodData;
import org.jruby.util.cli.Options;

import java.util.Collection;

public abstract class AbstractIRMethod extends DynamicMethod implements IRMethodArgs, PositionAware, Cloneable {

protected final Signature signature;
Expand Down Expand Up @@ -175,4 +203,12 @@ public boolean needsToFindImplementer() {
// FIXME: This may stop working if we eliminate startup interp
return !(irScope instanceof IRMethod && !irScope.getInterpreterContext().getFlags().contains(IRFlags.REQUIRES_CLASS));
}
/**
* Calls a split method (java constructor-invoked initialize) and returns the paused state. If
* this method doesn't have a super call, returns null without execution.
*/
public abstract SplitSuperState startSplitSuperCall(ThreadContext context, IRubyObject self, RubyModule klazz,
String name, IRubyObject[] args, Block block);

public abstract void finishSplitCall(SplitSuperState state);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/***** BEGIN LICENSE BLOCK *****
* Version: EPL 2.0/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Eclipse Public
* License Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.eclipse.org/legal/epl-v20.html
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the EPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the EPL, the GPL or the LGPL.
***** END LICENSE BLOCK *****/

package org.jruby.internal.runtime;

public interface InternalSplitState {

}
43 changes: 43 additions & 0 deletions core/src/main/java/org/jruby/internal/runtime/SplitSuperState.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/***** BEGIN LICENSE BLOCK *****
* Version: EPL 2.0/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Eclipse Public
* License Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.eclipse.org/legal/epl-v20.html
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the EPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the EPL, the GPL or the LGPL.
***** END LICENSE BLOCK *****/

package org.jruby.internal.runtime;

import org.jruby.RubyArray;
import org.jruby.internal.runtime.methods.ExitableReturn;
import org.jruby.runtime.Block;

public class SplitSuperState<T extends InternalSplitState> {
public final RubyArray<?> callArrayArgs;
public final Block callBlockArgs;
public final T state;

public SplitSuperState(ExitableReturn result, T state) {
callArrayArgs = result.getArguments();
callBlockArgs = result.getBlock();
this.state = state;
}
}
Loading