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

Check target array length before allocating #4159

Merged
merged 5 commits into from
Dec 8, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
run prePR command.
counter2015 committed Oct 31, 2024
commit 57b496a6d9a40fd9e0d746a5d592d7a4f5708b3a
Original file line number Diff line number Diff line change
@@ -17,7 +17,8 @@
package cats.effect.benchmarks

import cats.effect.ArrayStack
import org.openjdk.jmh.annotations.*

import org.openjdk.jmh.annotations._

import java.util.concurrent.TimeUnit

3 changes: 2 additions & 1 deletion core/jvm-native/src/main/scala/cats/effect/ArrayStack.scala
Original file line number Diff line number Diff line change
@@ -16,9 +16,10 @@

package cats.effect

import Platform.static
import PlatformStatics.VM_MaxArraySize

import Platform.static

private[effect] final class ArrayStack[A <: AnyRef](
private[this] var buffer: Array[AnyRef],
private[this] var index: Int) {
Original file line number Diff line number Diff line change
@@ -20,8 +20,7 @@ import scala.annotation.tailrec

import java.util.concurrent.atomic.{AtomicBoolean, AtomicReference}

import CallbackStack.Handle
import CallbackStack.Node
import CallbackStack.{Handle, Node}
import Platform.static

private final class CallbackStack[A](private[this] var callback: A => Unit)
3 changes: 2 additions & 1 deletion core/shared/src/main/scala/cats/effect/IO.scala
Original file line number Diff line number Diff line change
@@ -36,7 +36,6 @@ import cats.{
StackSafeMonad,
Traverse
}
import cats.data.Ior
import cats.effect.instances.spawn
import cats.effect.kernel.CancelScope
import cats.effect.kernel.GenTemporal.handleDuration
@@ -57,6 +56,8 @@ import java.util.concurrent.Executor

import Platform.static

import cats.data.Ior

/**
* A pure abstraction representing the intention to perform a side effect, where the result of
* that side effect may be obtained synchronously (via return) or asynchronously (via callback).