Java Memory Emulation for C Program Compatibility

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing technologies face challenges in emulating C memory management in Java, leading to compatibility issues, inefficient resource usage, and difficulty in maintaining and adapting Java programs that mimic C programs, especially when dealing with complex data structures and cross-platform compatibility.

Innovation Solution

A Java program emulates C memory management by using Java byte arrays and ByteBuffer objects to simulate memory areas and data structures, ensuring binary compatibility and efficient resource usage, while maintaining readability and adaptability through well-defined Java objects and bit operations.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If C code is used with direct memory access, then memory management flexibility is improved, but portability across operating systems deteriorates

Engineering Contradiction:
Improvememory management flexibilityVSAvoidportability
Core Design Contradiction:
Adaptability or versatilityVSEase of manufacture

Solution Approach 1:

The patent introduces a Java layer as an intermediary that emulates C memory management behavior. The Java program uses byte arrays and custom memory management classes to replicate malloc/free semantics, allowing the high-level Java code to maintain portability while the emulation layer provides C-like memory control flexibility.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent creates a copy of C memory management behavior within Java. By implementing custom classes that replicate C pointer semantics, memory allocation functions, and data structure layouts, the system preserves C program behavior while running on the Java platform with inherent portability.

Inventive Principle:
Principle #26Copying

2Reliability

If C DLL/Shared Object is used, then binary compatibility with C programs is improved, but deployment flexibility deteriorates

Engineering Contradiction:
Improvebinary compatibilityVSAvoiddeployment flexibility
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

The patent replaces the mechanical system of native C DLLs with a Java-based emulation system. Instead of loading platform-specific binary modules, the solution uses pure Java code that emulates C memory management, allowing deployment as standalone Java EE EAR files on any Java-compatible application server without platform-specific compilation.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

3Ease of operation

If Java Native Interface is used, then access to C code is improved, but platform compatibility deteriorates

Engineering Contradiction:
Improveaccess to C codeVSAvoidplatform compatibility
Core Design Contradiction:
Ease of operationVSAdaptability or versatility

Solution Approach 1:

The patent extracts the problematic JNI dependency entirely from the system. By removing the need for native interface calls and implementing C memory management semantics directly in Java, the solution achieves platform independence while maintaining 64-bit JVM compatibility and eliminating the bit-model matching requirements of JNI.

Inventive Principle:
Principle #2Taking out (Extraction)

4Productivity

If automatic C to Java translation tool is used, then translation speed is improved, but memory management accuracy deteriorates

Engineering Contradiction:
Improvetranslation speedVSAvoidmemory management accuracy
Core Design Contradiction:
ProductivityVSManufacturing precision

Solution Approach 1:

The patent introduces a specialized emulation layer as an intermediary between Java and C memory models. This layer provides precise control over memory allocation, deallocation, and data structure layout, ensuring accurate replication of C program behavior while allowing the rest of the translation process to proceed automatically.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS9176718B2Java program for emulating the memory management of a C program and corresponding method
Publication Date: 2015.11.03 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US9176718B2 patent drawing
  • US9176718B2 patent drawing

AI summary

Certain example embodiments relate to a computer program written in the programming language Java for emulating the memory management of a computer program written in the programming language C. The C program includes instructions for allocating a memory area, instructions for defining at least one data structure, and instructions for defining at least one pointer to the allocated memory area in accordance with the at least one data structure. The Java program may include instructions for: providing a Java byte array for emulating the allocated memory area of the C program; and providing at least one Java object for emulating the at least one data structure of the C program. The at least one Java object uses at least one Java ByteBuffer object for emulating the at least one pointer of the C program.