Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6b7f3f6ca663
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6ec2c819442d
Choose a head ref
  • 2 commits
  • 11 files changed
  • 1 contributor

Commits on Jun 22, 2015

  1. Copy the full SHA
    06c77ea View commit details
  2. Copy the full SHA
    6ec2c81 View commit details
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/env/shift_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/core/env/size_tags.txt

This file was deleted.

6 changes: 0 additions & 6 deletions spec/truffle/tags/core/env/store_tags.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
fails:ENV.store deletes the environment variable when the value is nil
fails:ENV.store coerces the key argument with #to_str
fails:ENV.store coerces the value argument with #to_str
fails:ENV.store raises TypeError when the key is not coercible to String
fails:ENV.store raises TypeError when the value is not coercible to String
fails:ENV.store raises Errno::EINVAL when the key contains the '=' character
fails:ENV.store raises Errno::EINVAL when the key is an empty string
fails:ENV.store does nothing when the key is not a valid environment variable key and the value is nil
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/env/to_a_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/core/env/to_h_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/env/to_hash_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/core/env/to_s_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/env/values_at_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/env/values_tags.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/

package org.jruby.truffle.nodes.core;


import org.jruby.truffle.nodes.rubinius.PointerNodes;
import org.jruby.truffle.runtime.core.RubyBasicObject;

public class PointerGuards {

public static boolean isNullPointer(RubyBasicObject pointer) {
return PointerNodes.getPointer(pointer) == PointerNodes.NULL_POINTER;
}

}

Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
import com.oracle.truffle.api.object.*;
import com.oracle.truffle.api.source.SourceSection;
import jnr.ffi.Pointer;
import org.jruby.truffle.nodes.core.PointerGuards;
import org.jruby.truffle.nodes.core.StringNodes;
import org.jruby.truffle.nodes.objects.Allocator;
import org.jruby.truffle.runtime.RubyContext;
@@ -298,13 +299,19 @@ public RubyBasicObject address(RubyBasicObject pointer, RubyString string, int m
}

@RubiniusPrimitive(name = "pointer_read_string_to_null")
@ImportStatic(PointerGuards.class)
public static abstract class PointerReadStringToNullPrimitiveNode extends RubiniusPrimitiveNode {

public PointerReadStringToNullPrimitiveNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@Specialization
@Specialization(guards = "isNullPointer(pointer)")
public RubyBasicObject readNullPointer(RubyBasicObject pointer) {
return StringNodes.createEmptyString(getContext().getCoreLibrary().getStringClass());
}

@Specialization(guards = "!isNullPointer(pointer)")
public RubyBasicObject readStringToNull(RubyBasicObject pointer) {
return createString(MemoryIO.getInstance().getZeroTerminatedByteArray(PointerNodes.getPointer(pointer).address()));
}