Shaping C-like structs into memory segments – Foreign (Function) Memory API

146. Shaping C-like structs into memory segments Let’s consider the C-like struct from the following figure: Figure 7.12 – A C-like structure So, in Figure 7.12, we have a C-like ... Read MoreRead More

0 Comments

Allocating arrays into memory segments – Foreign (Function) Memory API

143. Allocating arrays into memory segments Now that we know how to create memory segments for storing single values let’s make a step further and let’s try to store an ... Read MoreRead More

0 Comments

Understanding addresses (pointers) – Foreign (Function) Memory API

144. Understanding addresses (pointers) A memory segment has a memory address (pointer) expressed as a long number. An off-heap memory segment has a physical address that points out the memory ... Read MoreRead More

0 Comments

Introducing sequence layout 2 – Foreign (Function) Memory API

Putting PathElement and VarHandle togheter The path elements (layout path) are arguments of the MemoryLayout.varHandle() method which is capable to return a VarHandle that can be used to access a ... Read MoreRead More

0 Comments

Introducing sequence layout – Foreign (Function) Memory API

145. Introducing sequence layout In Problem X, we already covered the ValueLayout for basic data types. Next, let’s talk about the sequence layout (java.lang.foreign.SequenceLayout).But, before introducing the sequence layout, let’s ... Read MoreRead More

0 Comments

Shaping C-like unions into memory segments – Foreign (Function) Memory API

147. Shaping C-like unions into memory segments Let’s consider the C-like union from the following figure (the members of a C union share the same memory location (the member’s largest ... Read MoreRead More

0 Comments

Introducing PaddingLayout 2 – Foreign (Function) Memory API

Hooking size, alignment, stride, and padding Before continuing working with padding, we need to cover some notions which are closely related to each other and work hand in hand with ... Read MoreRead More

0 Comments

Introducing PaddingLayout – Foreign (Function) Memory API

148. Introducing PaddingLayout Data types are typically characterized by several properties: size, alignment, stride, padding, and order of bytes.Padding layout (java.lang.foreign.PaddingLayout) allows us to specify the padding. In other words, ... Read MoreRead More

0 Comments

Introducing slice handle – Foreign (Function) Memory API

151. Introducing slice handle Let’s suppose that we have the following nested model (10 sequences of 5 double values each): SequenceLayout innerSeq  = MemoryLayout.sequenceLayout(5, ValueLayout.JAVA_DOUBLE);SequenceLayout outerSeq  = MemoryLayout.sequenceLayout(10, innerSeq); Next, ... Read MoreRead More

0 Comments

Introducing layout reshaping – Foreign (Function) Memory API

153. Introducing layout reshaping Let’s suppose that we have the following nested model (the exact same model as in Problem 151): SequenceLayout innerSeq  = MemoryLayout.sequenceLayout(5, ValueLayout.JAVA_DOUBLE);SequenceLayout outerSeq  = MemoryLayout.sequenceLayout(10, innerSeq); ... Read MoreRead More

0 Comments